/* ==========================================================================
   Ian Stewart — site styles ("Swiss zine")
   Tokens first; change --accent in src/_data/site.js, not here.
   ========================================================================== */
:root {
  --paper: #F7F7F4;
  --paper-2: #ECEBE6;
  --ink: #111111;
  --ink-2: #55534D;
  --rule: #1111111f;
  --accent: #E8472B;          /* overridden per page on <html> */
  --display: "Archivo", "Arial Black", Impact, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  --texture: none;            /* texture layer — see .has-texture */
  color-scheme: light;
}

/* Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--body); overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }

.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.muted { color: var(--ink-2); }
.disp {
  font-family: var(--display); font-variation-settings: "wdth" 112, "wght" 900; font-weight: 900;
  line-height: .86; letter-spacing: -.02em; text-transform: uppercase; margin: 0; text-wrap: balance;
}
.accent { color: var(--accent); }
.outline { color: transparent; -webkit-text-stroke: 2px var(--ink); }
.tag { background: var(--c, var(--accent)); color: var(--on, var(--ink)); padding: 1px 6px; text-decoration: none; }
.barcode {
  display: inline-block; height: 30px; width: 140px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 12px, var(--ink) 12px 13px, transparent 13px 16px);
}
.btn { display: inline-block; border: 2px solid var(--ink); padding: 10px 14px; text-decoration: none; font-size: 12px; }
.btn:hover { background: var(--accent); border-color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }

/* Texture layer (off by default; switch on with site.texture = true) ----- */
.has-texture::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60;
  background-image: var(--texture); mix-blend-mode: multiply; opacity: .12;
}

/* Header ----------------------------------------------------------------- */
.site-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-block: 18px; border-bottom: 2px solid var(--ink); position: relative;
}
.logo {
  font-family: var(--display); font-variation-settings: "wdth" 112, "wght" 900; font-weight: 900;
  font-size: 22px; letter-spacing: -.02em; text-transform: uppercase; text-decoration: none;
}
.site-head .logo { color: transparent; -webkit-text-stroke: 1.25px var(--ink); }
.logo span { color: var(--accent); -webkit-text-stroke: 0; }
.logo--sm { font-size: 18px; }
.nav { display: flex; gap: 22px; flex-wrap: wrap; }
.nav a { text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }
.menu-btn { display: none; background: none; border: 1px solid var(--ink); padding: 6px 10px; cursor: pointer; color: var(--ink); }

/* Hero (style tile v1) --------------------------------------------------- */
.hero { padding-block: 28px 48px; border-bottom: 2px solid var(--ink); }
.hero__meta { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 36px; }
.hero__grid { display: grid; grid-template-columns: 1.45fr 1fr; align-items: center; gap: clamp(16px, 3vw, 40px); }
.hero__text { container-type: inline-size; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
/* Three fixed lines: sizes scale with the text column so nothing ever wraps.
   Measured in Archivo: widest title line ~4.2em, "I MAKE MISTAKES" ~10.1em. */
.hero__title { font-size: min(22.5cqi, 190px); }
.hero__title { line-height: .98; }
.hero__title .line { display: block; white-space: nowrap; }
.hero__words { display: grid; gap: clamp(14px, 3.2cqi, 34px); position: relative; z-index: 2; }
.hero__make { font-size: min(9.4cqi, 84px); white-space: nowrap; }
.swap { display: inline-block; color: transparent; -webkit-text-stroke: 2px var(--accent); paint-order: stroke fill; vertical-align: bottom; overflow: hidden; height: .92em; line-height: .92; }
.swap__word { display: inline-block; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s; }
.swap__word.is-out { transform: translateY(-100%); opacity: 0; }
.swap__word.is-in { transform: translateY(100%); opacity: 0; transition: none; }
.lede { max-width: 40ch; font-size: 18px; margin: 0; }
.hero__foot { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.hero__photo { position: relative; z-index: 1; }
.hero__img { aspect-ratio: 5 / 6; }
.hero__img img { object-position: 50% 62%; } /* keep the face in frame */
.crop { position: absolute; width: 14px; height: 14px; pointer-events: none; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--ink); }
.crop::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.crop::after { top: 50%; left: 0; right: 0; height: 1px; }
.crop--tl { top: -20px; left: -20px; } .crop--tr { top: -20px; right: -20px; }
.crop--bl { bottom: -20px; left: -20px; } .crop--br { bottom: -20px; right: -20px; }

/* Ticker (horizontal) ---------------------------------------------------- */
.ticker { background: var(--accent); color: var(--ink); overflow: hidden; padding-block: 12px; }
.ticker__row { display: flex; width: max-content; animation: tick 40s linear infinite; }
.ticker:hover .ticker__row { animation-play-state: paused; }
.ticker__set { display: flex; gap: 32px; padding-right: 32px; align-items: center; }
.ticker a {
  font-family: var(--display); font-variation-settings: "wdth" 125, "wght" 900; font-weight: 900;
  font-size: 26px; text-transform: uppercase; letter-spacing: -.01em; text-decoration: none; white-space: nowrap;
}
.ticker a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.ticker i { font-style: normal; font-family: var(--mono); font-size: 14px; }
@keyframes tick { to { transform: translateX(-50%); } }

/* Sections --------------------------------------------------------------- */
.latest { padding-block: 56px 72px; }
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 28px; }
.sec-head h2 { font-size: clamp(40px, 6vw, 80px); }
.page-head { padding-block: 32px 40px; }
.page-head .meta { margin-bottom: 28px; }
.page-title { font-size: clamp(64px, 12vw, 180px); }
/* Tag names vary in length (Production, Experiments), so scale them down to fit */
.page-title--tag { font-size: clamp(36px, 9vw, 140px); overflow-wrap: anywhere; }

/* Cards (style tile v1) -------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 24px; padding-block: 8px 72px; }
.latest .cards { padding-block: 0; }
.card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; --c: var(--accent); }
.card__top { display: flex; justify-content: space-between; border-top: 2px solid var(--ink); padding-top: 8px; }
.card__img { aspect-ratio: 3 / 2; }
.card__title { font-size: clamp(28px, 3vw, 40px); }
.card:hover .card__title { color: var(--c); }
.card__intro { margin: 0; color: var(--ink-2); font-size: 15px; }

/* Colour-wash photos ----------------------------------------------------- */
.wash { margin: 0; position: relative; overflow: hidden; background: var(--paper-2); isolation: isolate; }
.wash img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); } /* no-JS fallback */
.wash--off img { filter: none; }
.wash--wash::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--c, var(--accent)); mix-blend-mode: color; opacity: .9;
}
.wash--wash img { filter: grayscale(1) contrast(1.1) brightness(1.08); }
.wash canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.wash--halftone img { filter: grayscale(1) contrast(1.2); }
.wash--halftone.is-drawn img { opacity: 0; }
.wash--grain::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 .9'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 220px 220px; mix-blend-mode: multiply; opacity: .42;
}
.prose .wash { margin-block: 28px; }
.wash-defs { position: absolute; width: 0; height: 0; }

/* Posts & prose ---------------------------------------------------------- */
.post { padding-block: 32px 72px; --post-col: 680px; }
/* One centred reading column; text stays left-aligned inside it */
.post > * { max-width: var(--post-col); margin-inline: auto; }
.post__head { display: grid; gap: 24px; margin-bottom: 36px; }
.post__title { font-size: clamp(44px, 8vw, 92px); }
.post .lede { max-width: none; }
.post__hero { aspect-ratio: 16 / 9; margin-bottom: 40px; }
.post .tag { background: var(--accent); }
.prose { max-width: 65ch; }
.post .prose { max-width: var(--post-col); }
.prose > * + * { margin-top: 1em; }
.prose h2 {
  font-family: var(--display); font-variation-settings: "wdth" 112, "wght" 900; font-weight: 900;
  font-size: 34px; line-height: .95; text-transform: uppercase; letter-spacing: -.01em; margin-top: 1.6em;
}
.prose a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--accent); font-size: 20px; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--paper-2); padding: 1px 5px; }
.post__foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 2px solid var(--ink); padding-top: 12px; margin-top: 56px; max-width: 65ch; }
.post .post__foot { max-width: var(--post-col); }

/* Simple pages ----------------------------------------------------------- */
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(20px, 4vw, 56px); padding-bottom: 72px; align-items: start; }
.split__img .wash { aspect-ratio: 4 / 5; }
.contact { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; padding-bottom: 72px; }
.contact__list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.contact__list li { display: flex; justify-content: space-between; gap: 12px; padding-block: 14px; border-bottom: 1px solid var(--rule); font-size: 13px; }

/* Footer ----------------------------------------------------------------- */
.site-foot { border-top: 2px solid var(--ink); padding-block: 24px 32px; display: grid; gap: 18px; }
.site-foot__row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .split, .contact { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .menu-btn { display: block; }
  .site-head .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    flex-direction: column; gap: 0; background: var(--paper); border-bottom: 2px solid var(--ink);
    padding: 8px var(--gutter) 16px;
  }
  .site-head .nav.is-open { display: flex; }
  .site-head .nav a { padding-block: 12px; border-bottom: 1px solid var(--rule); font-size: 14px; }
  .cards { grid-template-columns: 1fr; }
  .crop { display: none; }
  .ticker a { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker__row { animation: none; }
  * { transition: none !important; }
}

/* Stage 4 additions ------------------------------------------------------ */
.btn--ghost { border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }
.btn--ghost:hover { background: none; color: var(--accent); }
.hero__ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.todo { font-family: var(--mono); font-size: 12px; background: var(--paper-2); border-left: 3px solid var(--accent); padding: 10px 12px; color: var(--ink-2); }
.split .lede { font-size: 20px; }

.work__lede { max-width: 52ch; margin-bottom: 40px; font-size: 20px; }
.services { list-style: none; margin: 0 0 72px; padding: 0; border-top: 2px solid var(--ink); }
.service { display: grid; grid-template-columns: 60px minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: baseline; padding-block: 22px; border-bottom: 1px solid var(--rule); }
.service h2 { font-size: clamp(30px, 4.6vw, 60px); overflow-wrap: anywhere; }
.service p { margin: 0; color: var(--ink-2); }
.service:hover h2 { color: var(--accent); }
.work__listen { padding-bottom: 56px; }
.work__links { display: grid; gap: 16px; justify-items: start; }
.work__cta { padding-block: 56px 88px; border-top: 2px solid var(--ink); display: grid; gap: 16px; justify-items: start; }
.work__cta h2 { font-size: clamp(44px, 8vw, 120px); }

.form { display: grid; gap: 8px; margin-top: 28px; max-width: 520px; }
.form input, .form textarea {
  font: 16px/1.4 var(--body); color: var(--ink); background: #fff; border: 2px solid var(--ink);
  padding: 12px 14px; border-radius: 0; margin-bottom: 10px; width: 100%;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form button { justify-self: start; cursor: pointer; background: var(--paper); color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 600px) {
  .service { grid-template-columns: 40px 1fr; }
  .service p { grid-column: 2; }
}
.form__status { min-height: 1.4em; color: var(--ink-2); margin: 4px 0 0; }
.form__done { margin-top: 28px; border-top: 2px solid var(--ink); padding-top: 20px; display: grid; gap: 12px; }
.form__done h2 { font-size: clamp(48px, 8vw, 96px); }
.form button:disabled { opacity: .5; cursor: wait; }

/* Home: about + showreel ------------------------------------------------- */
.about-home { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(24px, 4vw, 64px); padding-block: 64px; border-bottom: 2px solid var(--ink); align-items: start; }
.about-home__text { display: grid; gap: 22px; }
.about-home .lede { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.3; max-width: 30ch; }
.about-home .prose p { margin: 0 0 1em; }
.about-home .prose a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.reel { display: grid; gap: 14px; }
.reel .meta a { text-decoration: none; }
.reel .meta a:hover { color: var(--accent); }
.reel__player { width: 100%; border: 0; border-radius: 12px; background: var(--paper-2); }

/* Contact: service tags */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 14px; padding: 0; }
.tags li { border: 1px solid var(--ink); padding: 4px 10px; }
.reel-link { display: inline-block; margin-top: 22px; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.reel-link:hover { color: var(--accent); }

@media (max-width: 900px) { .about-home { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }

/* Stage 5: tag filter, tag pages ------------------------------------------ */
.tagbar { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; padding: 0; }
.tagbar a { display: inline-block; border: 1px solid var(--ink); padding: 4px 10px; text-decoration: none; }
.tagbar a:hover, .tagbar a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.tagbar .count { opacity: .55; margin-left: 6px; }
.tags li a { display: block; margin: -4px -10px; padding: 4px 10px; text-decoration: none; }
.tags li:hover { background: var(--ink); color: var(--paper); }
.tags li:hover a { color: var(--paper); }
.empty { padding-block: 8px 72px; }

/* Spotify embeds inside posts */
.prose .embed { width: 100%; border: 0; border-radius: 12px; background: var(--paper-2); }
.prose .cover-art { aspect-ratio: 1 / 1; max-width: 480px; }
/* Centre images within the post column */
.post .prose .wash, .post .prose img { margin-inline: auto; }
.post .prose img { display: block; }

/* Instagram link-out strip -------------------------------------------------- */
.ig { padding-block: 0 72px; }
.ig__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.ig__tile { position: relative; display: block; text-decoration: none; }
.ig__img { aspect-ratio: 3 / 4; }
.ig__tile:hover .ig__img img, .ig__tile:focus-visible .ig__img img { filter: none !important; }
.ig__cta { position: absolute; left: 8px; bottom: 8px; background: var(--paper); color: var(--ink); padding: 2px 6px; opacity: 0; transition: opacity .15s; }
.ig__tile:hover .ig__cta, .ig__tile:focus-visible .ig__cta { opacity: 1; }
@media (max-width: 900px) { .ig__grid { grid-template-columns: repeat(3, 1fr); } }
@media (hover: none) { .ig__cta { display: none; } }
