/* =====================================================================
   base.css — shared tokens, reset, type scale, container, site bar,
   pills, paper texture and motion hooks for the portfolio pages.
   Plain CSS, no build step.
   ===================================================================== */

:root {
  /* ---- Colour ---- */
  --ink-navy: #10284a;          /* headings, header, pills */
  --ink-body: #3a3345;          /* long text on paper */
  --ink-plum: #311e45;          /* card titles */
  --ink-note: #69497e;          /* handwriting on notes */
  --accent-violet: #a272f7;     /* eyebrow */
  --surface-page: #ffffff;
  --avatar-bg: #e6d6ff;
  --pill-hover: #f9f5ff;
  --guide: #d6c2eb;

  /* ---- Paper: the material every tinted surface is made of ---- */
  --paper: url("../assets/img/paper-texture.webp");

  /* ---- Layout ---- */
  --content: 960px;
  --gutter: clamp(16px, 4vw, 24px);
  --section-gap: clamp(64px, calc(64px + 116 * (100vw - 320px) / 640), 180px);
  --title-gap: 24px;

  /* ---- Type families ---- */
  --font-display: "Bricolage Grotesque", "Golos Text", system-ui, sans-serif;
  --font-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-round: "Fredoka", "Golos Text", system-ui, sans-serif;
  --font-intro: "Fredoka", "Golos Text", system-ui, sans-serif;
  --font-hand: "Playpen Sans", "Fredoka", system-ui, sans-serif;

  /* ---- Type scale: phone size at 320px → Figma size at 960px ----
     Rule: anything above 32px on desktop is 24px on phones; the
     steps below follow the Case Study DS phone sizes. */
  --text-hero:    clamp(24px, calc(24px + 24 * (100vw - 320px) / 640), 48px);
  --text-section: clamp(24px, calc(24px + 16 * (100vw - 320px) / 640), 40px);
  --text-feature: clamp(20px, calc(20px + 12 * (100vw - 320px) / 640), 32px);
  --text-logo:    clamp(24px, calc(24px + 8 * (100vw - 320px) / 640), 32px);
  --text-heading: clamp(20px, calc(20px + 4 * (100vw - 320px) / 640), 24px);
  --text-closing: clamp(22px, calc(22px + 6 * (100vw - 320px) / 640), 28px);
  --text-lead:    clamp(17px, calc(17px + 3 * (100vw - 320px) / 640), 20px);
  --text-body:    clamp(15px, calc(15px + 1 * (100vw - 320px) / 640), 16px);
  --text-small:   14px;  /* phone card copy (Figma 586:10266) */
  --text-tag:     12px;  /* cursor tags only (Figma 571:8584); a short label, never body text */

  /* line heights are the Figma ratios */
  --lh-hero: 1.083;     /* 52/48 */
  --lh-section: 1.3;    /* 52/40 */
  --lh-feature: 1.25;   /* 40/32 */
  --lh-logo: 1.25;      /* 40/32 */
  --lh-heading: 1.5;    /* 36/24 */
  --lh-lead: 1.6;       /* 32/20 */
  --lh-hand: 1.667;     /* 40/24 */
  --lh-body: 1.5;       /* 24/16 */
  --lh-small: 1.714;    /* 24/14 */
  --lh-tag: 1.667;      /* 20/12 */

  color-scheme: light;
}

/* ---------------------------------------------------------------------
   Reset
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface-page);
  color: var(--ink-navy);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, figure { margin: 0; }
a { color: inherit; }
a:focus-visible, label:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-violet);
  outline-offset: 3px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Container and sections
   --------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--content) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { margin-top: var(--section-gap); }
.section__title {
  font-family: var(--font-display);
  font-size: var(--text-section);
  line-height: var(--lh-section);
  font-weight: 800;
  font-variation-settings: "opsz" 14;
  text-align: center;
  text-wrap: balance;
  color: var(--ink-navy);
  margin-bottom: var(--title-gap);
}

/* ---------------------------------------------------------------------
   Paper texture. Add .paper to a tinted surface; --paper-opacity and the
   ::before box can be tuned per surface to match Figma.
   --------------------------------------------------------------------- */
.paper { position: relative; isolation: isolate; overflow: hidden; }
.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--paper) center / cover;
  mix-blend-mode: luminosity;
  opacity: var(--paper-opacity, .5);
  pointer-events: none;
}

/* ---------------------------------------------------------------------
   Pills
   --------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 24px;
  border: 1px solid var(--ink-navy);
  border-radius: 36px;
  font-family: var(--font-round);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  font-weight: 500;
  color: var(--ink-navy);
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  transition: background-color .2s ease;
}
.pill:hover, .pill:focus-visible { background: var(--pill-hover); }

/* ---------------------------------------------------------------------
   Site bar: header and footer (avatar, "SK ." logo, links or a note)
   --------------------------------------------------------------------- */
.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  min-height: 88px;
  padding: 16px;
}
.site-bar__avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; }
.site-bar__logo {
  flex: 1 0 0;
  min-width: 0;
  font-family: var(--font-round);
  font-size: var(--text-logo);
  line-height: var(--lh-logo);
  font-weight: 600;
  font-variation-settings: "wdth" 118;
  font-stretch: 118%;
  color: var(--ink-navy);
  text-decoration: none;
  white-space: nowrap;
}
.site-bar__note {
  font-family: var(--font-round);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  font-weight: 500;
}
.site-header { padding-top: clamp(8px, 1.87vw, 24px); }

/* Phone menu: a hidden checkbox opens the link tray (no script) */
.site-menu-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.site-menu-button { display: none; }
.site-bar__tray, .site-bar__links { display: contents; }

@media (max-width: 719px) {
  .site-bar { padding-inline: 0; gap: 0 12px; }
  .site-menu-button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--ink-navy);
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink-navy);
    transition: background-color .2s ease;
  }
  .site-menu-button:hover { background: var(--pill-hover); }
  .site-menu-toggle:focus-visible + .site-menu-button { outline: 2px solid var(--accent-violet); outline-offset: 3px; }
  .site-menu-button svg { width: 22px; height: 22px; grid-area: 1 / 1; }
  .site-menu-button .icon-close { display: none; }
  .site-menu-toggle:checked + .site-menu-button .icon-menu { display: none; }
  .site-menu-toggle:checked + .site-menu-button .icon-close { display: block; animation: menu-turn .3s ease; }

  .site-bar__tray {
    display: grid;
    flex-basis: 100%;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows .35s ease, opacity .25s ease;
  }
  .site-bar__links {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    gap: 2px;
  }
  .site-menu-toggle:checked ~ .site-bar__tray { grid-template-rows: 1fr; opacity: 1; }
  .site-menu-toggle:checked ~ .site-bar__tray .site-bar__links { padding-top: 12px; }
  .site-bar__links .pill {
    justify-content: flex-start;
    min-height: 48px;
    border-radius: 6px;
    background: var(--pill-hover);
    border-color: transparent;
  }
  .site-bar__links .pill:first-child { border-radius: 20px 20px 6px 6px; }
  .site-bar__links .pill:last-child { border-radius: 6px 6px 20px 20px; }
  .site-menu-toggle:checked ~ .site-bar__tray .pill { animation: menu-link .3s ease both; }
  .site-menu-toggle:checked ~ .site-bar__tray .pill:nth-child(2) { animation-delay: 40ms; }
  .site-menu-toggle:checked ~ .site-bar__tray .pill:nth-child(3) { animation-delay: 80ms; }

  /* footer bar: note and pill drop to their own row */
  .site-footer .site-bar { row-gap: 12px; padding-block: 16px 24px; }
  .site-footer .site-bar__logo { flex-basis: calc(100% - 68px); }
  .site-footer .site-bar__note { order: 3; margin-right: auto; }
  .site-footer .pill { order: 4; }
}
@keyframes menu-link { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@keyframes menu-turn { from { rotate: -90deg; } to { rotate: 0deg; } }

/* ---------------------------------------------------------------------
   Motion hooks (only after js/parallax.js has run)
   --------------------------------------------------------------------- */
[data-parallax] { translate: 0 var(--py, 0px); }
.reveal-on [data-reveal] { opacity: 0; translate: 0 16px; }
.reveal-on [data-reveal].is-visible {
  opacity: 1;
  translate: none;
  transition: opacity .7s ease, translate .7s ease;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-on [data-reveal] { opacity: 1; translate: none; }
  [data-parallax] { translate: none; }
}
