/* Shared: tokens, reset, cursor, nav shell, footer shell, mobile chrome, grain */

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

:root {
  --bg:          #f5f4f0;
  --bg2:         #eeede9;
  --text:        #111110;
  --muted:       #6a6a64;
  --dim:         #a8a89e;
  --divider-subtle: rgba(0,0,0,.08);
  --divider-strong: rgba(0,0,0,.12);
  --ring:        rgba(17,17,16,.25);
  --ring-hov:    rgba(17,17,16,.12);
  --card:        #e8e7e3;
  --placeholder: #e0deda;
  --font:        "Neue Haas Grotesk Text Pro", "Neue Haas Grotesk Display Pro", "Neue Haas Grotesk", -apple-system, sans-serif;
  --type-sm-reg-size: .75rem;
  --type-sm-reg-tracking: .014em;
  --type-sm-reg-lh: 1.33;
  --type-sm-semi-size: .75rem;
  --type-sm-semi-tracking: .014em;
  --type-sm-semi-lh: 1.67;
  --type-base-reg-size: 1rem;
  --type-base-reg-tracking: 0.12em;
  --type-base-reg-lh: 1.33;
  --type-base-semi-size: 1rem;
  --type-base-semi-tracking: 0.12em;
  --type-base-semi-lh: 1.67;
  /* Display: large marketing / case hero (65 Medium in design tool) */
  --type-d1-size: 4rem;
  --type-d1-tracking: -0.05em;
  --type-d1-lh: 1;
  --type-d2-size: 3rem;
  --type-d2-tracking: -0.03em;
  --type-d2-lh: 1;
  --expo:        cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg:          #0f0e0c;
  --bg2:         #1a1916;
  --text:        #f0efe9;
  --muted:       #6e6e66;
  --dim:         #3e3e38;
  --divider-subtle: rgba(255,255,255,.08);
  --divider-strong: rgba(255,255,255,.12);
  --ring:        rgba(240,239,233,.2);
  --ring-hov:    rgba(240,239,233,.1);
  --card:        #1a1916;
  --placeholder: #242320;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

a { color: inherit; text-decoration: none; cursor: none; }
button { background: none; border: none; font: inherit; color: inherit; cursor: none; }

/* Display type — use with <p>, <h1>, etc. for large display lines */
.type-d1 {
  font-size: var(--type-d1-size);
  font-weight: 500;
  line-height: var(--type-d1-lh);
  letter-spacing: var(--type-d1-tracking);
  color: var(--text);
}
.type-d2 {
  font-size: var(--type-d2-size);
  font-weight: 500;
  line-height: var(--type-d2-lh);
  letter-spacing: var(--type-d2-tracking);
  color: var(--text);
}

/* ── Cursor ── */
#cur-dot {
  position: fixed; top: 0; left: 0;
  width: 4px; height: 4px;
  background: var(--text);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  will-change: left, top;
  transition: opacity .2s;
}
#cur-ring {
  position: fixed; top: 0; left: 0;
  /* default — 25% smaller than 30px */
  width: 22.5px; height: 22.5px;
  border: 1px solid var(--ring);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width .35s var(--expo), height .35s var(--expo), opacity .2s, border-color .2s;
  will-change: left, top, width, height;
}
/* hover — 25% smaller than 50px */
body.hov #cur-ring { width: 37.5px; height: 37.5px; border-color: var(--ring-hov); }

/* ── Nav (position: fixed added on about/work pages) ── */
.nav {
  display: flex;
  gap: 20px;
  padding: 20px;
  align-items: flex-start;
  background: var(--bg);
  border-bottom: 1px solid var(--divider-strong);
}
.nav-left { flex: 1 0 0; display: flex; gap: 12px; align-items: flex-start; }
.nav-stack { display: flex; flex-direction: column; }
.nav-link {
  font-size: .75rem; font-weight: 500;
  line-height: 1.67; letter-spacing: .014em;
  color: var(--text); opacity: .54;
  transition: opacity .2s;
  white-space: nowrap;
}
.nav-link:hover { opacity: 1; }
.nav-link.active { opacity: 1; text-decoration: line-through; }
/* Work + Info stacked; case studies inline to the right (desktop) */
.nav-cluster { display: flex; flex-direction: column; }
.nav-cluster__main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}
.nav-cluster__work {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.nav-cluster__cases {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.nav-case-link.active {
  opacity: 1;
  text-decoration: line-through;
}
.nav-center {
  flex: 1 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  align-self: stretch;
}
.nav-weather {
  flex: 1 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: .75rem; font-weight: 500;
  line-height: 1.67; letter-spacing: .014em;
  color: var(--muted);
}
.theme-toggle {
  display: flex; align-items: center;
  padding: 0;
  color: var(--muted); transition: color .2s;
}
.theme-toggle:hover { color: var(--text); }
.toggle-track {
  width: 24px; height: 13px;
  border: 1px solid currentColor; border-radius: 7px;
  position: relative; transition: border-color .2s;
}
.toggle-dot {
  position: absolute; top: 2px; left: 2px;
  width: 7px; height: 7px;
  background: currentColor; border-radius: 50%;
  transition: transform .25s var(--expo);
}
[data-theme="dark"] .toggle-dot { transform: translateX(11px); }

/* ── Footer shell (fixed positioning on about/work) ── */
.footer {
  display: flex;
  gap: 20px;
  padding: 20px;
  align-items: flex-end;
  background: var(--bg);
  border-top: 1px solid var(--divider-strong);
}
.footer-left  { flex: 1 0 0; display: flex; flex-direction: column; }
.footer-center { flex: 1 0 0; display: flex; gap: 8px; justify-content: flex-end; }
.footer-right  { flex: 1 0 0; display: flex; justify-content: flex-end; }
.footer-text {
  font-size: .75rem; font-weight: 500;
  line-height: 1.67; letter-spacing: .014em;
  color: var(--muted);
}
.footer-clock {
  font-size: .75rem; font-weight: 500;
  line-height: 1.67; letter-spacing: .014em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Mobile chrome ── */
.mobile-header { display: none; }
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
  .mobile-header {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    background: var(--bg);
  }
  .mobile-header-clock {
    font-size: .75rem; font-weight: 500;
    line-height: 1.67; letter-spacing: .014em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .mobile-header-center {
    display: flex; align-items: center; justify-content: center;
  }
  .mobile-header-weather {
    display: flex; gap: 4px;
    align-items: center; justify-content: flex-end;
    font-size: .75rem; font-weight: 500;
    line-height: 1.67; letter-spacing: .014em;
    color: var(--muted);
  }
  .mobile-bottom-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    padding: 16px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    transition: gap 0.22s ease, padding 0.22s ease;
    box-sizing: border-box;
  }
  .mobile-bottom-nav--cases-collapsed {
    gap: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-case-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-height: 0;
    max-height: 120px;
    overflow: hidden;
    flex: 0 1 auto;
    transition: max-height 0.3s var(--expo), opacity 0.2s ease, margin 0.2s ease, padding 0.2s ease,
      flex-basis 0.3s var(--expo);
  }
  .mobile-case-nav .mobile-case-link {
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.67;
    letter-spacing: .014em;
    color: var(--text);
    opacity: .54;
    text-decoration: none;
    white-space: nowrap;
  }
  .mobile-case-nav .mobile-case-link.active {
    opacity: 1;
    text-decoration: line-through;
  }
  .mobile-bottom-nav--cases-collapsed .mobile-case-nav {
    flex: 0 0 0;
    max-height: 0;
    min-height: 0;
    height: 0;
    margin: 0;
    padding: 0;
    gap: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
  }
  .mobile-nav-row .mobile-nav-link:nth-child(1) { grid-column: 1 / 3; text-align: left; }
  .mobile-nav-row .mobile-nav-link:nth-child(2) { grid-column: 3 / 5; text-align: center; }
  .mobile-nav-row .mobile-nav-link:nth-child(3) { grid-column: 5 / 7; text-align: right; }
  .mobile-label-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
  }
  .mobile-label-row .mobile-nav-label:first-child { grid-column: 1 / 4; text-align: left; }
  .mobile-label-row .mobile-nav-label:last-child { grid-column: 4 / 7; text-align: right; }
  .mobile-nav-link {
    font-size: .75rem; font-weight: 500;
    line-height: 1.67; letter-spacing: .014em;
    color: var(--text); opacity: .54; text-decoration: none;
  }
  .mobile-nav-link.active { opacity: 1; text-decoration: line-through; }
  .mobile-nav-label {
    font-size: .75rem; font-weight: 500;
    line-height: 1.67; letter-spacing: .014em;
    color: var(--muted);
  }
  .mobile-label-row .mobile-nav-label:first-child {
    font-weight: 600;
    color: var(--text);
    opacity: 1;
  }
}

/* ── Grain ── */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 1000;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%,100%{transform:translate(0,0)}10%{transform:translate(-2%,-3%)}
  20%{transform:translate(3%,1%)}30%{transform:translate(-1%,4%)}
  40%{transform:translate(2%,-2%)}50%{transform:translate(-3%,2%)}
  60%{transform:translate(1%,-4%)}70%{transform:translate(-2%,3%)}
  80%{transform:translate(4%,-1%)}90%{transform:translate(-1%,2%)}
}
