/*
 * Jev Cooks! — mobile-first, single-column, dark by default.
 *
 * Design intent: the cook time is the hero. Everything else is scaffolding.
 * Accent #ff9d3d only appears on focus, the submit button, and the
 * refined-time eyebrow — never as chrome.
 */

:root {
  --bg: #0e0f12;
  --fg: #f4f5f7;
  --muted: #8b8f99;
  --accent: #ff9d3d;
  --accent-soft: rgba(255, 157, 61, 0.18);
  --accent-fg: #1a1a1a;
  --border: #26282f;
  --card: #16181d;
  --card-strong: #1b1e24;
  --warning: #ffd166;
  --warning-soft: rgba(255, 209, 102, 0.12);
  --error: #ff6e6e;
  --error-soft: rgba(255, 110, 110, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ────────────────────────────────────────────────────────────── */

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.masthead {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.title {
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
}

/* ── Form ──────────────────────────────────────────────────────────────── */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

input[type='text'],
select {
  font: inherit;
  width: 100%;
  padding: 14px 14px;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
  -webkit-appearance: none;
  appearance: none;
}

input[type='text']::placeholder {
  color: var(--muted);
}

input[type='text']:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--card-strong);
}

/* ── Method toggles ────────────────────────────────────────────────────── */

.method-field {
  border: 0;
  padding: 0;
  margin: 0;
}

.method-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.method-toggle-input {
  /*
   * Visually hide the actual <input>, but keep it focusable so
   * keyboard users can Tab into the radio group and use arrow keys.
   * The <label> next to each input is the visible "button".
   */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.method-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  min-height: 88px;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 80ms ease;
}

.method-toggle:hover {
  border-color: var(--muted);
}

.method-toggle:active {
  transform: translateY(1px);
}

.method-toggle-glyph {
  font-size: 24px;
  line-height: 1;
}

.method-toggle-label {
  font-size: 16px;
  font-weight: 600;
}

.method-toggle-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Selected state — driven by the radio's :checked + adjacent-sibling
 * selector. The <input> sits before the <label> in DOM order so this
 * works for both options. */
.method-toggle-input:checked + .method-toggle {
  background: var(--card-strong);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.method-toggle-input:checked + .method-toggle .method-toggle-sub {
  color: var(--accent);
}

/* Keyboard focus on the input → visible focus ring on the label. */
.method-toggle-input:focus-visible + .method-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Submit ────────────────────────────────────────────────────────────── */

.submit {
  font: inherit;
  font-weight: 600;
  width: 100%;
  padding: 14px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 48px;
  transition:
    transform 80ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.submit:hover:not(:disabled) {
  background: #ffae5c;
}

.submit:active:not(:disabled) {
  transform: translateY(1px);
}

.submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.submit:disabled {
  background: var(--card-strong);
  color: var(--muted);
  cursor: not-allowed;
}

.submit.is-busy {
  /* Subtle in-progress state: same orange but with a soft pulse, so the
     user knows the request is in flight without it looking like an error. */
  background: var(--accent);
  color: var(--accent-fg);
  position: relative;
}

.submit.is-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: pulse 1.4s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  70% {
    box-shadow: 0 0 0 12px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* ── Answer ────────────────────────────────────────────────────────────── */

.answer {
  padding: var(--space-5);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  animation: fade-up 240ms ease-out;
}

.answer-eyebrow {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.answer-eyebrow.is-refined {
  color: var(--accent);
}

.answer-time {
  margin: var(--space-1) 0 var(--space-1);
  font-size: clamp(40px, 11vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.answer-range {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.answer-confidence {
  margin: var(--space-1) 0 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.answer-confidence-dot {
  color: var(--border);
}

.answer-confidence-tier-high {
  color: var(--accent);
}

.answer-confidence-tier-medium {
  color: var(--fg);
}

.answer-confidence-tier-low {
  color: var(--warning);
}

.answer-warning {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  background: var(--warning-soft);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 14px;
  line-height: 1.4;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Error ─────────────────────────────────────────────────────────────── */

.error {
  margin: 0;
  padding: var(--space-4);
  background: var(--error-soft);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 14px;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.footer {
  margin-top: auto;
  padding-top: var(--space-4);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Small screens ─────────────────────────────────────────────────────── */

@media (max-width: 380px) {
  .page {
    padding: var(--space-5) var(--space-3) var(--space-5);
    gap: var(--space-5);
  }
  .answer {
    padding: var(--space-4);
  }
}
