/* =========================================================
   nesov.fr — editorial cream & ink
   ========================================================= */

:root {
  --bg:      #ede4cf;        /* warm cream */
  --paper:   #f5edd8;        /* lighter cream for blocks */
  --ink:     #141414;        /* near-black */
  --muted:   #6d665a;        /* taupe */
  --rule:    #141414;
  --gold:    #b68a2e;        /* muted gold */
  --orange:  #d46a2e;        /* burnt orange, used sparingly */

  --font-display: "Fraunces", "Times New Roman", Georgia, serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 38rem;

  /* Fluid type scale (1.25 ratio, clamped for mobile/desktop) */
  --step--1: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --step-0:  clamp(1rem, 0.94rem + 0.3vw, 1.0625rem);
  --step-1:  clamp(1.125rem, 1.05rem + 0.4vw, 1.25rem);
  --step-2:  clamp(1.375rem, 1.22rem + 0.7vw, 1.625rem);
  --step-3:  clamp(1.75rem, 1.45rem + 1.4vw, 2.375rem);
  --step-4:  clamp(2.5rem, 1.9rem + 2.8vw, 4rem);
  --step-5:  clamp(3.5rem, 2.6rem + 4.3vw, 6.5rem);
}

/* -------- reset -------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "ss01", "cv11", "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 4rem 0;
}

::selection { background: var(--ink); color: var(--bg); }

/* -------- typography -------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  color: var(--ink);
}

h1 { font-size: var(--step-5); font-weight: 900; letter-spacing: -0.035em; }
h2 { font-size: var(--step-4); font-weight: 700; }
h3 { font-size: var(--step-2); font-weight: 600; }
h4 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0 0 1.15em; max-width: var(--measure); }
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table { max-width: var(--measure); }

.prose ul,
.prose ol { padding-left: 1.2em; margin: 0 0 1.15em; }
.prose li + li { margin-top: 0.35em; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 120ms ease;
}
a:hover { color: var(--gold); }

blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--ink);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-1);
  color: var(--ink);
}

/* -------- code -------- */
pre, code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
:not(pre) > code {
  background: var(--paper);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  border: 1px solid rgba(20,20,20,0.08);
}
pre {
  background: var(--paper);
  border: 1px solid rgba(20,20,20,0.1);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 2px;
  line-height: 1.55;
}
pre code { background: transparent; border: 0; padding: 0; }

/* -------- layout -------- */
.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem 1.75rem 6rem;
}

/* -------- header -------- */
.site-header {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  border-bottom: 1px solid var(--rule);
}
.site-header .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.015em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
}
.site-header .brand:hover { color: var(--ink); }
.site-header .brand .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(20,20,20,0.08);
}
.site-header nav {
  display: flex;
  gap: 1.75rem;
}
.site-header nav a {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  text-decoration: none;
  color: var(--ink);
}
.site-header nav a.active,
.site-header nav a:hover { color: var(--gold); }

@media (max-width: 560px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .site-header nav { gap: 1.25rem; flex-wrap: wrap; }
}

/* -------- footer -------- */
.site-footer {
  max-width: 72rem;
  margin: 6rem auto 2.5rem;
  padding: 1.75rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: var(--step--1);
  color: var(--muted);
}
.site-footer a {
  color: var(--ink);
  text-decoration: none;
  margin-left: 1.5rem;
}
.site-footer a:first-child { margin-left: 0; }
.site-footer a:hover { color: var(--gold); }
.site-footer .colophon {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-0);
  color: var(--ink);
  letter-spacing: -0.005em;
}

/* -------- home hero -------- */
.hero {
  padding: 6vh 0 5vh;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
.hero h1 {
  font-size: var(--step-5);
  max-width: 12ch;
  margin: 0;
}
.hero h1 .dot,
.cv-header h1 .dot,
h1 .dot { color: var(--gold); }
.hero .lede {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.2;
  max-width: 22ch;
  margin: 0;
  color: var(--ink);
}
.hero .bio {
  max-width: var(--measure);
  color: var(--ink);
  font-size: var(--step-1);
  line-height: 1.55;
  margin: 0;
}

/* -------- section label (shared) -------- */
.section-label {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* -------- post list -------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}
.post-list li {
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 2rem;
  align-items: baseline;
}
.post-list li:last-child { border-bottom: 1px solid var(--rule); }
.post-list time {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.post-list h3 {
  font-size: var(--step-2);
  font-weight: 600;
  margin: 0 0 0.3em;
  letter-spacing: -0.015em;
}
.post-list h3 a { text-decoration: none; }
.post-list h3 a:hover { color: var(--gold); }
.post-list .excerpt {
  color: var(--muted);
  margin: 0;
  max-width: 52ch;
}

@media (max-width: 640px) {
  .post-list li { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* Compact post list (used inside CV writing section) */
.post-list--compact { margin-top: 0; }
.post-list--compact li {
  padding: 0 0 1.25rem;
  border-top: 0;
  grid-template-columns: 9rem 1fr;
}
.post-list--compact li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.post-list--compact li + li {
  padding-top: 1.25rem;
  border-top: 1px dotted rgba(20,20,20,0.18);
}
.post-list--compact h3 { font-size: var(--step-1); }

/* -------- CV page -------- */
.cv-header {
  padding: 4vh 0 2vh;
}
.cv-header h1 {
  font-size: var(--step-5);
  margin: 0 0 0.5rem;
}
.cv-header .headline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.15;
  max-width: 32ch;
  margin: 0 0 1.25rem;
  color: var(--ink);
}
.cv-header .tagline {
  font-family: var(--font-body);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 2rem;
}
.cv-header .summary {
  max-width: var(--measure);
  font-size: var(--step-1);
  line-height: 1.6;
  margin: 0 0 1rem;
}
.cv-header .summary:last-of-type { margin-bottom: 0; }

.cv-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 2rem;
}
.cv-section > h2 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0;
}

.cv-entry { margin-bottom: 2.25rem; }
.cv-entry:last-child { margin-bottom: 0; }

/* entry with logo (education) — grid with logo on the left */
.cv-entry--logo {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.cv-entry--logo .entry-body { min-width: 0; }
.cv-entry--logo .entry-body > *:last-child { margin-bottom: 0; }
.entry-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-top: 0.3rem;
  opacity: 0.88;
}
@media (max-width: 480px) {
  .cv-entry--logo { grid-template-columns: 44px 1fr; gap: 1rem; }
  .entry-logo { width: 44px; height: 44px; }
}
.cv-entry .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.2rem;
}
.cv-entry h3 {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.cv-entry h3 .loc {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  text-transform: none;
  margin-left: 0.25rem;
}
.cv-entry .dates {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: var(--step--1);
  white-space: nowrap;
  letter-spacing: 0.05em;
}
.cv-entry .role {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-1);
  color: var(--ink);
  margin: 0 0 0.6rem;
}
.cv-entry ul {
  padding-left: 1em;
  margin: 0.25rem 0 0;
  color: var(--ink);
}
.cv-entry li { margin-bottom: 0.25rem; }

/* contact form — editorial voice, thin ink border, Fraunces accents */
.contact-page { max-width: 42rem; }

.contact-header {
  padding: 4vh 0 2vh;
  margin-bottom: 1.5rem;
}
.contact-header h1 {
  font-size: var(--step-5);
  margin: 0 0 1rem;
}
.contact-header .summary {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-2);
  line-height: 1.3;
  max-width: 36ch;
  margin: 0;
  color: var(--ink);
}

.contact-form {
  margin: 2.5rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.contact-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-form .field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  min-height: 1.25em;
}

.contact-form label {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.contact-form .optional {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0.1em 0.5em;
  border: 1px solid rgba(20,20,20,0.15);
  border-radius: 999px;
  font-size: 0.7em;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
  font-style: italic;
  color: var(--muted);
}

.contact-form .char-count {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition: color 160ms ease;
}
.contact-form .char-count.near-limit { color: var(--gold); }
.contact-form .char-count.at-limit { color: var(--orange); }

.contact-form .field-error {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-style: italic;
  color: var(--orange);
  letter-spacing: 0.01em;
}

.contact-form input,
.contact-form textarea {
  font-family: var(--font-body);
  font-size: var(--step-0);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 0.65rem 0;
  outline: none;
  resize: vertical;
  width: 100%;
  border-radius: 0;
  line-height: 1.55;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
  opacity: 0.55;
  font-style: italic;
}
.contact-form textarea {
  border: 1px solid var(--ink);
  padding: 0.85rem 1rem;
  min-height: 9rem;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 1px 0 0 var(--gold);
}
.contact-form textarea:focus {
  box-shadow: 0 0 0 1px var(--gold);
}

.contact-form .honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-form .form-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.contact-submit {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.75rem 2.25rem;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: -0.01em;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.contact-submit:hover:not(:disabled) {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
}
.contact-submit:active:not(:disabled) { transform: translateY(1px); }
.contact-submit:disabled {
  opacity: 0.5;
  cursor: wait;
}

.contact-status {
  margin: 0;
  min-height: 1.2em;
  font-size: var(--step--1);
  color: var(--muted);
  font-style: italic;
  flex: 1;
}
.contact-status.error { color: var(--orange); font-style: normal; }

/* success panel — replaces the form on successful submission */
.contact-success {
  padding: 2.25rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  max-width: 36rem;
}
.contact-success-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-4);
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.contact-success-body {
  margin: 0;
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  max-width: 38ch;
}

.contact-fallback {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px dotted rgba(20,20,20,0.2);
  font-size: var(--step--1);
  color: var(--muted);
}
.contact-fallback a { color: var(--ink); }

/* testimonials — "What people say" block */
.testimonial {
  margin: 0 0 2.5rem;
  max-width: var(--measure);
}
.testimonial:last-child { margin-bottom: 0; }
.testimonial .quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-1);
  line-height: 1.45;
  margin: 0 0 1rem;
  color: var(--ink);
  padding: 0;
  border: 0;
  letter-spacing: -0.005em;
}
.testimonial .quote::before { content: "\201C"; margin-right: 0.05em; }
.testimonial .quote::after { content: "\201D"; margin-left: 0.05em; }
.testimonial .attribution {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--muted);
  margin: 0;
  line-height: 1.35;
}
.testimonial-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(20,20,20,0.08);
}
.testimonial .attribution strong {
  color: var(--ink);
  font-weight: 500;
}
.testimonial .attribution a {
  text-decoration: none;
  color: inherit;
}
.testimonial .attribution a:hover strong { color: var(--gold); }

/* per-company "Shipped with:" line — scoped stack, ATS-friendly */
.entry-tools {
  margin: 1.25rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px dotted rgba(20,20,20,0.15);
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--step--1);
  color: var(--muted);
  max-width: var(--measure);
  line-height: 1.55;
}
.entry-tools strong {
  font-style: normal;
  font-weight: 500;
  color: var(--ink);
  margin-right: 0.35em;
}

/* sub-roles within a single company */
.cv-role {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dotted rgba(20,20,20,0.2);
}
.cv-role:first-of-type {
  margin-top: 0.4rem;
  padding-top: 0;
  border-top: 0;
}
.cv-role .role-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.25rem;
}
.cv-role .role-head .role { margin: 0; }
.cv-role .role-head .dates { font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }

/* services menu ("How I help") */
.services { margin: 0; max-width: var(--measure); }
.service {
  padding: 1rem 0;
  margin: 0;
  border-top: 1px dotted rgba(20,20,20,0.2);
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink);
}
.service:first-child { border-top: 0; padding-top: 0.25rem; }
.service-label {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-right: 0.25em;
}

@media (max-width: 720px) {
  .cv-section { grid-template-columns: 1fr; gap: 0.75rem; }
  .cv-entry .head { flex-direction: column; gap: 0; }
  .cv-role .role-head { flex-direction: column; gap: 0; }
}

/* -------- article -------- */
article.post header {
  padding: 4vh 0 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
article.post h1 {
  font-size: var(--step-4);
  margin: 0 0 1rem;
  max-width: 22ch;
}
article.post .meta {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: 0;
}
article.post .meta > * + *::before {
  content: "·";
  margin: 0 0.5em;
}

article.post .prose {
  margin-top: 1.5rem;
}
article.post .prose h2 {
  font-size: var(--step-3);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}
article.post .prose h3 {
  font-size: var(--step-2);
  margin-top: 2rem;
}
article.post .post-tags {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

/* inline figures in posts (diagrams, SVG visuals) */
.post-figure {
  margin: 2.5rem 0;
  max-width: var(--measure);
}
.post-figure img,
.post-figure svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(20,20,20,0.1);
}
.post-figure figcaption {
  margin-top: 0.75rem;
  font-size: var(--step--1);
  font-style: italic;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

/* -------- tag chips -------- */
.tag {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--ink);
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
  text-decoration: none;
  color: var(--ink);
}
.tag:hover { background: var(--ink); color: var(--bg); }

/* -------- pagination -------- */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.pagination a { text-decoration: none; }
.pagination a:hover { color: var(--gold); }

/* -------- Prism (warm ink on cream) -------- */
code[class*="language-"],
pre[class*="language-"] {
  color: var(--ink);
  text-shadow: none;
  background: var(--paper);
  font-family: var(--font-mono);
}
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--muted); font-style: italic; }
.token.punctuation { color: var(--ink); }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: var(--orange); }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: var(--gold); }
.token.atrule, .token.attr-value, .token.keyword { color: var(--ink); font-weight: 600; }
.token.function, .token.class-name { color: var(--ink); font-style: italic; }
.token.regex, .token.important, .token.variable { color: var(--orange); }

/* -------- tag index -------- */
.tag-header h1 {
  font-size: var(--step-4);
  margin: 0 0 0.5rem;
}
.tag-header h1::before { content: "#"; color: var(--gold); margin-right: 0.1em; }

/* -------- utilities -------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
