/* ==========================================================================
   yasinskiy.se - stylesheet
   Communication system 01: Instrument Sans (Regular, Medium) only.
   Warm paper, confident ink, orange signal. Square corners, 1px rules,
   no shadows, 8px rhythm. Light and dark tokens.
   ========================================================================== */

/* ---- Fonts (self-hosted woff2 latin subsets, SIL OFL) ---- */
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---- Tokens ---- */
:root {
  --bg: #F6F4EF;       /* Paper */
  --ink: #111111;      /* Ink: text, actual data, decisions */
  --muted: #6B6B66;    /* Muted: context, owners, sources */
  --rule: #DAD7CF;     /* Rule: structure and separation */
  --signal: #C8481F;   /* Signal: questions, change, action */
  --surface: #FFFFFF;  /* system nodes, cards */
  --tint: #ECE9E1;     /* callouts, table headers */
  --on-ink: #F6F4EF;

  --font: "Instrument Sans", -apple-system, "Segoe UI", sans-serif;

  --s-4: 4px; --s-8: 8px; --s-12: 12px; --s-16: 16px; --s-24: 24px;
  --s-32: 32px; --s-48: 48px; --s-56: 56px; --s-64: 64px;

  --max-w: 1280px;
  --gutter: 56px;
  --label-col: 272px;
  --section-pad: 144px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E0D; --ink: #EDEBE6; --muted: #9A9892; --rule: #2A2A27;
    --signal: #F07A52; --surface: #171715; --tint: #1A1A18; --on-ink: #0E0E0D;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E0D; --ink: #EDEBE6; --muted: #9A9892; --rule: #2A2A27;
  --signal: #F07A52; --surface: #171715; --tint: #1A1A18; --on-ink: #0E0E0D;
  color-scheme: dark;
}

/* ---- Reset & base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; margin: 0; }
h1 em, h2 em { font-style: normal; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }

.wrap { max-width: var(--max-w); margin-inline: auto; padding-inline: var(--gutter); }

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

.skip-link {
  position: absolute; left: 0; top: -100%;
  background: var(--ink); color: var(--on-ink);
  padding: 12px 20px; z-index: 100; font-size: 16px; font-weight: 500;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

/* ---- Type roles ---- */
.eyebrow, .section-label, .fit-label, .mono, .pill, .brand-role {
  font-size: 16px; font-weight: 500; line-height: 1.2; letter-spacing: 0; color: var(--muted);
}

/* ---- Header / nav ---- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-24); padding-block: var(--s-16); }
.brand { display: flex; flex-direction: column; gap: var(--s-4); text-decoration: none; }
.brand-name { font-size: 18px; font-weight: 500; line-height: 1.3; }
.brand-role { font-size: 15px; font-weight: 400; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--rule); border-radius: 0;
  color: var(--ink); font: 500 16px/1.2 var(--font); padding: var(--s-8) var(--s-16); cursor: pointer;
}
.nav-list { display: flex; align-items: center; gap: var(--s-32); font-size: 18px; line-height: 1.3; }
.nav-list a { text-decoration: none; color: var(--muted); }
.nav-list a:hover, .nav-list a:focus-visible, .nav-list a[aria-current="page"] {
  color: var(--ink); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px;
}

/* ---- Button: the one call to action ---- */
.btn, .nav-cta {
  display: inline-block; font: 500 18px/1.3 var(--font); text-decoration: none;
  background: var(--ink); color: var(--on-ink);
  border: 1px solid var(--ink); border-radius: 0;
  padding: var(--s-12) var(--s-24); cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn:hover, .nav-cta:hover { opacity: 0.88; }
.nav-list a.nav-cta { color: var(--on-ink); text-decoration: none; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav-list {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: flex-start; gap: var(--s-24);
    background: var(--bg); border-bottom: 1px solid var(--rule);
    padding: var(--s-24) var(--gutter) var(--s-32);
  }
  .nav-list.is-open { display: flex; }
}

/* ---- Hero ---- */
.hero { padding-block: var(--section-pad); border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-64); align-items: start; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-24); }
.hero-copy > * { margin: 0; }
.hero-h1 { font-size: 88px; line-height: 1.02; letter-spacing: -0.025em; max-width: 9.5em; }
.hero-sub { font-size: 24px; line-height: 1.3; color: var(--muted); max-width: 40ch; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--s-16); }
/* Transparent PNG: sits directly on the paper, no fill, no frame */
.hero-portrait { margin: 0; display: flex; flex-direction: column; gap: var(--s-12); }
.hero-portrait img { width: 100%; height: auto; }
.hero-portrait figcaption {
  display: flex; justify-content: space-between; gap: var(--s-16);
  font-size: 15px; font-weight: 400; line-height: 1.3; color: var(--muted);
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-48); }
  .hero-portrait { max-width: 360px; }
}

/* ---- Sections: label column + content ---- */
.section { padding-block: var(--section-pad); border-bottom: 1px solid var(--rule); }
.section > .wrap { display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr); gap: var(--s-48); }
.section-label { margin: 0; }
.section-body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-48); min-width: 0; width: 100%; }
.section-body > * { margin: 0; }
.section-h { font-size: 50px; line-height: 1.08; max-width: 18ch; }
.sub-h { font-size: 28px; line-height: 1.2; margin-bottom: var(--s-16); }
@media (max-width: 860px) {
  .section > .wrap { grid-template-columns: 1fr; gap: var(--s-24); }
}

/* ---- Problems: questions, so each one gets the signal edge ---- */
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-16); width: 100%; }
.problem {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-8);
  padding: var(--s-16) var(--s-24) var(--s-24); background: var(--tint);
  border-left: 2px solid var(--signal);
}
.problem p { margin: 0; }
.problem .pill { color: var(--signal); }
.problem-q { font-size: 22px; line-height: 1.3; color: var(--ink); }
@media (max-width: 1100px) { .problem-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .problem-grid { grid-template-columns: 1fr; } }

/* ---- Built: system nodes ---- */
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-24); width: 100%; }
.feature { display: flex; flex-direction: column; gap: var(--s-16); background: var(--surface); border: 1px solid var(--rule); padding: var(--s-24); min-height: 164px; }
.feature-wide { grid-column: 1 / -1; }
.feature h3 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.feature p { margin: 0; color: var(--muted); font-size: 19px; line-height: 1.3; max-width: 60ch; }
.feature .why { color: var(--ink); }
@media (max-width: 720px) { .feature-grid { grid-template-columns: 1fr; } }

/* ---- Experiment log (hidden section) ---- */
.exp-list { width: 100%; border-bottom: 1px solid var(--rule); }
.exp { display: grid; grid-template-columns: 176px 1fr; gap: var(--s-24); padding-block: var(--s-24); border-top: 1px solid var(--rule); }
.exp-meta { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-12); }
.exp h3 { font-size: 26px; line-height: 1.25; letter-spacing: -0.01em; margin-bottom: var(--s-16); }
.exp dl { margin: 0; display: grid; grid-template-columns: 112px 1fr; gap: var(--s-8) var(--s-16); }
.exp dt { font-size: 15px; font-weight: 400; color: var(--muted); padding-top: 4px; }
.exp dd { margin: 0; max-width: 60ch; }
.status { display: inline-flex; align-items: center; gap: var(--s-8); font-size: 16px; font-weight: 500; line-height: 1.2; color: var(--muted); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status[data-status="running"] { color: var(--signal); }
@media (max-width: 720px) {
  .exp { grid-template-columns: 1fr; gap: var(--s-12); }
  .exp-meta { flex-direction: row; gap: var(--s-16); }
  .exp dl { grid-template-columns: 1fr; gap: 2px; }
  .exp dd { margin-bottom: var(--s-12); }
}

/* ---- Build cards (hidden section) ---- */
.build-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-32); width: 100%; }
.build { border: 1px solid var(--rule); background: var(--surface); }
.build-shot { aspect-ratio: 16 / 10; background: var(--bg); border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; padding: var(--s-16); text-align: center; }
.build h3 { font-size: 26px; line-height: 1.2; margin: var(--s-24) var(--s-24) var(--s-12); }
.build p { margin: 0 var(--s-24) var(--s-12); color: var(--muted); font-size: 19px; }
.build .build-facts { margin-bottom: var(--s-24); }
@media (max-width: 720px) { .build-grid { grid-template-columns: 1fr; } }

/* ---- Metric grid (hidden section) ---- */
.metric-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); column-gap: var(--s-24); border-top: 1px solid var(--rule); }
.metric { padding: var(--s-32) var(--s-24) var(--s-32) 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: var(--s-8); }
.metric > * { margin: 0; }
.metric-n { font-size: 56px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; color: var(--signal); }
.metric h3 { font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.metric p:not(.metric-n) { color: var(--muted); font-size: 17px; line-height: 1.3; }
@media (max-width: 860px) { .metric-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .metric-grid { grid-template-columns: 1fr; } }

/* ---- About (hidden section) ---- */
.about-grid { display: grid; grid-template-columns: 1fr 340px; gap: var(--s-64); align-items: start; width: 100%; }
.about-copy p { max-width: 58ch; }
.about-side { border-left: 1px solid var(--rule); padding-left: var(--s-32); display: flex; flex-direction: column; gap: var(--s-32); }
.fit-label { margin: 0 0 var(--s-12); }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--s-8); }
.tag-list li { font-size: 16px; line-height: 1.2; padding: var(--s-4) var(--s-12); border: 1px solid var(--rule); }
.row-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-16); padding-block: var(--s-8); border-bottom: 1px solid var(--rule); font-size: 20px; line-height: 1.35; }
.row-list li span:last-child { color: var(--muted); font-size: 18px; white-space: nowrap; }
.side-link { margin: var(--s-12) 0 0; font-size: 16px; }
.side-link a { text-underline-offset: 4px; }
@media (max-width: 980px) {
  .about-grid { grid-template-columns: 1fr; gap: var(--s-48); }
  .about-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: var(--s-32); }
}

/* ---- Contact ---- */
.section-contact { border-bottom: none; }
.contact-sub { color: var(--muted); font-size: 24px; }
.contact-alt { color: var(--muted); font-size: 16px; }
.contact-alt a { text-underline-offset: 4px; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--rule); padding-block: var(--s-48); }
.footer-inner { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-24); font-size: 15px; line-height: 1.4; color: var(--muted); }
.footer-col p { margin: 0 0 var(--s-4); }
.footer-controls { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-12); }
.theme-toggle { font: 500 15px/1.2 var(--font); background: none; border: 1px solid var(--rule); border-radius: 0; color: var(--ink); padding: var(--s-8) var(--s-16); cursor: pointer; }
.theme-toggle:hover { border-color: var(--ink); }
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-controls { align-items: flex-start; }
}

/* ---- Motion: reveal-once, respects reduced motion ---- */
.reveal-lines, .reveal-fade { opacity: 0; transform: translateY(8px); }
.reveal-lines.is-visible, .reveal-fade.is-visible { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s ease; }
@media (prefers-reduced-motion: reduce) {
  .reveal-lines, .reveal-fade { opacity: 1 !important; transform: none !important; }
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ---- Supporting page elements ---- */
.lede { font-size: 24px; max-width: 62ch; color: var(--muted); }
.shot { margin: 0; }
.shot img { width: 100%; height: auto; border: 1px solid var(--rule); }
.shot figcaption { margin-top: var(--s-12); font-size: 15px; color: var(--muted); }
.shot-main { margin-bottom: var(--s-48); }
.shot-inline { margin-top: var(--s-24); }
.closing-line { font-size: 28px; font-weight: 500; line-height: 1.3; max-width: 36em; margin: var(--s-48) 0 0; }
.principles { border-top: 1px solid var(--rule); max-width: 62ch; }
.principles li { padding-block: var(--s-16); border-bottom: 1px solid var(--rule); }

/* ---- Booking dialog: sized to the viewport so the page never scrolls.
   Width is fixed at the iframe's two-column breakpoint (calendar + time picker side by side);
   below that it goes full-bleed so the embed switches to its stacked layout in one step. ---- */
.book-dialog {
  position: fixed; inset: 0; margin: auto;
  width: min(880px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 32px));
  padding: 0; border: 1px solid var(--rule); background: #fff; color: #111; overflow: hidden;
}
.book-dialog[open] { display: block; }
.book-dialog::backdrop { background: rgba(0,0,0,0.55); }
.book-frame { display: block; border: 0; width: 100%; height: 100%; background: #fff; }
.book-close {
  position: absolute; top: 8px; right: 8px; z-index: 1; width: 36px; height: 36px;
  font-size: 26px; line-height: 1; background: rgba(255,255,255,0.9); border: 0; border-radius: 50%;
  color: #111; cursor: pointer;
}
.book-close:hover { background: #eee; }
@media (max-width: 640px) {
  .book-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; }
}

/* ---- Tablet (<= 1024px) ---- */
@media (max-width: 1024px) {
  :root { --gutter: 32px; --section-pad: 96px; }
  .hero-h1 { font-size: 64px; }
  .section-h { font-size: 40px; }
}

/* ---- Mobile (<= 720px) ---- */
@media (max-width: 720px) {
  :root { --gutter: 20px; --section-pad: 64px; }
  body { font-size: 17px; }
  .hero-h1 { font-size: 44px; }
  .hero-sub, .contact-sub, .lede { font-size: 20px; }
  .section-h { font-size: 32px; }
  .problem-q { font-size: 20px; }
  .feature h3, .exp h3, .build h3 { font-size: 22px; }
  .metric-n { font-size: 40px; }
}
