/* ==========================================================================
   Halation — design system
   Dark, cinematic, editorial. Warm accent borrowed from the effect itself:
   the orange-red bleed film gets around a blown highlight.
   ========================================================================== */

/* Typefaces are self-hosted rather than pulled from Google Fonts: one less
   third party in the request chain, one less thing to disclose in the privacy
   policy, and the page renders identically offline. */

@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-tight-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Inter Tight';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-tight-latin-wght-italic.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}

:root {
  /* Surfaces */
  --bg:          #08070a;
  --surface-1:   #0d0c10;
  --surface-2:   #141319;
  --surface-3:   #1c1a22;
  --surface-4:   #262330;

  /* Ink */
  --text-1:      #f6f2ee;
  --text-2:      #a8a2af;
  --text-3:      #6c6675;
  --text-4:      #443f4c;

  /* Accent — halation */
  --accent:      #ff5a2b;
  --accent-soft: #ffa06a;
  --accent-deep: #c53c14;
  --teal:        #35a89e;

  /* Lines */
  --line:        rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .13);

  /* Type */
  --font-sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Instrument Serif', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --dur: .6s;

  /* Metrics */
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --radius: 14px;
  --radius-lg: 22px;
  --nav-h: 68px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'ss01' 1, 'cv05' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-editing { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: .98;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button, input, select { font: inherit; color: inherit; }

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

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

/* --------------------------------------------------------------------------
   Atmosphere: film grain over the whole page, and a warm light that tracks
   the cursor. Both are decorative and both back off on reduced motion.
   -------------------------------------------------------------------------- */

.grain {
  position: fixed;
  inset: -120px;
  z-index: 9998;
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  animation: grainShift 6s steps(6) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-14px, 8px); }
  40%  { transform: translate(9px, -12px); }
  60%  { transform: translate(-6px, -7px); }
  80%  { transform: translate(12px, 10px); }
  100% { transform: translate(0, 0); }
}

.cursor-glow {
  position: fixed;
  width: 620px;
  height: 620px;
  left: 0; top: 0;
  margin: -310px 0 0 -310px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 90, 43, .13) 0%, rgba(255, 90, 43, .05) 32%, transparent 66%);
  transition: opacity .8s var(--ease);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  .cursor-glow.is-live { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  transition: background .4s var(--ease), border-color .4s var(--ease);
  border-bottom: 1px solid transparent;
}

.nav.is-stuck {
  background: rgba(8, 7, 10, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .95rem;
  letter-spacing: -.02em;
  font-weight: 500;
}

.nav__mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #fff 0%, var(--accent-soft) 26%, var(--accent) 52%, var(--accent-deep) 76%, #2a0d05 100%);
  box-shadow: 0 0 18px rgba(255, 90, 43, .55), 0 0 42px rgba(255, 90, 43, .22);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.6vw, 2.4rem);
  font-size: .82rem;
  color: var(--text-2);
  letter-spacing: -.01em;
}

.nav__links a { transition: color .25s var(--ease); }
.nav__links a:hover { color: var(--text-1); }

@media (max-width: 720px) {
  .nav__links .nav__link--hide { display: none; }
}

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

.btn {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--text-1);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  height: 44px;
  padding: 0 1.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: -.01em;
  cursor: pointer;
  overflow: hidden;
  transition: transform .35s var(--ease), border-color .35s var(--ease), background .35s var(--ease), opacity .25s;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .26); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn--accent {
  --btn-bg: linear-gradient(140deg, var(--accent) 0%, var(--accent-deep) 100%);
  --btn-fg: #fff;
  border-color: transparent;
  box-shadow: 0 6px 26px -8px rgba(255, 90, 43, .65);
}
.btn--accent:hover { box-shadow: 0 12px 38px -10px rgba(255, 90, 43, .8); border-color: transparent; }

.btn--ghost { --btn-bg: transparent; }
.btn--sm { height: 36px; padding: 0 .95rem; font-size: .78rem; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 4rem) var(--gutter) 3.5rem;
  isolation: isolate;
}

.hero::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(120vw, 1500px);
  aspect-ratio: 1;
  translate: -50% -50%;
  z-index: -1;
  background: radial-gradient(circle, rgba(255, 90, 43, .16) 0%, rgba(255, 90, 43, .05) 30%, transparent 62%);
  filter: blur(28px);
  animation: breathe 9s var(--ease-io) infinite;
}

@keyframes breathe {
  0%, 100% { opacity: .75; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.09); }
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: clamp(1.4rem, 4vh, 2.6rem);
}

.hero__eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.hero__title {
  font-size: clamp(3rem, 12.8vw, 13.5rem);
  line-height: .9;
  letter-spacing: -.055em;
  font-weight: 500;
  margin-bottom: clamp(1.5rem, 4vh, 2.6rem);
}

.hero__title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.02em;
  color: var(--accent-soft);
}

/* Letters fly up behind a mask, with the warm bloom arriving a beat later. */
.reveal-line { display: block; overflow: hidden; padding-bottom: .16em; margin-bottom: -.1em; }
.reveal-line > span {
  display: block;
  transform: translateY(105%);
  animation: riseIn 1.15s var(--ease) forwards;
}
.reveal-line:nth-child(2) > span { animation-delay: .09s; }

@keyframes riseIn { to { transform: translateY(0); } }

.hero__lede {
  max-width: 46ch;
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  color: var(--text-2);
  line-height: 1.55;
  letter-spacing: -.012em;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .85rem;
  margin-top: clamp(1.8rem, 5vh, 3rem);
}

.hero__note {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-3);
  letter-spacing: .02em;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 5vw, 4rem);
  margin-top: clamp(3rem, 9vh, 6rem);
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.hero__stat { display: flex; flex-direction: column; gap: .25rem; }
.hero__stat b {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -.04em;
}
.hero__stat span {
  font-family: var(--font-mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Dropzone
   -------------------------------------------------------------------------- */

.drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem 1.1rem 1.2rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .015);
  cursor: pointer;
  transition: border-color .35s var(--ease), background .35s var(--ease), transform .35s var(--ease);
}

.drop:hover, .drop.is-over {
  border-color: var(--accent);
  background: rgba(255, 90, 43, .06);
  transform: translateY(-2px);
}

.drop__icon {
  flex: none;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--accent-soft);
}

.drop__text { display: block; }
.drop__text b { display: block; font-weight: 500; font-size: .92rem; letter-spacing: -.015em; }
.drop__text span { font-size: .78rem; color: var(--text-3); }

/* Full-window drop veil */
.dropveil {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: none;
  place-items: center;
  background: rgba(8, 7, 10, .86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dropveil.is-active { display: grid; }
.dropveil > div {
  border: 1px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 3.5rem 5rem;
  font-size: 1.1rem;
  letter-spacing: -.02em;
  background: rgba(255, 90, 43, .05);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: clamp(5rem, 13vh, 10rem) var(--gutter); position: relative; }

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}

.section__label {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
  display: block;
  margin-bottom: 1rem;
}

.section__title {
  font-size: clamp(2rem, 5.4vw, 4.2rem);
  letter-spacing: -.045em;
  max-width: 18ch;
}

.section__title em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent-soft);
  font-weight: 400;
}

.section__aside {
  max-width: 34ch;
  color: var(--text-2);
  font-size: .95rem;
  line-height: 1.6;
}

/* Bento grid */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(.75rem, 1.4vw, 1.15rem);
}

.card {
  position: relative;
  grid-column: span 2;
  padding: clamp(1.5rem, 2.4vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, var(--surface-1) 0%, var(--surface-2) 100%);
  overflow: hidden;
  transition: border-color .5s var(--ease), transform .5s var(--ease);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 90, 43, .1), transparent 60%);
  transition: opacity .5s var(--ease);
  pointer-events: none;
}

.card:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.card:hover::before { opacity: 1; }

.card--wide { grid-column: span 3; }
.card--full { grid-column: span 6; }

.card__index {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--accent);
  letter-spacing: .1em;
  margin-bottom: 1.6rem;
  display: block;
}

.card h3 {
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  letter-spacing: -.03em;
  margin-bottom: .7rem;
}

.card p { color: var(--text-2); font-size: .92rem; line-height: 1.62; }

.card__formula {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-3);
  line-height: 1.7;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .card, .card--wide, .card--full { grid-column: span 2; }
}
@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .card, .card--wide, .card--full { grid-column: span 1; }
}

/* --------------------------------------------------------------------------
   Preset showcase strip
   -------------------------------------------------------------------------- */

.looks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.75rem, 1.4vw, 1.1rem);
}

@media (max-width: 900px) { .looks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .looks { grid-template-columns: 1fr; } }

.look {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-1);
  transition: transform .55s var(--ease), border-color .55s var(--ease);
}

.look:hover { transform: translateY(-4px); border-color: var(--line-strong); }

.look__swatch {
  display: block;
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
}

.look__swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: .5;
}

.look__body { display: block; padding: 1.1rem 1.25rem 1.35rem; }
.look__body b { display: block; font-weight: 500; letter-spacing: -.025em; font-size: 1.02rem; }
.look__body span { font-size: .8rem; color: var(--text-3); line-height: 1.5; display: block; margin-top: .3rem; }

/* --------------------------------------------------------------------------
   Journal (structure now, articles later)
   -------------------------------------------------------------------------- */

.posts { display: grid; gap: 0; border-top: 1px solid var(--line); }

.post {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: clamp(1rem, 3vw, 3rem);
  align-items: baseline;
  padding: clamp(1.4rem, 3vw, 2.2rem) 0;
  border-bottom: 1px solid var(--line);
  transition: padding-left .5s var(--ease), background .5s var(--ease);
}

.post:hover { padding-left: 1.1rem; background: rgba(255, 255, 255, .015); }

.post__date, .post__tag {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-3);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.post h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
  letter-spacing: -.035em;
  font-weight: 400;
}

.post p { color: var(--text-3); font-size: .88rem; margin-top: .45rem; max-width: 60ch; }

.post--soon { opacity: .45; }

@media (max-width: 700px) {
  .post { grid-template-columns: 1fr; gap: .4rem; }
  .post__tag { display: none; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  padding: clamp(3rem, 8vh, 5rem) var(--gutter) 2.5rem;
  border-top: 1px solid var(--line);
}

.footer__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.footer__col { display: flex; flex-direction: column; gap: .6rem; }
.footer__col b {
  font-family: var(--font-mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-3);
  font-weight: 400;
  margin-bottom: .35rem;
}
.footer__col a { font-size: .88rem; color: var(--text-2); transition: color .25s; }
.footer__col a:hover { color: var(--text-1); }

.footer__word {
  font-size: clamp(3.5rem, 17vw, 15rem);
  line-height: .8;
  letter-spacing: -.06em;
  font-weight: 500;
  color: var(--surface-3);
  -webkit-user-select: none;
  user-select: none;
}

.footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Editor shell
   -------------------------------------------------------------------------- */

.editor {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: 'bar bar' 'stage panel';
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--ease), visibility .5s;
}

.editor.is-open { opacity: 1; visibility: visible; }

.ebar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 0 1.15rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}

.ebar__left, .ebar__right { display: flex; align-items: center; gap: .6rem; }

.ebar__file {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-3);
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage {
  grid-area: stage;
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(1rem, 3vw, 2.5rem);
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .028) 0%, transparent 60%),
    var(--bg);
  overflow: hidden;
}

.stage__frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), 0 0 0 1px var(--line);
  line-height: 0;
}

.stage__frame canvas { display: block; max-width: 100%; max-height: 100%; }

/* Before/after wipe */
.stage__before {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-position: center;
  clip-path: inset(0 calc(100% - var(--wipe, 0%)) 0 0);
  pointer-events: none;
}

.wipe {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--wipe, 0%);
  width: 1px;
  background: rgba(255, 255, 255, .85);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.wipe::after {
  content: 'BEFORE';
  position: absolute;
  top: 12px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: .6rem;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .9);
}
.stage.is-comparing .wipe { opacity: 1; }

.stage__hint {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  translate: -50% 0;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  color: var(--text-4);
  text-transform: uppercase;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Editor panel
   -------------------------------------------------------------------------- */

.panel {
  grid-area: panel;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-1);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-4) transparent;
}

.panel::-webkit-scrollbar { width: 9px; }
.panel::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 9px; border: 3px solid var(--surface-1); }

.panel__section { border-bottom: 1px solid var(--line); }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .95rem 1.1rem;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-3);
  transition: color .25s;
}
.panel__head:hover { color: var(--text-1); }
.panel__head svg { transition: transform .35s var(--ease); }
.panel__section.is-collapsed .panel__head svg { transform: rotate(-90deg); }
.panel__section.is-collapsed .panel__body { display: none; }

.panel__body { padding: 0 1.1rem 1.2rem; }

/* Preset rail */
.rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  padding: 0 1.1rem 1.2rem;
}

.chip {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition: border-color .35s var(--ease), transform .35s var(--ease);
}

.chip:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.chip.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px -12px rgba(255, 90, 43, .8);
}

.chip__swatch { display: block; aspect-ratio: 3 / 2; }
.chip__name {
  display: block;
  padding: .45rem .5rem .55rem;
  font-size: .72rem;
  letter-spacing: -.01em;
  color: var(--text-2);
}
.chip.is-active .chip__name { color: var(--text-1); }

/* Sliders */
.ctrl { margin-top: .95rem; }
.ctrl:first-child { margin-top: .2rem; }

.ctrl__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .35rem;
}

.ctrl__label { font-size: .78rem; color: var(--text-2); letter-spacing: -.01em; }

.ctrl__value {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.ctrl.is-changed .ctrl__value { color: var(--accent-soft); }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: ew-resize;
  display: block;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: var(--surface-4);
}
input[type='range']::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: var(--surface-4);
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--text-1);
  border: 0;
  box-shadow: 0 0 0 0 rgba(255, 90, 43, .5);
  transition: box-shadow .3s var(--ease), background .3s;
}
input[type='range']::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-1);
  border: 0;
}
input[type='range']:hover::-webkit-slider-thumb { background: var(--accent); box-shadow: 0 0 0 6px rgba(255, 90, 43, .16); }
input[type='range']:hover::-moz-range-thumb { background: var(--accent); }

.ctrl--color .ctrl__top { margin-bottom: 0; }
.ctrl--color { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

input[type='color'] {
  -webkit-appearance: none;
  appearance: none;
  width: 46px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
input[type='color']::-webkit-color-swatch-wrapper { padding: 2px; }
input[type='color']::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type='color']::-moz-color-swatch { border: 0; border-radius: 4px; }

/* Intensity master */
.master { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }

/* Export bar */
.export {
  position: sticky;
  bottom: 0;
  padding: 1rem 1.1rem 1.2rem;
  background: linear-gradient(to top, var(--surface-1) 70%, transparent);
  display: grid;
  gap: .5rem;
}

.export__meta {
  font-family: var(--font-mono);
  font-size: .66rem;
  color: var(--text-4);
  text-align: center;
  letter-spacing: .05em;
}

@media (max-width: 880px) {
  .editor {
    grid-template-rows: 54px minmax(0, 1fr) minmax(0, 46svh);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'bar' 'stage' 'panel';
  }
  .ebar { padding: 0 .7rem; }
  .ebar__file, #btn-compare { display: none; }
  .stage__hint { display: none; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .rail { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  translate: -50% 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(20, 19, 25, .95);
  backdrop-filter: blur(10px);
  font-size: .82rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--delay, 0s);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Article pages (about / privacy / contact / blog)
   -------------------------------------------------------------------------- */

.prose {
  max-width: 68ch;
  margin: 0 auto;
  padding: calc(var(--nav-h) + clamp(4rem, 12vh, 8rem)) var(--gutter) clamp(5rem, 12vh, 8rem);
}

.prose h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: -.045em;
  margin-bottom: 1.2rem;
}
.prose h2 {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  letter-spacing: -.03em;
  margin: 3rem 0 .9rem;
}
.prose p, .prose li { color: var(--text-2); line-height: 1.75; margin-bottom: 1rem; }
.prose strong { color: var(--text-1); font-weight: 500; }
.prose a { color: var(--accent-soft); text-decoration: underline; text-underline-offset: 3px; }
.prose ul { padding-left: 1.1rem; }
.prose__meta {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.6rem;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .reveal-line > span { transform: none; }
  .grain { animation: none; }
}
