:root {
  --charcoal: #171717;
  --charcoal-soft: #242321;
  --ink: #252321;
  --muted: #716a63;
  --paper: #f4efe8;
  --paper-deep: #e8ded2;
  --white: #fffdf9;
  --copper: #d86e47;
  --copper-deep: #a84f33;
  --sand: #e5a36d;
  --sage: #7b8d86;
  --line: #d8cfc4;
  --shadow: 0 18px 50px rgba(54, 40, 27, .11);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; overflow-x: hidden; background: var(--paper); line-height: 1.6; }
button, input { font: inherit; }
button { min-height: 44px; cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1240px; margin: auto; padding: 22px 32px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 15px; font-weight: 760; letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--copper); border-radius: 50%; color: var(--copper); font-size: 21px; line-height: 1; }
.site-nav { display: flex; flex-wrap: wrap; gap: 22px; color: #625b55; font-size: 13px; }
.site-nav a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--copper-deep); }

.hero { position: relative; isolation: isolate; overflow: hidden; background: var(--charcoal); color: var(--white); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35; background: radial-gradient(circle at 84% 12%, rgba(216, 110, 71, .28), transparent 32%), linear-gradient(118deg, transparent 48%, rgba(255,255,255,.035) 48.2%, transparent 48.8%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(300px, .98fr); gap: 42px; align-items: stretch; max-width: 1240px; min-height: 480px; margin: auto; padding: 76px 32px 74px; }
.hero-copy { align-self: center; width: 100%; min-width: 0; max-width: 670px; overflow: hidden; }
.eyebrow, .section-kicker, .panel-label, .assumption-label { margin: 0; color: var(--copper); font-size: 11px; font-weight: 780; letter-spacing: .18em; }
.hero h1 { max-width: 680px; margin: 18px 0 22px; overflow-wrap: anywhere; font-size: clamp(39px, 5.4vw, 74px); letter-spacing: -.06em; line-height: 1.05; }
.hero h1 span, .hero h1 em { display: block; }
.hero h1 em { color: var(--copper); font-style: normal; }
.hero-lede { width: 100%; max-width: 520px; margin: 0; color: #c6beb6; font-size: 16px; }
.hero-notes { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 36px; color: #aea69e; font-size: 12px; }
.hero-notes span { display: inline-flex; align-items: center; gap: 8px; }
.hero-notes i { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid #65534b; border-radius: 50%; color: #e5a36d; font-style: normal; font-size: 9px; }
.hero-art { position: relative; min-height: 330px; overflow: hidden; border: 1px solid rgba(255,255,255,.13); background: #201a17; }
.hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 58% center; filter: saturate(.82) contrast(1.05); }
.hero-image-shade { position: absolute; inset: 0; background: linear-gradient(110deg, rgba(23,23,23,.28), rgba(23,23,23,.03) 54%, rgba(110,40,19,.1)), linear-gradient(to top, rgba(15,13,12,.48), transparent 42%); }
.hero-art svg { position: absolute; inset: 4% -2% 8% 4%; width: 108%; height: 90%; fill: none; stroke: rgba(229,163,109,.72); stroke-width: 1.4; }
.hero-art svg circle { stroke: rgba(216,110,71,.7); }
.contour { position: absolute; border: 1px solid rgba(123,141,134,.35); border-radius: 50%; transform: rotate(-22deg); }
.contour-one { width: 470px; height: 210px; top: 12%; left: -14%; }
.contour-two { width: 390px; height: 180px; top: 22%; left: 8%; }
.contour-three { width: 300px; height: 150px; top: 33%; left: 28%; }
.art-caption { position: absolute; right: 20px; bottom: 18px; max-width: calc(100% - 40px); padding: 5px 8px; background: rgba(18,16,15,.62); color: #ded4cb; overflow-wrap: anywhere; text-align: right; font-size: 11px; letter-spacing: .12em; }

.calculator-wrap, .results-section, .saved-section { max-width: 1240px; margin: auto; padding: 92px 32px; }
.section-kicker { color: var(--copper-deep); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin: 12px 0 34px; }
h2, h3, p { overflow-wrap: anywhere; }
h2 { margin: 0; font-size: clamp(29px, 4vw, 48px); letter-spacing: -.055em; line-height: 1.1; }
.section-heading p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.formula-note { max-width: 420px; margin: 0 !important; padding: 13px 15px; border-left: 2px solid var(--copper); color: var(--ink) !important; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px !important; line-height: 1.5; }
.formula-note span { display: block; margin-bottom: 4px; color: var(--copper-deep); font-family: inherit; font-size: 10px; letter-spacing: .14em; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .72fr); gap: 18px; align-items: stretch; }
.room-form { min-width: 0; padding: clamp(22px, 3.4vw, 42px); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 16px; }
.field { min-width: 0; }
.field label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.field label span { color: var(--muted); font-size: 11px; font-weight: 500; }
.field input { width: 100%; min-width: 0; min-height: 50px; padding: 10px 12px; border: 1px solid #cfc3b8; border-radius: 2px; background: #fff; color: var(--ink); font-size: 16px; }
.field input:focus { outline: 3px solid rgba(216,110,71,.23); border-color: var(--copper); }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.field-order { grid-column: span 2; max-width: 230px; }
.example-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 11px; margin: 30px 0 20px; color: var(--muted); font-size: 12px; }
.example-button { min-height: 44px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--ink); font-size: 12px; }
.example-button:hover, .example-button:focus-visible { border-color: var(--copper); color: var(--copper-deep); }
.form-status { min-height: 24px; color: var(--copper-deep); font-size: 13px; }
.error-list { margin: 0 0 12px; padding-left: 18px; }
.primary-button, .secondary-button, .small-button, .text-button { border: 0; transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease; }
.primary-button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 54px; margin-top: 10px; padding: 12px 18px; background: var(--copper); color: #fff; font-weight: 750; }
.primary-button:hover, .primary-button:focus-visible { background: var(--copper-deep); transform: translateY(-1px); }
.primary-button span { font-size: 20px; }
.assumption-panel { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; padding: 30px; background: var(--charcoal); color: var(--white); }
.assumption-panel h3 { max-width: 250px; margin: 26px 0 15px; font-size: 27px; letter-spacing: -.04em; line-height: 1.15; }
.assumption-panel > p { color: #bcb4ac; font-size: 13px; }
.assumption-panel dl { margin: 22px 0; }
.assumption-panel dl div { display: flex; gap: 16px; padding: 11px 0; border-bottom: 1px solid #3a3734; }
.assumption-panel dt { width: 45px; color: var(--sand); font-size: 12px; font-weight: 750; }
.assumption-panel dd { margin: 0; color: #d7d0c9; font-size: 12px; }
.privacy-note { display: flex; gap: 8px; align-items: center; margin-bottom: 0 !important; font-size: 11px !important; }
.privacy-note span { color: var(--copper); font-size: 21px; }

.results-section { padding-top: 8px; }
.result-heading { align-items: center; margin-bottom: 24px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.secondary-button, .small-button { min-height: 44px; padding: 9px 13px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-size: 12px; font-weight: 700; }
.secondary-button:hover, .secondary-button:focus-visible, .small-button:hover, .small-button:focus-visible { border-color: var(--copper); color: var(--copper-deep); }
.text-button { padding: 7px 3px; background: transparent; color: var(--copper-deep); font-size: 12px; font-weight: 700; }
.text-button:hover, .text-button:focus-visible { text-decoration: underline; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { min-width: 0; padding: 18px 16px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label, .metric small { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin: 3px 0 1px; color: var(--copper-deep); font-size: clamp(19px, 2.7vw, 29px); letter-spacing: -.04em; }
.visual-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; margin-top: 18px; }
.panel { min-width: 0; padding: clamp(20px, 3vw, 30px); background: var(--white); border: 1px solid var(--line); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.panel h3 { margin: 8px 0 0; font-size: 24px; letter-spacing: -.04em; line-height: 1.15; }
.degeneracy-note, .sketch-tag, .count-label { color: var(--copper-deep); font-size: 11px; font-weight: 700; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0 12px; }
.filter-button { min-height: 44px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 12px; }
.filter-button.is-active, .filter-button:hover, .filter-button:focus-visible { border-color: var(--charcoal); background: var(--charcoal); color: var(--white); }
.plot-wrap { width: 100%; overflow: hidden; }
.frequency-plot { display: block; width: 100%; height: auto; min-height: 230px; }
.plot-background { fill: #fbf8f3; }
.plot-gridline { stroke: #e7ddd2; stroke-width: 1; stroke-dasharray: 2 5; }
.plot-tick { fill: #8a8179; font-size: 11px; }
.plot-empty { fill: #716a63; font-size: 14px; }
.mode-point { cursor: pointer; outline: none; opacity: .78; transition: r .15s ease, opacity .15s ease; }
.mode-point:hover, .mode-point:focus-visible, .mode-point.is-selected { opacity: 1; stroke: var(--charcoal); stroke-width: 2; }
.plot-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); font-size: 11px; }
.plot-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.axial { background: var(--copper); }
.legend-dot.tangential { background: var(--sand); }
.legend-dot.oblique { background: var(--sage); }
.plot-hint { margin-left: auto; }
.pressure-stage { background: var(--charcoal); color: var(--white); }
.pressure-stage .panel-label { color: var(--sand); }
.pressure-stage h3 { color: var(--white); }
.sketch-tag { color: #c8beb6; }
.canvas-frame { margin: 24px 0 14px; overflow: hidden; background: #171717; }
#pressure-canvas { display: block; width: 100%; height: 260px; }
.selected-mode-note { min-height: 25px; margin: 0; color: var(--sand); font-size: 13px; font-weight: 700; }
.small-note { margin: 12px 0 0; color: #aaa29a; font-size: 11px; }
.mode-table-panel { margin-top: 18px; }
.table-heading { align-items: center; margin-bottom: 18px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 13px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th { border-top: 0; color: var(--muted); font-size: 11px; font-weight: 700; }
tbody tr { transition: background .15s ease; }
tbody tr:hover, tbody tr.is-selected { background: #f8eee7; }
tbody th { font-weight: 700; }
.frequency-cell { color: var(--copper-deep); font-variant-numeric: tabular-nums; font-weight: 700; }
.type-badge { display: inline-block; min-width: 42px; padding: 3px 7px; border-radius: 99px; text-align: center; font-size: 11px; }
.type-badge.axial { background: #f4d7c9; color: #94442c; }
.type-badge.tangential { background: #f6e3cb; color: #89613d; }
.type-badge.oblique { background: #dce5e0; color: #536a61; }
.table-view-button { padding: 4px 7px; border: 0; background: transparent; color: var(--copper-deep); font-size: 11px; font-weight: 700; }
.table-view-button:hover, .table-view-button:focus-visible { text-decoration: underline; }
.model-boundary { margin: 18px 0 0; padding: 18px 20px; border-left: 3px solid var(--copper); color: var(--muted); font-size: 12px; }
.model-boundary strong { color: var(--ink); }

.saved-section { padding-top: 28px; }
.storage-key { padding: 6px 9px; border: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.saved-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.saved-empty { grid-column: 1 / -1; margin: 0; padding: 24px; border: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.saved-card { min-width: 0; padding: 20px; border: 1px solid var(--line); background: rgba(255,253,249,.5); }
.saved-card h3 { margin: 0; font-size: 20px; letter-spacing: -.04em; }
.saved-card p { margin: 5px 0 18px; color: var(--muted); font-size: 12px; }
.saved-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.saved-actions .small-button { min-height: 44px; padding: 6px 9px; font-size: 11px; }
.small-button.danger { color: var(--copper-deep); }
.comparison-panel { margin-top: 18px; }
.comparison-heading { margin-bottom: 18px; }
.comparison-heading h3 { margin: 7px 0 0; }
.comparison-panel table { background: #fbf8f3; }
.comparison-panel th, .comparison-panel td { white-space: normal; }

.site-footer { display: flex; justify-content: space-between; gap: 24px; max-width: 1240px; margin: auto; padding: 30px 32px 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer p { margin: 0; }
.site-footer span { margin: 0 5px; color: var(--copper); }
.site-footer a { color: var(--copper-deep); }

@media (max-width: 850px) {
  .site-header { align-items: flex-start; padding: 18px 20px; }
  .site-nav { justify-content: flex-end; gap: 8px 14px; font-size: 12px; }
  .hero-grid { grid-template-columns: 1fr; min-height: 0; padding: 60px 20px 40px; }
  .hero-art { min-height: 240px; }
  .calculator-wrap, .results-section, .saved-section { padding: 68px 20px; }
  .calculator-layout, .visual-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-order { grid-column: auto; max-width: none; }
  .saved-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .site-header { display: block; }
  .site-nav { justify-content: flex-start; margin-top: 13px; }
  .hero h1 { font-size: clamp(34px, 10.5vw, 46px); letter-spacing: -.055em; }
  .hero-notes { display: grid; gap: 9px; }
  .section-heading, .result-heading { display: block; }
  .formula-note { margin-top: 24px !important; }
  .result-actions { justify-content: flex-start; margin-top: 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; gap: 17px; }
  .field-order { max-width: none; }
  .saved-list { grid-template-columns: 1fr; }
  .storage-key { display: inline-block; margin-top: 18px; }
  .site-footer { display: block; padding: 28px 20px 38px; }
  .site-footer p + p { margin-top: 10px; }
}

@media (max-width: 350px) {
  .site-header, .hero-grid, .calculator-wrap, .results-section, .saved-section { padding-left: 14px; padding-right: 14px; }
  .hero-grid { padding-top: 44px; }
  .hero-art { min-height: 190px; }
  .hero-lede { font-size: 15px; }
  .room-form, .assumption-panel, .panel { padding: 18px; }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .result-actions .text-button { grid-column: 1 / -1; justify-self: start; }
  .secondary-button { min-width: 0; padding-left: 8px; padding-right: 8px; }
  .plot-hint { width: 100%; margin-left: 0; }
  th, td { padding-left: 9px; padding-right: 9px; }
}

@media print {
  .site-header, .hero, .calculator-wrap, .saved-section, .result-actions, .filter-row, .plot-legend, .table-view-button { display: none !important; }
  .results-section { display: block !important; padding: 0; }
  .visual-grid { grid-template-columns: 1fr 1fr; }
  .panel, .mode-table-panel { break-inside: avoid; box-shadow: none; }
  .site-footer { padding: 20px 0; }
}
