/* ==========================================================================
   Myles Jaeger — design system
   White studio wall. Ink type. One grid. The work supplies the color.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root{
  --bg: oklch(99.4% 0 0);
  --surface: oklch(97% 0 0);
  --fg: oklch(13% 0 0);
  --muted: oklch(42% 0 0);
  --muted-2: oklch(52% 0 0);
  --border: oklch(89% 0 0);
  --border-strong: oklch(72% 0 0);
  --accent: oklch(13% 0 0);

  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;

  --margin: clamp(20px, 5vw, 88px);
  --gutter: clamp(12px, 1.4vw, 20px);
  --nav-h: 72px;

  --size-display: clamp(40px, 7.2vw, 92px);
  --size-h1: clamp(30px, 4vw, 46px);
  --size-h2: clamp(22px, 2.4vw, 28px);
  --size-h3: clamp(17px, 1.6vw, 20px);
  --size-body: 16px;
  --size-small: 13px;
  --size-label: 11px;

  --ease-out: cubic-bezier(.16,1,.3,1);
  --dur-fast: 180ms;
  --dur-med: 420ms;
  --dur-slow: 900ms;
}

/* Dark studio wall — same restrained monochrome system, inverted.
   Near-black/near-white rather than pure #000/#fff; borders switch to
   translucent white, which reads as structure without adding noise. */
html[data-theme="dark"]{
  --bg: oklch(13% 0 0);
  --surface: oklch(19% 0 0);
  --fg: oklch(96% 0 0);
  --muted: oklch(70% 0 0);
  --muted-2: oklch(58% 0 0);
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.26);
  --accent: oklch(96% 0 0);
  color-scheme: dark;
}

*{ box-sizing: border-box; }
html{ background: var(--bg); }
html,body{ margin:0; padding:0; }
body{
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--size-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--dur-slow) var(--ease-out), color var(--dur-slow) var(--ease-out);
}

::selection{ background: var(--fg); color: var(--bg); }

a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; background: none; border: none; color: inherit; cursor: pointer; padding: 0; }
img{ max-width: 100%; display: block; }

.container{
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding-left: var(--margin);
  padding-right: var(--margin);
}

/* ---------- typography ---------- */
.t-display{
  font-size: var(--size-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.02;
}
.t-h1{ font-size: var(--size-h1); font-weight: 500; letter-spacing: -0.02em; line-height: 1.08; }
.t-h2{ font-size: var(--size-h2); font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.t-h3{ font-size: var(--size-h3); font-weight: 500; line-height: 1.3; }
.t-body{ font-size: var(--size-body); font-weight: 400; line-height: 1.6; color: var(--fg); max-width: 62ch; }
.t-body.muted{ color: var(--muted); }
.t-small{ font-size: var(--size-small); font-weight: 400; letter-spacing: 0.01em; color: var(--muted); line-height: 1.55; }
.t-label{
  font-size: var(--size-label);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.t-mono-num{ font-variant-numeric: tabular-nums; }

/* ---------- focus ---------- */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible{
  outline: 1.5px solid var(--fg);
  outline-offset: 3px;
}

/* ---------- custom cursor ---------- */
@media (hover:hover) and (pointer:fine){
  html.has-cursor{ cursor: none; }
  html.has-cursor a, html.has-cursor button, html.has-cursor [data-cursor]{ cursor: none; }
}
.od-cursor{
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%,-50%);
  will-change: transform;
}
.od-cursor__dot{
  position: absolute;
  top:0; left:0;
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  background: var(--fg);
  border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.od-cursor__ring{
  position: absolute;
  top:0; left:0;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0;
  transform: scale(.6);
  transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out), width var(--dur-med), height var(--dur-med), margin var(--dur-med);
}
.od-cursor__tick{ position:absolute; background: var(--border-strong); transition: opacity var(--dur-fast); }
.od-cursor__tick.v{ width:1px; height:6px; top:-16px; left:-.5px; }
.od-cursor__tick.h{ width:6px; height:1px; top:-.5px; left:-16px; }
.od-cursor__label{
  position: absolute;
  top: 16px; left: 16px;
  white-space: nowrap;
  font-size: var(--size-label);
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.od-cursor.is-hover .od-cursor__ring{ opacity: 1; transform: scale(1); width: 52px; height: 52px; margin: -26px 0 0 -26px; }
.od-cursor.is-hover .od-cursor__dot{ transform: scale(0); }
.od-cursor.is-hover .od-cursor__tick{ opacity: 0; }
.od-cursor.is-labeled .od-cursor__label{ opacity: 1; transform: translateY(0); }
.od-cursor.is-drag .od-cursor__ring{ opacity: 1; transform: scale(1.3); }

/* ---------- nav ---------- */
.site-nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--margin);
  z-index: 500;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid transparent;
}
.site-nav__mark{
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  padding: 14px 2px;
  margin: -14px -2px;
}
.site-nav__links{
  display: flex;
  gap: clamp(18px, 2.6vw, 40px);
  list-style: none;
  margin: 0; padding: 0;
}
.site-nav__links a{
  font-size: var(--size-label);
  letter-spacing: 0.09em;
  color: var(--muted);
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 14px 2px;
}
.site-nav__links a::after{
  content: '';
  position: absolute;
  left: 2px; right: 100%;
  bottom: 10px;
  height: 1px;
  background: var(--fg);
  transition: right var(--dur-med) var(--ease-out);
}
.site-nav__links a:hover, .site-nav__links a[aria-current="page"]{ color: var(--fg); }
.site-nav__links a:hover::after, .site-nav__links a[aria-current="page"]::after{ right: 0; }
.site-nav__toggle{ display:none; }

.site-nav__right{
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.6vw, 32px);
}

/* boolean switch — sharp corners, no fill until "on", matches the
   site's flat/industrial character rather than a generic iOS pill */
.theme-toggle{
  flex: none;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 18px;
}
.theme-toggle__track{
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border-strong);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.theme-toggle__knob{
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--fg);
  transition: transform var(--dur-med) var(--ease-out), background-color var(--dur-fast);
}
.theme-toggle[aria-checked="true"] .theme-toggle__knob,
html[data-theme="dark"] .theme-toggle__knob{ transform: translateX(22px); }
.theme-toggle:hover .theme-toggle__track{ border-color: var(--fg); }

@media (max-width: 720px){
  .site-nav__links{ gap: 16px; }
  .site-nav__links a{ font-size: 10px; }
  .site-nav__right{ gap: 14px; }
}

@media (max-width: 480px){
  .site-nav{ padding: 0 14px; }
  .site-nav__mark{ font-size: 12px; }
  .site-nav__links{ gap: 10px; }
  .site-nav__links a{ font-size: 9px; }
  .site-nav__right{ gap: 10px; }
  .theme-toggle{ width: 30px; height: 16px; }
  .theme-toggle__knob{ width: 10px; height: 10px; }
  .theme-toggle[aria-checked="true"] .theme-toggle__knob,
  html[data-theme="dark"] .theme-toggle__knob{ transform: translateX(16px); }
}

/* ---------- footer ---------- */
.site-footer{
  border-top: 1px solid var(--border);
  padding: 28px var(--margin) 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: baseline;
  justify-content: space-between;
}
.site-footer__links{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  list-style: none;
  margin: 0; padding: 0;
}
.site-footer__links a{
  font-size: var(--size-label);
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  display: inline-block;
  padding: 13px 2px;
  margin: -13px 0;
}
.site-footer__links a:hover{ color: var(--fg); border-bottom-color: var(--fg); }
.site-footer__copy{ font-size: var(--size-label); letter-spacing: 0.06em; color: var(--muted-2); }

/* ---------- page shell ---------- */
.page-main{ padding-top: var(--nav-h); min-height: 100vh; }

/* ---------- buttons / links ---------- */
.link-arrow{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--size-label);
  letter-spacing: 0.08em;
  color: var(--fg);
  border-bottom: 1px solid var(--fg);
  padding-bottom: 2px;
}
.link-arrow svg{ width: 11px; height: 11px; transition: transform var(--dur-fast) var(--ease-out); }
.link-arrow:hover svg{ transform: translate(2px,-2px); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- utility ---------- */
.visually-hidden{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.grain-plate{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.grain-plate canvas{ display:block; width: 100%; height: 100%; }
.grain-plate__tag{
  position: absolute;
  bottom: 10px; left: 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  padding: 3px 7px;
  border: 1px solid var(--border);
}
