/* ==========================================================================
   Pan Size & Recipe Scaler — theme.css
   Site: pan-recipe-scaler.hekatix.com
   Identity: Warm, friendly, kitchen/baking aesthetic with amber/cream palette.
   Soft serif for headings (baking tradition), clean sans for data.
   Every color/font/spacing/radius/shadow is a custom property on :root.
   ========================================================================== */

:root {
  /* ---- color ---------------------------------------------------------- */
  --color-bg:        #fef9f3;   /* warm cream background */
  --color-surface:   #f8f3e8;   /* raised panels (lighter) */
  --color-surface-2: #f1eadd;   /* active states, secondary panels */
  --color-ink:       #3d3529;   /* dark brownish-black text */
  --color-ink-head:  #2a231a;   /* headings (darker) */
  --color-muted:     #8b7c68;   /* secondary text, captions */
  --color-accent:    #d97757;   /* burnt orange/amber primary */
  --color-accent-dk: #b85e40;   /* hover/active */
  --color-accent-on: #ffffff;   /* text on accent */
  --color-safe:      #5d8c5c;   /* success green */
  --color-warn:      #c88a3b;   /* amber warning */
  --color-danger:    #b85e40;   /* amber-red for warnings */
  --color-border:    #e8ded0;   /* soft dividers */
  --color-focus:     #d97757;   /* visible focus ring */
  --color-shadow:    rgba(61, 53, 41, 0.12);

  /* ---- type ----------------------------------------------------------- */
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                  Arial, sans-serif;
  --font-heading: "Georgia", "Times New Roman", serif;
  --font-mono:    ui-monospace, "SFMono-Regular", Menlo, Consolas,
                  "Liberation Mono", monospace;

  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-md:  1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3rem;

  --leading-body: 1.6;
  --leading-head: 1.35;
  --tracking-tight: -0.01em;
  --measure: 68ch;

  /* ---- spacing (8px scale, mobile-first) ------------------------------ */
  --space-1: 0.25rem;  /*   4px */
  --space-2: 0.5rem;   /*   8px */
  --space-3: 0.75rem;  /*  12px */
  --space-4: 1rem;     /*  16px */
  --space-5: 1.5rem;   /*  24px */
  --space-6: 2rem;     /*  32px */
  --space-7: 3rem;     /*  48px */
  --space-8: 4rem;     /*  64px */
  --space-9: 6rem;     /*  96px */

  /* ---- radius --------------------------------------------------------- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* ---- shadow --------------------------------------------------------- */
  --shadow-sm: 0 2px 8px var(--color-shadow);
  --shadow-md: 0 8px 24px var(--color-shadow);
  --shadow-lg: 0 16px 48px var(--color-shadow);

  /* ---- layout --------------------------------------------------------- */
  --wrap: 720px;
  --gutter: clamp(1rem, 5vw, 2rem);
}

/* ==========================================================================
   Base / reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--color-accent); text-decoration: none;
    text-underline-offset: 0.14em; text-decoration-thickness: 1px; }
a:hover { color: var(--color-accent-dk); text-decoration: underline; }
a:visited { color: var(--color-accent); }

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

:root {
  --focus-ring: 3px solid var(--color-focus);
  --focus-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Skip link for keyboard users
   ========================================================================== */
.skip-link {
  position: absolute; left: var(--space-4); top: -100%;
  background: var(--color-accent); color: var(--color-accent-on);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  z-index: 100; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--space-2); }

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-ink-head);
  line-height: var(--leading-head);
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); margin-top: 0; }
h2 { font-size: var(--text-2xl); margin-top: var(--space-7); }
h3 { font-size: var(--text-xl); margin-top: var(--space-5); }
h4 { font-size: var(--text-lg); margin-top: var(--space-4); }

p { margin: 0 0 var(--space-5); max-width: var(--measure); }

ul, ol { margin: 0 0 var(--space-5); padding-left: 1.4em; max-width: var(--measure); }
li { margin-bottom: var(--space-2); }

strong, b { color: var(--color-ink-head); font-weight: 700; }
em, i { font-style: italic; }

blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-5) var(--space-6);
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-ink);
}
blockquote > *:last-child { margin-bottom: 0; }

hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-7) 0; }

/* ==========================================================================
   Site header
   ========================================================================== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.top-nav {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 4rem;
  display: flex; align-items: center; gap: var(--space-5);
}

.logo {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--color-ink-head);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: var(--space-2);
  white-space: nowrap;
}
.logo:hover { color: var(--color-accent); text-decoration: none; }

.top-nav ul {
  display: flex; gap: var(--space-4); margin: 0; padding: 0;
  list-style: none;
}
.top-nav li a {
  color: var(--color-ink);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  transition: background-color 0.2s, color 0.2s;
}
.top-nav li a:hover {
  background: var(--color-surface-2);
  color: var(--color-accent);
}

/* ==========================================================================
   Container layout
   ========================================================================== */
.container {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ==========================================================================
   Hero section
   ========================================================================== */
.hero {
  padding: var(--space-8) 0;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.hero h1 {
  margin-bottom: var(--space-4);
  line-height: var(--leading-head);
}

.hero-intro {
  font-size: var(--text-lg);
  color: var(--color-ink);
  margin-bottom: var(--space-6);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  background: var(--color-accent);
  color: var(--color-accent-on);
  font-size: var(--text-lg);
  font-weight: 700;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: background-color 0.2s, transform 0.1s;
}
.btn-primary:hover {
  background: var(--color-accent-dk);
  text-decoration: none;
}
.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Calculator section
   ========================================================================== */
.calculator-section {
  padding: var(--space-8) 0;
}

.section-intro {
  color: var(--color-ink);
  margin-bottom: var(--space-7);
}

.calculator-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

@media (max-width: 720px) {
  .calculator-panels {
    grid-template-columns: 1fr;
  }
}

/* Pan selector dropdown */
.pan-selector {
  margin-bottom: var(--space-4);
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-ink-head);
  margin-bottom: var(--space-2);
}

.pan-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  color: var(--color-ink);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pan-select:hover {
  border-color: var(--color-accent);
}
.pan-select:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.2);
}

/* Custom dimensions */
.custom-dimensions {
  margin-bottom: var(--space-4);
}

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

.dimension-input .field-label {
  margin-bottom: var(--space-1);
}

.stepper {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.stepper-btn {
  width: 40px;
  height: 44px;
  background: var(--color-surface-2);
  border: none;
  color: var(--color-ink-head);
  font-size: var(--text-2xl);
  cursor: pointer;
  transition: background-color 0.2s;
}
.stepper-btn:hover {
  background: var(--color-accent);
  color: var(--color-accent-on);
}

.dimension-input input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  font-size: var(--text-md);
  text-align: center;
  color: var(--color-ink);
}
.dimension-input input:focus {
  outline: none;
  background: var(--color-surface);
}

/* Camera capture section */
.camera-section {
  margin-top: var(--space-4);
}

.camera-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--color-muted);
}
.camera-unavailable svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-2);
  opacity: 0.7;
}

.btn-camera {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-ink);
  font-size: var(--text-sm);
  transition: border-color 0.2s, background-color 0.2s;
}
.btn-camera:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-2);
}
.btn-camera svg {
  width: 20px;
  height: 20px;
}

.camera-hint {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: var(--space-2);
}

/* ==========================================================================
   Results panel
   ========================================================================== */
.results-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-6);
}

.results-header h3 {
  margin-top: 0;
  margin-bottom: var(--space-5);
}

.areas-comparison {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.area-box {
  text-align: center;
}
.area-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}
.area-value {
  display: block;
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--color-ink-head);
  line-height: 1;
}
.area-unit {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.ratio-arrow {
  opacity: 0.5;
}
.ratio-arrow svg {
  width: 32px;
  height: 32px;
}

.ratio-display {
  margin-bottom: var(--space-6);
}
.ratio-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-1);
}
.ratio-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-ink-head);
}
.ratio-fraction {
  font-size: var(--text-lg);
  color: var(--color-accent);
  font-weight: 600;
}

.multiplier-box {
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
  margin-bottom: var(--space-6);
}
.multiplier-box h4 {
  margin-top: 0;
  margin-bottom: var(--space-2);
  color: var(--color-muted);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.multiplier-value {
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--color-accent);
}

/* Scaled ingredients */
.scaled-ingredients {
  margin-bottom: var(--space-6);
}
.scaled-ingredients h4 {
  margin-top: 0;
  margin-bottom: var(--space-3);
}
.ingredient-input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.ingredient-input input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  color: var(--color-ink);
}
.ingredient-input input:focus {
  outline: none;
  border-color: var(--color-focus);
}
.ingredient-result {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-accent);
}
.ingredient-hint {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-2);
}

/* Bake guidance */
.bake-guidance {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.bake-guidance h4 {
  margin-top: 0;
  margin-bottom: var(--space-3);
}
.bake-note {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-3);
  font-style: italic;
}

.depth-indicator {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.depth-indicator.same-depth { border-left: 4px solid var(--color-safe); }
.depth-indicator.shallower { border-left: 4px solid var(--color-warn); }
.depth-indicator.deeper { border-left: 4px solid var(--color-danger); }
.depth-text {
  font-weight: 700;
  color: var(--color-ink-head);
}

.bake-tips {
  margin-bottom: 0;
}
.bake-tips li {
  font-size: var(--text-sm);
  color: var(--color-ink);
}

/* ==========================================================================
   Steps grid (How It Works)
   ========================================================================== */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-6);
}

@media (max-width: 720px) {
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.step-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
  transition: transform 0.2s;
}
.step-card:hover {
  transform: translateY(-2px);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  color: var(--color-accent-on);
  border-radius: 50%;
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.step-card h3 {
  margin-top: 0;
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
  color: var(--color-ink-head);
}

.step-card p {
  color: var(--color-muted);
  margin-bottom: 0;
  font-size: var(--text-sm);
}

/* ==========================================================================
   Why It Matters section
   ========================================================================== */
.why-it-matters-section {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   Reference section (Common Swaps)
   ========================================================================== */
.reference-section {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
}
.reference-section h2 {
  margin-top: 0;
}

.common-swaps {
  margin-top: var(--space-5);
}
.common-swaps h3 {
  margin-bottom: var(--space-4);
}

.common-swaps table {
  width: 100%;
  border-collapse: collapse;
}
.common-swaps th, .common-swaps td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.common-swaps th {
  background: var(--color-surface-2);
  font-weight: 600;
  color: var(--color-ink-head);
  font-size: var(--text-sm);
}
.common-swaps tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   Guidance section (Conversion Tables)
   ========================================================================== */
.guidance-section {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
}
.guidance-section h2 {
  margin-top: 0;
}

.conversion-tables {
  margin-top: var(--space-5);
}

.table-section {
  margin-bottom: var(--space-8);
}

.conversion-tables h3 {
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.conversion-tables h4 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
  font-size: var(--text-lg);
}

.conversion-tables table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-2);
}
.conversion-tables th, .conversion-tables td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.conversion-tables th {
  background: var(--color-surface-2);
  font-weight: 600;
  color: var(--color-ink-head);
  font-size: var(--text-sm);
}
.conversion-tables tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   FAQ section
   ========================================================================== */
.faq-section {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
}
.faq-section h2 {
  margin-top: 0;
}

.faq-item {
  margin-bottom: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.faq-item summary {
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-ink-head);
  list-style: none;
}
.faq-item summary:hover {
  background: var(--color-surface-2);
}
.faq-item summary::marker {
  content: "";
}
.faq-item summary::after {
  content: "+";
  float: right;
  font-weight: 700;
}
.faq-item[open] summary::after {
  content: "−";
}
.faq-item p {
  padding: var(--space-4) var(--space-5);
  margin: 0;
  color: var(--color-muted);
}

/* ==========================================================================
   Site footer
   ========================================================================== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) 0 var(--space-4);
  margin-top: var(--space-8);
}

.footer-content {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.footer-logo {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-ink-head);
  margin-bottom: var(--space-2);
}

.footer-desc {
  color: var(--color-muted);
  margin-bottom: var(--space-4);
}

.disclaimer-text {
  background: var(--color-surface-2);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-top: var(--space-6);
}

/* ==========================================================================
   Responsive adjustments
   ========================================================================== */
@media (max-width: 600px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-xl); }
  .hero { padding: var(--space-6) 0; }
  .calculator-panels { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .areas-comparison { flex-direction: column; gap: var(--space-4); }
  .ratio-arrow { transform: rotate(90deg); }
}
