/* Windfield: a quiet glass interface laid over a live scene. The accent colour is set
   per mood from presets.js, so the chrome warms and cools with the sky. */

:root {
  --accent: #f0a24a;
  --fg: #f4efe7;
  --fg-2: rgba(244, 239, 231, 0.72);
  --fg-3: rgba(244, 239, 231, 0.48);
  --glass: rgba(14, 12, 10, 0.42);
  --glass-strong: rgba(14, 12, 10, 0.58);
  --line: rgba(255, 255, 255, 0.1);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0c0a08;
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.wf-mono {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wf-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.wf-ui > * { pointer-events: auto; }
.ui-hidden .wf-ui { opacity: 0; }
.ui-hidden .wf-ui > * { pointer-events: none; }

/* ------------------------------------------------------------------ top bar */
.wf-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  pointer-events: none;
}
.wf-top > * { pointer-events: auto; }

.wf-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  text-decoration: none;
}
.wf-brand span { display: grid; gap: 3px; }
.wf-brand strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.wf-brand i { font-style: normal; color: var(--fg-3); padding: 0 4px; }
.wf-brand small {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.wf-top-right { display: flex; align-items: center; gap: 16px; }
.wf-live { display: flex; align-items: center; gap: 8px; color: var(--fg-2); }
.wf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  display: inline-block;
}

.wf-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.wf-icon:hover { background: var(--glass-strong); border-color: rgba(255, 255, 255, 0.22); }
.wf-icon[aria-pressed='true'] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.wf-icon-plain { background: transparent; border-color: transparent; backdrop-filter: none; }
.wf-icon:focus-visible, .wf-tab:focus-visible, .wf-preset:focus-visible, .wf-subject:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ headline */
.wf-hero {
  position: absolute;
  top: 104px;
  left: 30px;
  max-width: min(640px, 52vw);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
}
.wf-hero.is-swapping { opacity: 0; transform: translateY(6px); filter: blur(6px); }
.wf-eyebrow { color: var(--fg-2); display: block; }
.wf-hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 4.6vw, 74px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 18px 0 14px;
}
.wf-hero p {
  margin: 0;
  text-wrap: balance;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 420px;
}

/* ------------------------------------------------------------------ panel */
.wf-panel {
  position: absolute;
  top: 76px;
  right: 24px;
  bottom: 112px;
  width: 300px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  padding: 22px 20px 16px;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.35s ease;
}
.panel-closed .wf-panel { transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; }

.wf-panel-head { display: flex; justify-content: space-between; align-items: flex-start; }
.wf-panel-head h2 { font-size: 17px; font-weight: 600; margin: 8px 0 0; letter-spacing: -0.01em; }

.wf-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin: 18px 0 8px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}
.wf-tab {
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font: 500 12px var(--sans);
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
}
.wf-tab.is-active { background: rgba(255, 255, 255, 0.12); color: var(--fg); }

.wf-panel-body {
  flex: 1;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.wf-section {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 600;
  margin: 18px 0 6px;
}
.wf-section .wf-mono { color: var(--fg-3); font-size: 9px; }

.wf-row { display: block; padding: 7px 0 3px; cursor: pointer; }
.wf-row-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.wf-row output { color: var(--accent); font-size: 9.5px; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  background: transparent;
  margin: 0;
  cursor: pointer;
  --p: 50%;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--fg) 0 var(--p), rgba(255, 255, 255, 0.14) var(--p) 100%);
}
input[type='range']::-moz-range-track { height: 2px; background: rgba(255, 255, 255, 0.14); }
input[type='range']::-moz-range-progress { height: 2px; background: var(--fg); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25);
}
input[type='range']::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--fg); }
input[type='range']:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wf-subjects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 14px;
}
.wf-subject {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-2);
  font: 500 12px var(--sans);
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
}
.wf-subject.is-active {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.wf-panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 12px;
  font-size: 12px;
  color: var(--fg-2);
}
.wf-panel-foot select {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font: 500 12px var(--sans);
}
.wf-panel-foot option { background: #1a1612; }
.wf-note { margin: 10px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--fg-3); }

/* ------------------------------------------------------------------ bottom bar */
.wf-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 24px 34px;
  pointer-events: none;
}
.wf-bottom > * { pointer-events: auto; }

.wf-fps {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--fg-2);
  min-width: 170px;
  white-space: nowrap;
}
.wf-sep { width: 1px; height: 12px; background: var(--line); }

.wf-presets {
  position: relative; /* offset parent for keeping the active mood in view */
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  overflow-x: auto;
  max-width: calc(100vw - 48px);
  scrollbar-width: none;
}
.wf-preset {
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font: 500 13px var(--sans);
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 7px;
  transition: background 0.25s ease, color 0.25s ease;
}
.wf-preset .wf-mono { font-size: 8.5px; color: var(--fg-3); letter-spacing: 0.08em; }
.wf-preset:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
.wf-preset.is-active { background: var(--accent); color: #140d07; }
.wf-preset.is-active .wf-mono { color: rgba(20, 13, 7, 0.6); }

.wf-actions { justify-self: end; display: flex; gap: 8px; }

.wf-hints {
  grid-column: 1 / -1;
  justify-self: center;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  color: var(--fg-2);
  font-size: 9px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}
.wf-hints span + span::before { content: '·'; margin-right: 18px; opacity: 0.6; }

/* ------------------------------------------------------------------ loading and fallback */
.wf-loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0c0a08;
  color: var(--fg-3);
  font: 400 22px var(--serif);
  font-style: italic;
  transition: opacity 0.9s ease 0.2s, visibility 0s linear 1.2s;
  z-index: 5;
}
.is-ready .wf-loading { opacity: 0; visibility: hidden; }

.wf-fallback {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  background: #0c0a08;
  font-family: var(--serif);
  font-size: 22px;
  z-index: 6;
}
.wf-fallback a { color: var(--accent); font: 500 14px var(--sans); }
.no-webgl .wf-fallback, .wf-fallback-show { display: grid; }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 960px) {
  .wf-hero { top: 84px; left: 20px; max-width: calc(100vw - 40px); }
  .wf-top { padding: 18px 20px; }
  .wf-live { display: none; }
  .wf-panel { top: auto; bottom: 150px; right: 12px; left: 12px; width: auto; max-height: 52vh; }
  .wf-bottom { grid-template-columns: 1fr auto; padding: 0 12px 18px; gap: 10px; }
  .wf-presets { grid-column: 1 / -1; grid-row: 1; justify-self: stretch; }
  .wf-fps { min-width: 0; }
  .wf-fps .wf-sep, .wf-fps [data-preset-name] { display: none; }
  .wf-hints { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wf-hero, .wf-panel, .wf-ui { transition: none; }
}

/* WCAG AA controls and text. */
.wf-preset.is-active .wf-mono { color: #34220f; }
/* ------------------------------------------------------------------ driving */
.wf-drive {
  width: 100%;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--fg);
  font: 600 12px var(--sans);
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.wf-drive[aria-pressed='true'] { background: var(--accent); color: #140d07; }
.wf-drive[aria-pressed='true'] .wf-mono { color: rgba(20, 13, 7, 0.6); }
.wf-drive:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-hint-drive { display: none; }
.is-driving .wf-hint-drive { display: inline; }
.is-driving .wf-hint-free { display: none; }

/* ------------------------------------------------------------------ benchmark (?bench) */
.wf-bench-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--fg);
  z-index: 8;
}
.wf-bench-card {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(14, 12, 10, 0.82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 9;
}
.wf-bench-card h2 { font: 400 26px var(--serif); margin: 10px 0 16px; }
.wf-bench-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wf-bench-card th { text-align: left; color: var(--fg-3); font-weight: 500; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wf-bench-card td { padding: 8px 0; border-bottom: 1px solid var(--line); text-transform: capitalize; }
.wf-bench-card tr.is-pick td { color: var(--accent); font-weight: 600; }
.wf-bench-line { margin: 16px 0 0; font-size: 10px; line-height: 1.6; color: var(--fg-2); text-transform: none; letter-spacing: 0.04em; user-select: all; word-break: break-word; }
.wf-bench-actions { display: flex; gap: 8px; margin-top: 16px; }
.wf-bench-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: 600 12px var(--sans);
  cursor: pointer;
}
.wf-bench-actions [data-copy] { background: var(--accent); color: #140d07; border-color: transparent; }

/* Loading copy must retain AA contrast over the dark scene. */
.wf-loading > span { color: #d5cec4; opacity: 1; display: grid; justify-items: center; gap: 18px; }
/* A thin line with light travelling along it, like a gust over the crop. */
.wf-loading > span::after {
  content: '';
  width: 140px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat -140px 0 / 70px 1px, rgba(255, 255, 255, 0.12);
  animation: wf-gust 1.6s cubic-bezier(0.45, 0, 0.3, 1) infinite;
}
@keyframes wf-gust { to { background-position: 210px 0, 0 0; } }

/* Soft scrims top and bottom so the headline and the bars read over a bright sky or
   crop, without boxing them in. They fade with the rest of the interface (H). */
.wf-ui::before,
.wf-ui::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  z-index: -1;
  pointer-events: none;
}
.wf-ui::before { top: 0; height: 60%; background: radial-gradient(ellipse 52% 62% at 12% 24%, rgba(10, 8, 6, 0.3), rgba(10, 8, 6, 0) 72%); }
.wf-ui::after { bottom: 0; height: 24%; background: linear-gradient(0deg, rgba(10, 8, 6, 0.3), rgba(10, 8, 6, 0)); }
@media (max-width: 960px) {
  .wf-ui::before { height: 46%; background: linear-gradient(180deg, rgba(10, 8, 6, 0.42), rgba(10, 8, 6, 0.14) 60%, rgba(10, 8, 6, 0)); }
}

@media (prefers-reduced-motion: reduce) {
  .wf-loading > span::after { animation: none; }
}
