/* ==========================================================================
   STAXHE — STYLES
   Layout: one column on phones; from 60rem a quiet two-column grid with
   section titles in a narrow left rail and content on the right.
   ========================================================================== */

/* ---------- Font -------------------------------------------------------- */
/* Instrument Sans (SIL OFL 1.1), Latin subset, variable weight 400–700 and
   width 75–100%. Width is used to tighten the display type. */
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-variable.woff2") format("woff2-variations"),
       url("fonts/instrument-sans-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------------------------------------------- */
/* Dark is the default theme. Light lives under [data-theme="light"].
   To change the accent, edit --accent (fills) and --accent-ink (accent used
   as text or thin lines) in both blocks. Keep --accent-ink at 4.5:1 or more
   against --bg. */
:root {
  --bg: #0f0e0c;
  --surface: #171614;
  --surface-2: #1f1d1a;
  --border: #2e2b27;
  --border-strong: #46423b;
  --text: #f2efe9;
  --text-muted: #aba59b;
  --text-faint: #8a847a;
  --accent: #f2b544;
  --accent-ink: #f2b544;
  --on-accent: #17130a;
  --focus: var(--accent-ink);
  --header-bg: rgb(15 14 12 / 0.82);
  color-scheme: dark;

  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Type scale */
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  --step-2: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.625rem);
  --step-hero: clamp(5rem, 1rem + 30vw, 13.5rem);

  --radius: 12px;
  --radius-sm: 8px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --header-h: 3.75rem;

  /* Motion. One critically damped spring (damping 1.0, no overshoot), the
     default Apple uses for UI that wasn't flicked. It has no fixed duration;
     the durations below are its settle time for a given "response":
     ~1.46 × response. */
  --spring: cubic-bezier(0.25, 0.9, 0.3, 1); /* fallback for older browsers */
  --dur-press: 100ms;  /* press-down feedback: instant, plain ease-out */
  --dur-ui: 0.44s;     /* response 0.3: hovers, release, small state changes */
  --dur-enter: 0.58s;  /* response 0.4: content arriving on load */
  --press: 0.97;       /* buttons scale down while pressed */
  --press-lg: 0.985;   /* larger surfaces move less */

  /* Tracking is size-specific: tighter as type grows, slightly open when small. */
  --track-display: -0.05em;
  --track-title: -0.025em;
  --track-lead: -0.012em;
  --track-body: 0;
  --track-small: 0.005em;
  --track-label: 0.04em;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.057, 0.179, 0.319, 0.453, 0.571, 0.669, 0.748, 0.811, 0.859, 0.895, 0.923, 0.944, 0.959, 0.97, 0.979, 0.985, 0.989, 0.992, 0.994, 0.996, 0.997, 0.998, 0.999, 1);
  }
}

:root[data-theme="light"] {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #efede8;
  --border: #dedad2;
  --border-strong: #bfb9ad;
  --text: #171614;
  --text-muted: #57534b;
  --text-faint: #6e695f;
  --accent: #f2b544;
  --accent-ink: #8a5800;
  --on-accent: #17130a;
  --header-bg: rgb(247 246 243 / 0.85);
  color-scheme: light;
}

/* ---------- Base -------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  letter-spacing: var(--track-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul[role="list"] {
  list-style: none;
  padding: 0;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

a,
button {
  touch-action: manipulation; /* no double-tap-zoom delay on taps */
  -webkit-tap-highlight-color: transparent; /* pressed states below replace it */
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--brand {
  fill: currentColor;
  stroke: none;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.noscript {
  padding-block: 1rem;
  color: var(--text-muted);
}

/* ---------- Header / nav ----------------------------------------------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--bg);
}

/* Scroll edge: a soft fade where page content slides under the bar,
   shown only once something is actually underneath. */
.site-header::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: 1.25rem;
  background: linear-gradient(var(--header-bg), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-ui) var(--spring);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.site-header.is-scrolled::after {
  opacity: 1;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--header-h);
}

.nav__brand {
  margin-right: auto;
  font-weight: 650;
  font-stretch: 85%;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  padding-block: 0.5rem;
  transition: opacity var(--dur-ui) var(--spring);
}

.nav__links {
  display: flex;
  align-items: center;
  min-width: 0;
}

.nav__links a {
  display: block;
  padding: 0.625rem 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: var(--track-small);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color var(--dur-ui) var(--spring), opacity var(--dur-press) ease-out;
}

.nav__links a:hover,
.nav__links a[aria-current="true"] {
  color: var(--text);
}

.nav__links a[aria-current="true"] {
  text-decoration: underline;
  text-decoration-color: var(--accent-ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: -0.375rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur-ui) var(--spring), background-color var(--dur-ui) var(--spring),
    transform var(--dur-ui) var(--spring);
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

.theme-toggle .icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Dark (default) shows the sun: "switch to light". Both icons share one
   cell and swap with a short fade and turn. */
.theme-toggle .icon {
  grid-area: 1 / 1;
  transition: opacity var(--dur-ui) var(--spring), transform var(--dur-ui) var(--spring);
}

.icon--moon,
[data-theme="light"] .icon--sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

[data-theme="light"] .icon--moon {
  opacity: 1;
  transform: none;
}

@media (min-width: 40rem) {
  .nav {
    gap: 1rem;
  }

  .nav__links a {
    padding-inline: 0.75rem;
  }
}

@media (max-width: 22rem) {
  .nav__links a {
    padding-inline: 0.375rem;
    font-size: 0.875rem;
  }
}

/* ---------- Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.625rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: var(--track-small);
  text-decoration: none;
  white-space: nowrap;
  /* Release springs back from wherever the press left it. */
  transition: background-color var(--dur-ui) var(--spring), border-color var(--dur-ui) var(--spring),
    color var(--dur-ui) var(--spring), transform var(--dur-ui) var(--spring);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

[data-theme="light"] .btn--primary {
  border-color: var(--accent-ink);
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}

.btn--secondary {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--secondary:hover {
  border-color: var(--text-muted);
  background: var(--surface-2);
}

/* Press feedback lands on pointer-down, not on release. */
a.btn:active,
.theme-toggle:active {
  transform: scale(var(--press));
  transition-duration: var(--dur-press);
  transition-timing-function: ease-out;
}

.nav__links a:active,
.nav__brand:active,
.site-footer__top:active {
  opacity: 0.6;
  transition-duration: var(--dur-press);
}

/* Not available yet: a URL hasn't been added in content.js. */
.btn.is-pending {
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: default;
}

.soon {
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Hero ------------------------------------------------------- */
.hero {
  display: grid;
  justify-items: start;
  gap: 1.5rem;
  padding-block: clamp(3.5rem, 10vw, 8rem) clamp(4rem, 9vw, 7rem);
}

.hero__name {
  margin-left: -0.05em;
  font-size: var(--step-hero);
  font-weight: 650;
  font-stretch: 80%;
  letter-spacing: var(--track-display);
  line-height: 0.82;
}

.hero__tagline {
  max-width: 24ch;
  font-size: var(--step-2);
  line-height: 1.3;
  letter-spacing: var(--track-lead);
  color: var(--text-muted);
  text-wrap: balance;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
}

.hero__status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-ink);
  flex: none;
}

/* On load the hero settles into place on the spring, line by line. */
.hero > * {
  animation: rise var(--dur-enter) var(--spring) both;
}

.hero > :nth-child(2) { animation-delay: 0.05s; }
.hero > :nth-child(3) { animation-delay: 0.1s; }
.hero > :nth-child(4) { animation-delay: 0.15s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ---------- Sections --------------------------------------------------- */
.section {
  display: grid;
  gap: 1.75rem 3rem;
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--border);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}

.section__title {
  font-size: var(--step-3);
  font-weight: 600;
  font-stretch: 88%;
  letter-spacing: var(--track-title);
  line-height: 1.05;
  text-wrap: balance;
}

.section__meta {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
}

@media (min-width: 60rem) {
  .section {
    grid-template-columns: 12rem minmax(0, 1fr);
  }

  .section__head {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    align-self: start;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Marks copy that still needs writing. Remove `placeholder: true` in content.js. */
.ph-tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- About ------------------------------------------------------ */
.about {
  display: grid;
  gap: 1.25rem;
  max-width: 38rem;
}

.about p {
  color: var(--text-muted);
}

.about p:first-child {
  font-size: var(--step-2);
  line-height: 1.35;
  letter-spacing: var(--track-lead);
  color: var(--text);
  text-wrap: pretty;
}

/* ---------- Projects --------------------------------------------------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1.25rem;
}

.project {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.project__media {
  aspect-ratio: 16 / 10;
  width: 100%;
  max-width: 100%;
  object-fit: cover;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

/* Neutral block where project art goes later. */
.project__media--placeholder {
  display: flex;
  align-items: flex-end;
  padding: 1rem 1.25rem;
  background-color: var(--surface-2);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1.5px);
  background-size: 14px 14px;
  background-position: 7px 7px;
}

.project__media--placeholder span {
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.project__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  padding: 1.375rem 1.375rem 1.5rem;
}

.project__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

/* Badge sits above the name visually; the name stays first for screen readers. */
.project__top .status {
  order: -1;
}

.project__name {
  font-size: var(--step-2);
  font-weight: 600;
  font-stretch: 88%;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.project__desc {
  color: var(--text-muted);
  text-wrap: pretty;
}

.project__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.project__actions .btn {
  flex: 1 1 auto;
}

/* Status badge: a three-step track (in development, release prep, live). */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
}

.status__track {
  display: inline-flex;
  gap: 2px;
}

.status__track i {
  width: 0.625rem;
  height: 0.3125rem;
  border-radius: 1px;
  background: var(--border-strong);
}

.status__track i.is-on {
  background: var(--accent-ink);
}

.status[data-status="paused"] .status__track i.is-on {
  background: var(--text-faint);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
}

.tags li + li::before {
  content: "/";
  content: "/" / "";
  margin-inline: 0.5rem;
  color: var(--text-faint);
}

/* ---------- Now -------------------------------------------------------- */
.now {
  display: grid;
  gap: 0;
}

.now li {
  display: grid;
  gap: 0.375rem;
  padding-block: 1.125rem;
  border-top: 1px solid var(--border);
}

.now li:last-child {
  border-bottom: 1px solid var(--border);
}

.now__label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--accent-ink);
}

.now__label::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  background: currentColor;
  flex: none;
}

.now__text {
  font-size: var(--step-1);
  line-height: 1.4;
  letter-spacing: var(--track-lead);
  text-wrap: pretty;
}

@media (min-width: 48rem) {
  .now {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
  }

  .now li,
  .now li:last-child {
    align-content: start;
    padding-block: 1.25rem 0;
    border-bottom: 0;
  }
}

/* ---------- Links ------------------------------------------------------ */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-height: 4.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color var(--dur-ui) var(--spring), background-color var(--dur-ui) var(--spring),
    transform var(--dur-ui) var(--spring);
}

.link-card:active {
  transform: scale(var(--press-lg));
  transition-duration: var(--dur-press);
  transition-timing-function: ease-out;
}

.link-card__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

.link-card__icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.link-card__text {
  display: grid;
  min-width: 0;
  flex: 1;
}

.link-card__label {
  font-weight: 600;
  line-height: 1.3;
}

.link-card__note {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.4;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card__arrow {
  color: var(--text-faint);
  transition: color var(--dur-ui) var(--spring), transform var(--dur-ui) var(--spring);
}

.link-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.link-card:hover .link-card__icon {
  background: var(--bg);
}

.link-card:hover .link-card__arrow {
  color: var(--accent-ink);
  transform: translate(2px, -2px);
}

/* ---------- Footer ----------------------------------------------------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-muted);
}

.site-footer__top {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding-block: 0.5rem;
  text-decoration: none;
}

.site-footer__top:hover {
  color: var(--text);
}

.site-footer__top .icon {
  width: 1rem;
  height: 1rem;
}

/* ---------- Accessibility preferences --------------------------------- */
/* Reduced motion keeps feedback but drops movement: fades instead of
   slides, no press scaling, no turning icons. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --press: 1;
    --press-lg: 1;
  }

  .hero > * {
    animation: fade 0.3s ease-out both;
  }

  .theme-toggle .icon,
  .link-card:hover .link-card__arrow {
    transform: none !important;
  }
}

/* Reduced transparency: the bar becomes solid. */
@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* More contrast: solid bar with a real edge, stronger borders and text. */
@media (prefers-contrast: more) {
  :root,
  :root[data-theme="light"] {
    --border: var(--border-strong);
    --text-muted: var(--text);
  }

  .site-header {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--border-strong);
  }

  .site-header::after {
    display: none;
  }
}

/* Theme switch: colors ease over briefly instead of a hard brightness jump.
   main.js adds this class for the length of the switch only. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition-property: background-color, border-color, color, fill, opacity, transform !important;
  transition-duration: 0.3s !important;
  transition-timing-function: ease-out !important;
}
