/* Shared styles for nickalgarcia.com ("Golden Hour", Sage).
   Used by every page. Homepage-only layout lives in index.html. */

/* ---------- Fallback fonts ----------
   Georgia / Times scaled to Instrument Serif's metrics, so the headline
   doesn't reflow (layout shift) when the web font arrives. */

@font-face {
  font-family: 'Instrument Serif Fallback';
  src: local('Georgia');
  size-adjust: 76%;
  ascent-override: 130%;
  descent-override: 41%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Instrument Serif Fallback Times';
  src: local('Times New Roman');
  size-adjust: 84%;
  ascent-override: 118%;
  descent-override: 37%;
  line-gap-override: 0%;
}

/* ---------- Tokens ---------- */

:root {
  --bg: #e4e7d9;
  --fg: #252a20;
  --muted: #5a6150;
  --rule: #c6ccb4;
  --card: #d8ddc9;
  --accent: #2f5d4c;
  --label: #7a5a1e;
  --print: #f8f7f0;
  --onacc: #f8f7f0;
  --lamp: #a9cfb8;
  --grain: .28;
  --blend: multiply;

  --ink: #4a4238; /* print captions, both themes */
  --pad: 56px;
  --nav-h: 88px; /* updated from site.js once the nav is measured */

  --serif: 'Instrument Serif', 'Instrument Serif Fallback', 'Instrument Serif Fallback Times', serif;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1d1b18;
  --fg: #ece3d2;
  --muted: #a89e8b;
  --rule: #37322b;
  --card: #27241f;
  --accent: #9fcbb2;
  --label: #d6b673;
  --print: #e8dfcf;
  --onacc: #1d1b18;
  --lamp: #2f5d4c;
  --grain: .22;
  --blend: soft-light;

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color .4s, color .4s;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; }

a { color: inherit; transition: opacity .2s, transform .2s; }
a:hover { opacity: .8; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

[id] { scroll-margin-top: var(--nav-h); }

::selection { background: var(--accent); color: var(--onacc); }

.wrap { max-width: 1280px; margin: 0 auto; padding-inline: var(--pad); }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 200;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 99px;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

/* Mono label used for eyebrows, track numbers and small meta */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--label);
}

/* Big serif section headings: "Side A · where I've done it" */
.sec-title {
  font-size: 56px;
  line-height: 1.1;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.sec-title em { color: var(--muted); }

.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  margin-bottom: 20px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  padding: 14px 24px;
  border-radius: 99px;
  border: 1px solid var(--rule);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--onacc);
  border-color: var(--accent);
}

.btn-primary:hover { transform: translateY(-1px); }

/* ---------- Equalizer ---------- */

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  flex: none;
}

.eq i {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: bottom;
  animation: eqb .9s ease-in-out infinite;
}

.eq i:nth-child(2) { animation-duration: 1.07s; animation-delay: -.3s; }
.eq i:nth-child(3) { animation-duration: 1.24s; animation-delay: -.6s; }
.eq i:nth-child(4) { animation-duration: 1.41s; animation-delay: -.9s; }

@keyframes eqb {
  0%, 100% { transform: scaleY(.25); }
  50% { transform: scaleY(1); }
}

/* ---------- Nav ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background-color .4s;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  padding-block: 24px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.nav-name {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -.01em;
  white-space: nowrap;
  text-decoration: none;
  flex: none;
}

.now-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: 6px 14px;
}

.now-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 20px; }

.theme-toggle {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}

.theme-toggle:hover { opacity: .8; }

/* Label follows the theme in CSS so it's right on first paint */
.theme-toggle .when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }

.say-hi {
  background: var(--fg);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 99px;
  text-decoration: none;
}

/* ---------- Photo prints and screenshot slots ---------- */

.print {
  position: relative;
  background: var(--print);
  border-radius: 4px;
  transition: background-color .4s;
}

.print img { width: 100%; object-fit: cover; }

.print figcaption {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink);
}

/* A project screenshot over a fallback panel. If the image is missing,
   it removes itself (onerror) and the project name shows instead. */
.shot {
  position: relative;
  overflow: hidden;
  background: var(--card);
  aspect-ratio: 1200 / 780;
}

.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.shot-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 32px;
  line-height: 1.1;
  color: var(--muted);
}

/* ---------- Contact card ---------- */

.contact-wrap { max-width: 1280px; margin: 0 auto; }

.contact {
  margin: 0 20px 20px;
  border-radius: 28px;
  background: var(--fg);
  color: var(--bg);
  padding: 72px 48px 36px;
  transition: background-color .4s, color .4s;
}

.contact :focus-visible { outline-color: var(--bg); }

.contact .eyebrow {
  font-size: 12px;
  color: inherit;
  opacity: .7;
}

.contact-title {
  font-size: 124px;
  line-height: .95;
  letter-spacing: -.03em;
  margin-top: 16px;
}

.contact-title em { color: var(--lamp); }

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-top: 40px;
}

.contact-row > p {
  font-size: 18px;
  line-height: 1.6;
  max-width: 420px;
  opacity: .8;
}

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  min-width: 0;
}

.contact-email {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.2;
  text-decoration-thickness: 1px;
  text-underline-offset: 8px;
  overflow-wrap: anywhere;
}

.contact-more {
  display: flex;
  gap: 24px;
  font-size: 15px;
  font-weight: 500;
}

.contact-more a { text-decoration: none; }

.contact-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 64px;
  padding-top: 18px;
  border-top: 1px solid rgba(128, 118, 100, .45);
  font-family: var(--mono);
  font-size: 12px;
  opacity: .65;
}

/* ---------- Film grain ---------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: var(--blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Project pages (/work/*) ---------- */

.case { padding-block: 48px 104px; }

.case-back {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}

.case-hero { margin-top: 40px; max-width: 900px; }

.case-hero h1 {
  font-size: 68px;
  line-height: 1.02;
  letter-spacing: -.022em;
  margin-top: 14px;
  text-wrap: balance;
}

.case-lede {
  font-size: 19px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 600px;
  margin-top: 20px;
}

.case-shot {
  margin-top: 48px;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(40, 30, 20, .14);
}

.case-shot .shot-fallback { font-size: 48px; }

.case-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  margin-top: 40px;
}

.case-fact {
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 28px 28px 32px;
}

.case-fact .eyebrow { margin-bottom: 12px; }

.case-result {
  font-family: var(--serif);
  font-style: italic;
  font-size: 30px;
  line-height: 1.25;
}

.case-link {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.case-next {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.case-next a { text-decoration: none; }
.case-next-forward { margin-left: auto; text-align: right; }
.case-next .eyebrow { color: var(--muted); display: block; margin-bottom: 6px; }
.case-next-name { font-family: var(--serif); font-size: 36px; line-height: 1.1; }
.case-next-name em { color: var(--accent); }

/* ---------- Simple message page (404) ---------- */

.message { padding-block: 96px 112px; }
.message h1 { font-size: 68px; line-height: 1.02; letter-spacing: -.022em; margin: 14px 0 34px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  :root { --pad: 40px; }
  .case-hero h1, .message h1 { font-size: clamp(44px, 5.4vw, 68px); }
  .contact-title { font-size: clamp(56px, 9vw, 124px); }
}

@media (max-width: 900px) {
  /* Name + actions on the top row, links wrap onto a second row */
  .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-block: 14px;
    gap: 10px 16px;
  }
  .nav-right { display: contents; }
  .nav-actions { grid-column: 2; grid-row: 1; gap: 12px; }
  .nav-links { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; gap: 6px 20px; }

  .sec-title { white-space: normal; font-size: clamp(40px, 7vw, 56px); }
  .sec-head { flex-wrap: wrap; }

  .case-facts { grid-template-columns: 1fr; }

  /* Stacked here (not only at 560px) so the email never breaks mid-address */
  .contact-row { flex-direction: column; align-items: flex-start; }
  .contact-links { align-items: flex-start; }
  .contact-email { font-size: clamp(28px, 6vw, 42px); }
}

@media (max-width: 560px) {
  :root { --pad: 20px; }

  .now-pill { display: none; }
  .nav-name { font-size: 24px; }
  .nav-actions { gap: 8px; }
  .theme-toggle { padding: 7px 12px; }
  .say-hi { padding: 8px 14px; }

  .contact { padding: 48px 24px 28px; border-radius: 22px; }
  .contact-row { flex-direction: column; align-items: flex-start; }
  .contact-links { align-items: flex-start; }
  .contact-email { font-size: 28px; word-break: break-word; }
  .contact-foot { margin-top: 48px; }

  .case { padding-block: 32px 72px; }
  .case-shot .shot-fallback { font-size: 32px; }
  .case-fact { padding: 24px; }
  .case-result { font-size: 26px; }
  .message { padding-block: 64px 80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .eq i { animation: none; }
  .eq i:nth-child(1) { transform: scaleY(.5); }
  .eq i:nth-child(2) { transform: scaleY(.9); }
  .eq i:nth-child(3) { transform: scaleY(.4); }
  .eq i:nth-child(4) { transform: scaleY(.7); }
}

.intro-ask {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  max-width: 620px;
}

.intro-ask p { font-size: 17px; line-height: 1.65; opacity: .8; }
.intro-ask p + p { margin-top: 14px; }
.intro-ask .eyebrow { opacity: 1; margin-bottom: 12px; }

@media (max-width: 760px) {
  .intro-ask { margin-top: 40px; }
}
