/* ==========================================================================
   Eyal Weissbin — shared base styles
   Tokens, reset, typography and reusable components (nav, buttons, panels,
   labels, footer). Every page loads this file; page-specific styles go in
   their own file (e.g. css/home.css).
   ========================================================================== */

:root {
  /* Color */
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #0A0A0A;
  --slate: #475569;
  --accent: #2563EB;
  --grid: #E2E8F0;

  /* Line & shadow */
  --bw: 3px;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);

  /* Type: families */
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  /* Type: one scale for every page */
  --fs-display: clamp(2.1rem, 6vw, 5rem);       /* page titles: hero, portfolio, articles, about */
  --fs-h1:      clamp(2rem, 4.4vw, 3.4rem);     /* full-screen project/article titles, statement band */
  --fs-h2:      clamp(1.9rem, 4vw, 3rem);       /* section titles */
  --fs-h3:      clamp(1.35rem, 2.4vw, 1.9rem);  /* feature titles: slides, article cards, sub-sections */
  --fs-h4:      1.25rem;                        /* item titles: cards, steps, list items */
  --fs-quote:   clamp(1.15rem, 2vw, 1.5rem);    /* quotes, taglines, highlighted statements */
  --fs-lead:    clamp(1.08rem, 1.4vw, 1.22rem); /* intro paragraphs under titles */
  --fs-body-lg: 1.08rem;                        /* long-form reading text */
  --fs-body:    1rem;
  --fs-small:   .94rem;                         /* card descriptions, notes */
  --fs-mono:    .8125rem;                       /* mono details: names, counters */
  --fs-label:   .75rem;                         /* mono labels, nav, breadcrumbs, links */
  --fs-micro:   .6875rem;                       /* mono tags and stickers */

  /* Layout */
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 56px);
  --section-y: clamp(64px, 10vw, 120px);
  --page-top: clamp(48px, 8vw, 104px);   /* space above each page's title block */
  --nav-h: 72px;
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* "hidden" always wins, so sections/forms can be switched off in HTML */
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 800; line-height: 1.04; letter-spacing: -.02em; }
h3, h4 { line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; background: var(--ink); color: #fff;
  font-family: var(--font-mono); font-size: var(--fs-mono); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Blueprint grid background ---------------------------------------------- */
.grid-bg {
  position: fixed; inset: -40px 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* Layout helpers --------------------------------------------------------- */
.container { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.section--rule { border-top: var(--bw) solid var(--ink); }
.section--surface { background: var(--surface); }

.section-head { max-width: 46rem; margin-bottom: clamp(32px, 5vw, 52px); }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { margin-top: 18px; color: var(--slate); font-size: var(--fs-lead); }

/* Small mono label, e.g. "// The diagnosis" */
.label {
  display: block; margin-bottom: 14px;
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}

/* Breadcrumb (shared) --------------------------------------------------- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .08em; text-transform: uppercase; color: var(--slate);
}
.crumbs a { text-decoration: none; color: var(--slate); border-bottom: 2px solid transparent; }
.crumbs a:hover { color: var(--ink); border-color: var(--accent); }
.crumbs [aria-current] { color: var(--ink); font-weight: 700; }
.crumbs span[aria-hidden] { opacity: .4; }

/* Big outlined background numerals that drift behind a section (shared) */
.has-ghost { position: relative; overflow: hidden; isolation: isolate; }
.has-ghost > .container { position: relative; z-index: 1; }
.ghost {
  position: absolute; z-index: 0; top: 50%; right: -.06em; margin-top: -.55em;
  font-family: var(--font-display); font-weight: 800; line-height: 1;
  font-size: clamp(9rem, 28vw, 24rem); letter-spacing: -.04em;
  color: transparent; -webkit-text-stroke: 2px color-mix(in srgb, var(--ink) 14%, transparent);
  pointer-events: none; user-select: none;
}
.ghost--left { right: auto; left: -.06em; }
.section--surface .ghost { -webkit-text-stroke-color: color-mix(in srgb, var(--accent) 22%, transparent); }

/* Panel: the bordered "comic" card ---------------------------------------- */
.panel {
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  padding: clamp(22px, 3vw, 32px);
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border: var(--bw) solid var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-body);
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease, color .15s ease;
}
.btn--primary { background: var(--ink); color: #fff; box-shadow: 5px 5px 0 var(--accent); }
.btn--primary:hover { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--accent); }
.btn--sticker { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn--sticker:hover { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.btn .arrow { color: var(--accent); }
.btn--primary .arrow { color: #fff; }

/* Nav -------------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: var(--bw) solid var(--ink);
}
.nav__inner {
  max-width: var(--max); margin: 0 auto; padding: 14px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 13px; background: var(--surface);
  border: var(--bw) solid var(--ink); box-shadow: 4px 4px 0 var(--accent);
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-mono); letter-spacing: .02em;
  text-decoration: none; white-space: nowrap;
}
.brand__plus { color: var(--accent); font-size: 1rem; line-height: 1; }
.brand__slash { opacity: .4; }

.nav__links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.nav__links a:not(.btn) {
  font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .06em; text-transform: uppercase;
  color: var(--slate); text-decoration: none; padding: 6px 0;
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.nav__links a:not(.btn):hover { color: var(--ink); border-color: var(--accent); }
.nav__links .btn { padding: 9px 15px; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .04em; }

.nav__toggle {
  display: none; width: 44px; height: 44px; padding: 0;
  align-items: center; justify-content: center;
  background: var(--surface); border: var(--bw) solid var(--ink); cursor: pointer;
}
.nav__toggle span, .nav__toggle span::before, .nav__toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--ink); position: relative; transition: transform .2s, background .2s;
}
.nav__toggle span::before, .nav__toggle span::after { content: ""; position: absolute; left: 0; }
.nav__toggle span::before { top: -6px; }
.nav__toggle span::after { top: 6px; }
.nav.is-open .nav__toggle span { background: transparent; }
.nav.is-open .nav__toggle span::before { transform: translateY(6px) rotate(45deg); }
.nav.is-open .nav__toggle span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: var(--bw) solid var(--ink);
    padding: 8px var(--gutter) 20px;
  }
  .nav.is-open .nav__links { display: flex; }
  .nav__links a:not(.btn) { padding: 14px 0; font-size: .875rem; border-bottom: 1px solid var(--grid); }
  .nav__links .btn { margin-top: 16px; justify-content: center; padding: 14px; }
}

/* Project cards in a masonry grid (shared: home + portfolio) ----------------------------------------------------- */
.masonry { columns: 3 300px; column-gap: 26px; }
.masonry > li { break-inside: avoid; margin-bottom: 26px; }
.pcard {
  display: block; width: 100%; padding: 0; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink); border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
  font: inherit; transition: transform .15s ease, box-shadow .15s ease;
}
.pcard:hover, .pcard:focus-visible { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--accent); }
.pcard__img { overflow: hidden; border-bottom: var(--bw) solid var(--ink); background: var(--grid); }
.pcard__img img { width: 100%; height: auto; transition: filter .3s, transform .5s cubic-bezier(.22,1,.36,1); }
.pcard:hover .pcard__img img, .pcard:focus-visible .pcard__img img { filter: grayscale(1); transform: scale(1.04); }
.pcard__body { display: block; padding: 18px 20px 20px; }
.pcard__client { display: block; font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.pcard__title { display: block; margin: 8px 0; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h4); line-height: 1.15; }
.pcard__tag { display: block; color: var(--slate); font-size: var(--fs-small); }
.pcard__more { display: inline-block; margin-top: 14px; font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; }
.pcard__img { display: block; }

/* Square arrow buttons (shared: sliders, viewers) ---------------------------- */
.arrow-btn {
  width: 48px; height: 48px; display: inline-grid; place-items: center; flex: none;
  background: var(--surface); color: var(--ink); border: var(--bw) solid var(--ink); box-shadow: var(--shadow-sm);
  font-family: var(--font-mono); font-size: 1.125rem; font-weight: 700; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s, color .15s;
}
.arrow-btn:hover { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.arrow-btn--sm { width: 40px; height: 40px; font-size: .95rem; box-shadow: 3px 3px 0 var(--ink); }
.arrow-btn--sm:hover { transform: translate(3px, 3px); }
.arrow-btn--ink { background: var(--ink); color: #fff; box-shadow: 3px 3px 0 var(--accent); }
.arrow-btn--ink:hover { box-shadow: 0 0 0 var(--accent); }

/* Contact block (shared) ---------------------------------------------------------- */
.contact { background: var(--ink); }
.contact__card { text-align: center; box-shadow: 10px 10px 0 var(--accent); border-color: #fff; padding: clamp(36px, 7vw, 80px) clamp(22px, 5vw, 64px); }
.contact__card h2 { font-size: var(--fs-h1); }
.contact__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 36px; }
.btn--lg { padding: 17px 28px; font-size: var(--fs-body-lg); }
@media (max-width: 560px) { .contact__actions .btn { flex: 1 1 100%; justify-content: center; } }

/* Footer ----------------------------------------------------------------- */
.footer { background: var(--ink); color: #A1A1AA; }
.footer__inner { max-width: var(--max); margin: 0 auto; padding: 32px var(--gutter) 26px; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: .04em; }
.footer__top { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; padding-bottom: 22px; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.footer__brand { color: #fff; }
.footer__brand span { color: var(--accent); }
.footer__contact { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.footer__contact a { color: #fff; font-weight: 700; border-bottom: 2px solid transparent; padding-bottom: 2px; transition: border-color .15s, color .15s; }
.footer__contact a:hover { color: #93B4FF; border-color: #93B4FF; }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; padding-top: 20px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer a { text-decoration: none; }
.footer a:hover { color: #fff; }
@media (max-width: 560px) { .footer__contact { flex-direction: column; } }

/* Parallax layer (offset set by js/site.js) ------------------------------ */
[data-parallax] { transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }

/* Scroll reveal (enabled by js/site.js) ---------------------------------- */
/* springy rise with a slight overshoot */
.js [data-reveal] { opacity: 0; transform: translateY(56px) scale(.955); transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .95s cubic-bezier(.34,1.56,.64,1); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.pcard, .pv__next { text-decoration: none; }
