/* perchikov.com, see DESIGN.md */
:root {
  --ground: #E6EBEE;   /* drafting grey */
  --sheet: #F5F7F8;
  --ink: #18222D;      /* graphite navy */
  --pencil: #4E5B66;
  --rule: #C3CCD3;     /* grid line */
  --ochre: #B5800F;    /* the line */
  --ochre-text: #8A600A;

  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 40px; --s5: 64px; --s6: 104px; --s7: 168px;

  --t0: 1rem;       /* 18px base set on html */
  --t1: 1.25rem;
  --t2: 1.5625rem;
  --t3: 1.953rem;
  --t4: 2.441rem;
  --t5: 3.052rem;
  --t6: 3.815rem;
  --t7: 4.768rem;
}

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 400;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--ochre); }

:focus-visible { outline: 3px solid var(--ochre-text); outline-offset: 3px; }

h1, h2, h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.06;
}
h2 { font-size: var(--t4); }
h3 { font-size: var(--t1); line-height: 1.25; }
p { margin: 0; }

.visually-hidden, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus { position: absolute; left: var(--s3); top: var(--s2); background: var(--sheet); padding: var(--s1) var(--s2); z-index: 2; }

/* 12-column grid shared by all sections */
.wrap {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 32px;
}

.btn {
  display: inline-block;
  padding: 0.85em 1.4em;
  background: var(--ink);
  color: var(--sheet);
  text-decoration: none;
  font-weight: 600;
  border-radius: 2px;
}
.btn:hover { background: #0E1620; }
.btn-quiet { background: transparent; color: var(--ink); padding: 0.5em 0; border-bottom: 2px solid var(--ochre); border-radius: 0; }
.btn-quiet:hover { background: transparent; }

/* Top bar */
.top {
  align-items: center;
  padding-top: var(--s3);
  padding-bottom: var(--s3);
}
.top .name { grid-column: 1 / 6; font-weight: 650; text-decoration: none; font-size: var(--t1); }
.top .lang { grid-column: 6 / 9; justify-self: end; }
.top .btn-quiet { grid-column: 9 / 13; justify-self: end; }

/* Language switch: plain codes, no flags (a flag is a country, not a language) */
.lang ul { display: flex; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.lang a, .lang span {
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em;
  color: var(--pencil); text-decoration: none; padding: 0.35em 0.1em;
}
.lang a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ochre); }
.lang [aria-current] { color: var(--ink); font-weight: 500; border-bottom: 2px solid var(--ochre); }
.quotes-note { grid-column: 1 / 13; color: var(--pencil); font-size: 0.88rem; margin-bottom: var(--s3); }

/* Hero */
.hero { padding-top: var(--s4); align-items: start; }
.hero-text { grid-column: 1 / 9; }
.hero h1 {
  font-size: clamp(2.6rem, 5.4vw, var(--t6));
  font-weight: 650;
  letter-spacing: -0.04em;
  max-width: 15em;
}
.lead {
  margin-top: var(--s3);
  max-width: 34em;
  font-size: var(--t1);
  line-height: 1.5;
  color: var(--ink);
}
.hero .lead-human { margin-top: var(--s2); }
.hero .btn { margin-top: var(--s3); }
.hero-photo {
  grid-column: 10 / 13;
  margin: 0.55rem 0 0;
  background: var(--sheet);
  padding: 10px;
}
.hero-photo img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }

/* Hero diagram: full-bleed band */
.hero-diagram {
  max-width: 1240px;
  margin: var(--s5) auto 0;
  padding-inline: 32px;
}
.hero-lines { width: 100%; height: auto; overflow: visible; }
.hero-lines.is-waiting .lane-line { visibility: hidden; }
.lane-line { fill: none; stroke: var(--ochre); stroke-width: 2.2; stroke-linecap: round; }
.lane-line:nth-of-type(2) { stroke: var(--ink); stroke-width: 1.4; }
.lane-line:nth-of-type(3) { stroke: var(--pencil); stroke-width: 1.4; }
.lane-line:nth-of-type(4) { stroke: var(--ink); stroke-width: 1.4; opacity: 0.55; }
.lane-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 15px;
  font-weight: 600;
  fill: var(--pencil);
}

/* Logos */
.logos { padding-top: var(--s6); row-gap: var(--s3); }
.caption {
  grid-column: 1 / 13;
  font-size: var(--t0);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--pencil);
}
.logo-row {
  grid-column: 1 / 13;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4) var(--s4);
  justify-content: space-between;
}
.logo-row img {
  height: var(--h, 28px);
  width: auto;
  filter: brightness(0);
  opacity: 0.62;
}

/* When to call me */
.when { padding-top: var(--s7); }
.when { row-gap: var(--s5); }
.when h2 { grid-column: 1 / 13; }
.when-list {
  grid-column: 1 / 13;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: var(--s5);
  font-size: var(--t2);
  line-height: 1.35;
}
.when-list li { padding-top: var(--s3); padding-right: var(--s5); position: relative; }
.when-list li::before { /* a short piece of the lane */
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 56px; height: 2.2px;
  background: var(--ochre);
}

/* How I work: one straight lane with three stops */
.how { padding-top: var(--s7); row-gap: var(--s5); }
.how-head { grid-column: 1 / 9; display: grid; gap: var(--s3); }
.how-head p { font-size: var(--t1); max-width: 34em; }
.steps {
  grid-column: 1 / 13;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 24px;
  position: relative;
}
.steps::before { /* the lane */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 20px;
  height: 2.2px;
  background: var(--ochre);
}
.step { position: relative; padding-right: var(--s4); }
.stop {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--ground);
  border: 2.2px solid var(--ochre);
  color: var(--ochre-text);
  font-weight: 700;
}
.step h3 { margin-top: var(--s3); font-size: var(--t2); }
.step ul { margin: var(--s2) 0 0; padding: 0; list-style: none; color: var(--pencil); }
.step li { padding: 0.35em 0; }

/* Selected work */
.work { padding-top: var(--s7); }
.work h2 { grid-column: 1 / 13; margin-bottom: var(--s5); }
.case {
  grid-column: 1 / 13;
  display: grid;
  grid-template-columns: subgrid;
  padding: var(--s4) 0;
  border-top: 1px solid var(--rule);
}
.case:last-child { border-bottom: 1px solid var(--rule); }
.case-meta {
  grid-column: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--pencil);
  font-size: 0.89rem;
}
.case-co { color: var(--ink); font-weight: 650; font-size: var(--t0); }
.case-body { grid-column: 5 / 12; }
.case-body p { margin-top: var(--s2); max-width: 38em; }

/* Testimonials */
.quotes { padding-top: var(--s7); row-gap: var(--s5); }
.quote { margin: 0; }
.quote blockquote { margin: 0; }
.quotes { align-items: stretch; }
.quote {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--sheet);
  padding: var(--s4);
}
.quote blockquote p { font-size: var(--t0); }
.quote blockquote p::before { content: "\201C"; }
.quote blockquote p::after { content: "\201D"; }
.quote figcaption {
  margin-top: var(--s3);
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--pencil);
  font-size: 0.89rem;
  line-height: 1.35;
}
.quote figcaption a { color: var(--ink); font-weight: 600; text-decoration: none; }
.quote figcaption a:hover { text-decoration: underline; }
.quote figcaption img { width: 56px; height: 56px; object-fit: cover; border-radius: 2px; filter: grayscale(1); }

/* About */
.about { padding-top: var(--s7); align-items: start; }
.about-photo { grid-column: 1 / 6; margin: 0; background: var(--sheet); padding: 10px; }
.about-photo img { aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; width: 100%; }
.about-ironman { margin: var(--s3) 0 0; max-width: 30em; }
.about-ironman img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.about-ironman figcaption { margin-top: var(--s1); color: var(--pencil); font-size: 0.83rem; }
.about-text { grid-column: 7 / 13; display: grid; gap: var(--s3); padding-top: var(--s2); }
.about-text p { max-width: 36em; }

/* Contact */
.contact { padding-top: var(--s7); padding-bottom: var(--s6); row-gap: var(--s3); }
.contact h2 { grid-column: 1 / 10; font-size: clamp(2.45rem, 6vw, var(--t6)); }
.contact h2 a { text-decoration: none; background-image: linear-gradient(var(--ochre), var(--ochre)); background-size: 100% 3px; background-position: 0 100%; background-repeat: no-repeat; padding-bottom: 0.06em; }
.contact > p { grid-column: 1 / 8; font-size: var(--t1); }
.contact-links { grid-column: 1 / 13; list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; gap: var(--s4); flex-wrap: wrap; font-weight: 600; }

.foot { padding-bottom: var(--s4); color: var(--pencil); font-size: 0.83rem; }
.foot p { grid-column: 1 / 13; border-top: 1px solid var(--rule); padding-top: var(--s3); }

/* Tablet */
@media (max-width: 960px) {
  .hero-text { grid-column: 1 / 13; }
  .hero-photo { grid-column: 1 / 6; grid-row: 1; margin-bottom: var(--s4); }
  .quote { grid-column: 1 / 13; }
  .case-meta { grid-column: 1 / 5; }
  .case-body { grid-column: 5 / 13; }
  .about-photo { grid-column: 1 / 6; }
  .about-text { grid-column: 7 / 13; }
  .contact h2 { grid-column: 1 / 13; }
}

/* Phone */
@media (max-width: 640px) {
  html { font-size: 17px; }
  .wrap, .hero-diagram { padding-inline: 24px; }
  .wrap { column-gap: 12px; }
  .top { row-gap: var(--s2); }
  .top .name { grid-column: 1 / 7; grid-row: 1; font-size: var(--t0); }
  .top .lang { grid-column: 7 / 13; grid-row: 1; }
  .top .btn-quiet { grid-column: 1 / 13; grid-row: 2; justify-self: start; font-size: 0.82rem; }
  .hero { padding-top: var(--s2); }
  .hero-photo { grid-column: 1 / 7; grid-row: auto; margin: var(--s4) 0 0; }
  .lead { font-size: var(--t0); margin-top: var(--s3); }
  .logos { padding-top: var(--s5); }
  .logo-row { gap: var(--s3) var(--s4); }
  .logo-row img { transform: scale(0.82); transform-origin: left center; }
  .when, .how, .work, .quotes, .about, .contact { padding-top: var(--s6); }
  .when-list { font-size: var(--t1); grid-template-columns: 1fr; row-gap: var(--s4); }
  .when-list li { padding-right: 0; }
  .how-head { grid-column: 1 / 13; }
  .steps { grid-template-columns: 1fr; row-gap: var(--s4); }
  .steps::before { left: 20px; right: auto; top: 0; bottom: 0; width: 2.2px; height: auto; }
  .step { padding-left: 64px; padding-right: 0; }
  .step .stop { position: absolute; left: 0; top: 0; }
  .step h3 { margin-top: 6px; }
  .case-meta, .case-body { grid-column: 1 / 13; }
  .case-body { margin-top: var(--s2); }
  .quote { padding: var(--s3); }
  .about-photo { grid-column: 1 / 9; }
  .about-text { grid-column: 1 / 13; padding-top: var(--s4); }
  .contact > p { grid-column: 1 / 13; }
  .contact h2 { grid-column: 1 / 13; }
}

/* Mono for small technical labels (Alex's references: looot.ai, heyarnoux.com) */
.caption, .case-meta span:not(.case-co), .stop, .quote figcaption span, .about-ironman figcaption, .foot, .lane-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0;
}
.caption, .case-meta span:not(.case-co), .about-ironman figcaption, .foot { font-size: 0.78rem; }
.quote figcaption span { font-size: 0.78rem; }
.quote figcaption a { font-family: "Inter", system-ui, sans-serif; font-size: 0.89rem; }
.lane-label { font-size: 14px; font-weight: 500; }
.lane-line { stroke-width: 1.6; }
.lane-line:nth-of-type(1) { stroke-width: 2; }
.lane-line:nth-of-type(n+2) { stroke-width: 1.2; }

/* Two drawings of the diagram: wide for desktop, narrow for phones */
.hero-lines--m { display: none; }

@media (max-width: 640px) {
  .hero-lines--d { display: none; }
  .hero-lines--m { display: block; }
  .hero-lines--m .lane-label { font-size: 26px; }
  .hero-lines--m .lane-line:nth-of-type(1) { stroke-width: 3; }
  .hero-lines--m .lane-line:nth-of-type(n+2) { stroke-width: 2; }
  /* logos: an even two-column grid, one optical size */
  .logo-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: center;
    align-items: center;
    gap: 32px 16px;
  }
  .logo-row img { transform: none; height: calc(var(--h, 28px) * 0.72); max-width: 100%; }
}
