/* Project Manager — dark glass / light editorial, one accent hue per project.
   All motion is CSS scroll-driven; no animation libraries. */

:root {
  --hue: 152;            /* overridden per project */
  --sat: 70%;

  --bg: #080b10;
  --bg-2: #0d1219;
  --surface: 255 255 255;         /* glass tint, as an rgb triple */
  --surface-a: 0.045;
  --surface-hi: 0.09;
  --line: rgba(255 255 255 / 0.1);
  --line-hi: rgba(255 255 255 / 0.22);
  --text: #eef2f7;
  --text-dim: #98a4b4;
  --text-faint: #8b96a4;
  --accent: hsl(var(--hue) var(--sat) 58%);
  --accent-soft: hsl(var(--hue) var(--sat) 58% / 0.14);
  --accent-text: hsl(var(--hue) calc(var(--sat) - 10%) 72%);
  --warn: #f0b23c;
  --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.75);
  --glow: 0 0 60px -12px hsl(var(--hue) var(--sat) 50% / 0.5);

  --radius: 16px;
  --radius-sm: 9px;
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 20px;
  --space-4: 32px;
  --space-5: 52px;
  --space-6: 84px;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --topbar-h: 62px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f7f5f1;
  --bg-2: #efece5;
  --surface: 255 255 255;
  --surface-a: 0.72;
  --surface-hi: 0.92;
  --line: rgba(25 30 38 / 0.12);
  --line-hi: rgba(25 30 38 / 0.26);
  --text: #171c24;
  --text-dim: #4d5666;
  --text-faint: #5f6875;
  --accent: hsl(var(--hue) calc(var(--sat) - 8%) 34%);
  --accent-soft: hsl(var(--hue) var(--sat) 40% / 0.12);
  --accent-text: hsl(var(--hue) calc(var(--sat) - 5%) 30%);
  --warn: #9a6512;
  --shadow: 0 18px 44px -26px rgb(28 25 20 / 0.45);
  --glow: 0 0 48px -18px hsl(var(--hue) var(--sat) 45% / 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + var(--space-3));
}

body {
  margin: 0;
  min-height: 100vh;
  font: 400 16px/1.6 var(--sans);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  /* Two off-axis accent washes and a grid. Never a centred purple gradient. */
  background-image:
    radial-gradient(60vw 55vh at 88% -8%, hsl(var(--hue) var(--sat) 45% / 0.22), transparent 70%),
    radial-gradient(48vw 48vh at -6% 32%, hsl(calc(var(--hue) + 48) 60% 42% / 0.14), transparent 72%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-size: auto, auto, 72px 72px, 72px 72px, auto;
  background-attachment: fixed;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(55vw 50vh at 92% -10%, hsl(var(--hue) var(--sat) 55% / 0.16), transparent 70%),
    radial-gradient(45vw 45vh at -8% 30%, hsl(calc(var(--hue) + 48) 55% 55% / 0.1), transparent 72%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-size: auto, auto, 96px 96px, 96px 96px, auto;
}

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.86em; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.glass {
  background: rgb(var(--surface) / var(--surface-a));
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- scroll progress ---------- */

.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), hsl(calc(var(--hue) + 52) 75% 58%));
  animation: progress linear both;
  animation-timeline: scroll(root block);
}

@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  min-height: var(--topbar-h);
  padding: var(--space-2) var(--space-3);
  background: rgb(var(--surface) / calc(var(--surface-a) + 0.02));
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand-dim { color: var(--text-faint); }

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(140deg, var(--accent), hsl(calc(var(--hue) + 54) 78% 52%));
  box-shadow: var(--glow);
  animation: mark-spin 14s linear infinite;
}

@keyframes mark-spin {
  from { transform: rotate3d(1, 1, 0, 0deg); }
  to { transform: rotate3d(1, 1, 0, 360deg); }
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  /* Own row, always: eight tabs never fit beside the brand without clipping. */
  order: 3;
  flex: 1 1 100%;
  min-width: 0;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgb(var(--surface) / var(--surface-a));
}

.tabs::-webkit-scrollbar { display: none; }

.tabs-toggle { display: none; }

.tab {
  flex: none;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 13px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  transition: color 160ms ease, background 200ms ease, transform 200ms ease;
}

.tab:hover { color: var(--text); background: rgb(var(--surface) / var(--surface-hi)); }
.tab[aria-current] {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px hsl(var(--hue) var(--sat) 58% / 0.42);
}

.tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(var(--tab-hue) 70% 55%);
  box-shadow: 0 0 10px hsl(var(--tab-hue) 70% 55% / 0.8);
}

.tab-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.theme-toggle {
  flex: none;
  margin-inline-start: auto;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgb(var(--surface) / var(--surface-a));
  color: var(--text-dim);
  font: 500 12px/1 var(--mono);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.theme-toggle:hover { color: var(--text); border-color: var(--line-hi); }
.icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: inline; }

/* ---------- layout ---------- */

main {
  width: min(1180px, 100% - 2 * var(--space-3));
  margin-inline: auto;
  padding-block: var(--space-5) var(--space-6);
  perspective: 1400px;
  perspective-origin: 50% 20%;
}

/* select() focuses the panel so a tab change is announced. It is a container,
   not a control, so it takes no focus ring. */
.panel:focus, .panel:focus-visible { outline: none; }

.eyebrow {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  margin-bottom: var(--space-5);
  transform-style: preserve-3d;
  animation: hero-tilt linear both;
  animation-timeline: view();
  animation-range: exit -10% exit 90%;
}

@keyframes hero-tilt {
  from { transform: rotateX(0deg) scale(1); opacity: 1; }
  to { transform: perspective(1200px) rotateX(14deg) scale(0.93); opacity: 0.35; }
}

.hero-title {
  font-size: clamp(2.3rem, 6.4vw, 4.6rem);
  font-weight: 600;
  background: linear-gradient(96deg, var(--text) 26%, var(--accent-text));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub { max-width: 62ch; color: var(--text-dim); font-size: 1.05rem; }

@media (forced-colors: active) {
  .hero-title { background: none; color: var(--text); -webkit-text-fill-color: currentColor; }
}

.chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgb(var(--surface) / var(--surface-a));
  font: 500 12px/1.4 var(--mono);
  color: var(--text-dim);
}

.chip b { color: var(--text); font-weight: 600; }
.chip.is-accent { border-color: hsl(var(--hue) var(--sat) 58% / 0.45); color: var(--accent-text); }
.chip.is-warn { border-color: hsl(38 80% 55% / 0.5); color: var(--warn); }

/* ---------- 3D project deck (overview) ---------- */

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--space-3);
  transform-style: preserve-3d;
}

.card {
  position: relative;
  display: grid;
  gap: var(--space-2);
  align-content: start;
  padding: var(--space-3);
  text-align: left;
  cursor: pointer;
  color: inherit;
  transform-style: preserve-3d;
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 340ms ease, border-color 200ms ease;
  animation: card-in linear both;
  animation-timeline: view();
  animation-range: entry 4% entry 62%;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(46px) rotateX(-22deg) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.card:hover, .card:focus-visible {
  transform: translateZ(34px) rotateX(5deg) rotateY(-5deg);
  border-color: hsl(var(--hue) var(--sat) 58% / 0.5);
  box-shadow: var(--shadow), var(--glow);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(130deg, hsl(var(--hue) var(--sat) 60% / 0.16), transparent 58%);
  transition: opacity 320ms ease;
}

.card:hover::after, .card:focus-visible::after { opacity: 1; }

.card-top { display: flex; align-items: center; gap: var(--space-2); }

/* A card that is a status readout, not a link somewhere. */
.card.is-flat { cursor: default; }
.card.is-flat:hover, .card.is-flat:focus-visible { transform: none; box-shadow: none; }
.card-orb.is-small { width: 26px; height: 26px; border-radius: 8px; }

.card-orb {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), hsl(calc(var(--hue) + 50) 72% 48%));
  box-shadow: var(--glow);
  transform: translateZ(26px) rotate(-8deg);
}

.card h3 { font-size: 1.06rem; font-weight: 600; }
.card p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

.bar {
  height: 5px;
  border-radius: 999px;
  background: rgb(var(--surface) / var(--surface-hi));
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), hsl(calc(var(--hue) + 50) 78% 58%));
}

.meta {
  display: flex;
  gap: var(--space-2);
  font: 400 11.5px/1 var(--mono);
  color: var(--text-faint);
}

/* ---------- sections ---------- */

.section {
  margin-bottom: var(--space-5);
  animation: section-in linear both;
  animation-timeline: view();
  animation-range: entry 2% entry 52%;
}

@keyframes section-in {
  from { opacity: 0; transform: translateY(34px) rotateX(-10deg); }
  to { opacity: 1; transform: none; }
}

.section > h2 {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: 1.32rem;
  font-weight: 600;
}

.section > h2 small {
  font: 400 12px/1 var(--mono);
  color: var(--text-faint);
}

.grid-2 {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.list { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }

.list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgb(var(--surface) / var(--surface-a));
  font-size: 0.92rem;
  transition: border-color 180ms ease, transform 220ms ease;
}

.list li:hover { border-color: var(--line-hi); transform: translateX(3px); }
.list .tag { font: 500 11px/1.5 var(--mono); color: var(--accent-text); }
.list .when { font: 400 11px/1.5 var(--mono); color: var(--text-faint); }
.list.is-done li { color: var(--text-dim); }

.empty {
  padding: var(--space-3);
  border: 1px dashed var(--line-hi);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 0.92rem;
}

.prose { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
/* The summary is the thing being read on a project tab, so it carries size. */
.prose.is-lead { color: var(--text); font-size: 1.06rem; line-height: 1.65; max-width: 78ch; }

.raw { margin-top: var(--space-3); border-top: 1px solid var(--line); padding-top: var(--space-2); }
.raw > summary { cursor: pointer; font: 500 12px/1.6 var(--mono); color: var(--text-faint); }
.raw > summary:hover { color: var(--text-dim); }
.raw > p { margin-top: var(--space-2); }

.docs { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.doc {
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: 400 11.5px/1.5 var(--mono);
  color: var(--text-dim);
}

/* ---------- live preview ---------- */

.preview {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.preview-head {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
  font: 500 12px/1 var(--mono);
  color: var(--text-dim);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.dot.is-up { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot.is-down { background: #d0563f; }
.preview-head .spacer { margin-inline-start: auto; }

.frame-wrap {
  position: relative;
  height: clamp(340px, 52vh, 620px);
  background: rgb(var(--surface) / var(--surface-a));
}

.frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.frame-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  gap: var(--space-2);
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: var(--space-4);
  color: var(--text-dim);
}

.frame-fallback code {
  display: inline-block;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hi);
  background: rgb(var(--surface) / var(--surface-hi));
  color: var(--text);
  font-size: 13px;
  user-select: all;
}

.btn {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid hsl(var(--hue) var(--sat) 58% / 0.45);
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease;
}

.btn:hover { background: hsl(var(--hue) var(--sat) 58% / 0.24); transform: translateY(-1px); }
.btn.is-quiet { border-color: var(--line); background: transparent; color: var(--text-dim); }
.btn.is-quiet:hover { color: var(--text); border-color: var(--line-hi); }

.footer {
  width: min(1180px, 100% - 2 * var(--space-3));
  margin: 0 auto var(--space-4);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font: 400 12px/1.6 var(--mono);
  color: var(--text-faint);
}

/* ---------- narrow screens ---------- */

@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .topbar { gap: var(--space-2); }
  .hero { padding: var(--space-4) var(--space-3); }
  main { perspective: none; }

  /* Collapsed tab strip becomes a single-column dropdown menu, not a horizontal scroller. */
  .tabs-toggle {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 34px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgb(var(--surface) / var(--surface-a));
    color: var(--text);
    font: 500 13px/1 var(--sans);
    cursor: pointer;
  }

  .tabs-toggle .chevron { transition: transform 160ms ease; }
  .tabs-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

  .tabs {
    order: 4;
    flex: 1 1 100%;
    display: none;
    flex-direction: column;
    overflow-x: visible;
    overflow-y: auto;
    max-height: min(70vh, 420px);
    border-radius: var(--radius-sm);
  }

  .tabs.is-open { display: flex; }

  .tab { width: 100%; justify-content: flex-start; border-radius: var(--radius-sm); }
}

/* Motion is decoration here; the layout must read identically without it. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 1ms !important;
  }
  .card:hover, .card:focus-visible { transform: none; }
}

/* Firefox and older Safari have no scroll-driven animations: show everything. */
@supports not (animation-timeline: view()) {
  .card, .section, .hero { animation: none; opacity: 1; transform: none; }
  .scroll-progress { display: none; }
}
