:root {
    --ink: #17201d;
    --muted: #65706c;
    --paper: #f5f3ec;
    --surface: #fffef9;
    --line: #d7d8d0;
    --accent: #e85d3f;
    --accent-dark: #c94328;
    --green: #1f6b4e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input { font: inherit; }
.site-header { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 72px; padding: 0 5vw; border-bottom: 1px solid rgba(23,32,29,.12); background: rgba(245,243,236,.92); backdrop-filter: blur(8px); }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; font-weight: 700; text-decoration: none; }
.brand-mark { width: 24px; height: 28px; border: 3px solid currentColor; border-bottom: 0; position: relative; }
.brand-mark::after { content: ''; position: absolute; width: 9px; height: 3px; right: -4px; bottom: -3px; background: var(--accent); transform: rotate(45deg); transform-origin: right center; box-shadow: 5px 5px 0 var(--accent); }
nav { display: flex; gap: 32px; }
nav a { color: var(--muted); font-size: 14px; text-decoration: none; }
nav a:hover { color: var(--ink); }
.header-action { justify-self: end; padding: 10px 15px; border: 1px solid var(--ink); border-radius: 7px; font-size: 14px; text-decoration: none; }
.intro { min-height: 610px; padding: 96px 8vw 80px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .85fr); gap: 8vw; align-items: center; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 24px; font-family: Georgia, serif; font-size: clamp(48px, 6.5vw, 88px); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
.intro-copy { max-width: 580px; color: var(--muted); font-size: 19px; line-height: 1.65; }
.primary-link, .calculate-button { display: inline-block; margin-top: 16px; border: 0; border-radius: 7px; background: var(--accent); color: white; padding: 14px 20px; font-weight: 600; text-decoration: none; cursor: pointer; }
.primary-link:hover, .calculate-button:hover { background: var(--accent-dark); }
.trust-line { display: inline-block; margin-left: 18px; color: var(--muted); font-size: 13px; }
.diagram { position: relative; min-height: 390px; display: grid; place-items: center; }
.door-frame { width: 250px; height: 330px; border: 14px solid var(--ink); border-bottom: 0; display: flex; align-items: end; justify-content: center; }
.item-shape { width: 172px; height: 226px; display: grid; place-items: center; border: 2px solid #b53c27; background: var(--accent); color: white; transform: rotate(-5deg); }
.item-shape span { font-family: Georgia, serif; font-size: 23px; }
.dimension { position: absolute; color: var(--muted); font-size: 12px; }
.width-dimension { bottom: 5px; left: 50%; transform: translateX(-50%); width: 250px; padding-top: 10px; border-top: 1px solid var(--muted); text-align: center; }
.height-dimension { left: calc(50% + 145px); top: 30px; height: 330px; padding-left: 10px; border-left: 1px solid var(--muted); writing-mode: vertical-rl; text-align: center; }
.checker-section { margin: 0 5vw; padding: 64px 4vw; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
h2 { font-family: Georgia, serif; font-size: clamp(34px, 4vw, 54px); font-weight: 400; line-height: 1.05; letter-spacing: -.03em; }
.section-heading h2 { margin-bottom: 0; }
.unit-switch { display: flex; padding: 4px; border-radius: 8px; background: #e9e8e1; }
.unit-switch button { padding: 9px 13px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.unit-switch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
form { display: grid; grid-template-columns: 1fr 1fr; gap: 6vw; padding-top: 36px; }
.form-column + .form-column { padding-left: 6vw; border-left: 1px solid var(--line); }
.form-column h3 { font-size: 18px; }
.form-help { margin-bottom: 34px; color: var(--muted); font-size: 14px; }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
label > span { float: right; color: #929995; font-weight: 400; }
input { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); padding: 13px 12px; outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,107,78,.12); }
.measurement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.measurement-grid label { position: relative; }
.measurement-grid input { padding-right: 40px; }
.measurement-grid small { position: absolute; right: 12px; bottom: 14px; color: #929995; font-weight: 400; }
.opening-grid { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
.calculate-button { width: 100%; margin-top: 24px; }
.result { margin-top: 36px; padding: 26px; border: 1px solid #b9d6c8; border-radius: 8px; background: #edf5f0; }
.result[data-status="tight"] { border-color: #e4c99d; background: #fff6e7; }
.result[data-status="no"] { border-color: #efbeb2; background: #fff0ec; }
.result h3 { margin-bottom: 8px; font-family: Georgia, serif; font-size: 28px; font-weight: 400; }
.result p { margin-bottom: 8px; color: var(--muted); line-height: 1.55; }
.result .result-metrics { display: flex; gap: 28px; margin: 18px 0; color: var(--ink); }
.error-list { color: #9d2e1d; }
.measure-guide { padding: 120px 8vw; display: grid; grid-template-columns: .85fr 1.15fr; gap: 9vw; }
.guide-intro > p:last-child { max-width: 520px; color: var(--muted); line-height: 1.7; }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { display: block; padding: 26px 0; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps h3 { margin-bottom: 8px; }
.steps p { margin: 0; color: var(--muted); line-height: 1.6; }
.content-note { margin: 0 5vw 100px; padding: 56px 4vw; background: var(--ink); color: #f8f5eb; display: grid; grid-template-columns: .8fr 1.2fr; gap: 8vw; border-radius: 10px; }
.content-note h2 { margin-bottom: 0; font-size: clamp(32px, 3.5vw, 48px); }
.content-note p { color: #c2c9c5; line-height: 1.75; }
footer { padding: 36px 5vw; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .brand { color: var(--ink); }
footer p { margin: 0; }
footer p:last-child { justify-self: end; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.legal-page { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 80px 0 110px; }
.legal-page h1 { margin-top: 42px; font-size: clamp(46px, 7vw, 76px); }
.legal-intro { max-width: 640px; color: var(--muted); font-size: 19px; line-height: 1.7; }
.updated-date { margin: 28px 0 56px; color: var(--muted); font-size: 13px; }
.legal-page section { padding: 30px 0; border-top: 1px solid var(--line); }
.legal-page section h2 { margin-bottom: 12px; font-family: inherit; font-size: 21px; font-weight: 600; letter-spacing: 0; }
.legal-page section p { max-width: 72ch; margin-bottom: 0; color: var(--muted); line-height: 1.75; }
.back-link { color: var(--accent-dark); font-size: 14px; text-underline-offset: 4px; }
::selection { background: var(--accent); color: white; }
:focus-visible { outline: 3px solid rgba(31,107,78,.45); outline-offset: 3px; }
.calculate-button:disabled { cursor: wait; opacity: .68; }

@media (max-width: 820px) {
    .site-header { grid-template-columns: 1fr auto; }
    nav { display: none; }
    .intro { padding-top: 64px; grid-template-columns: 1fr; }
    .diagram { min-height: 360px; }
    .trust-line { display: block; margin: 14px 0 0; }
    .section-heading { align-items: start; flex-direction: column; }
    form, .measure-guide, .content-note { grid-template-columns: 1fr; }
    .form-column + .form-column { padding: 30px 0 0; border-left: 0; border-top: 1px solid var(--line); }
    .measure-guide { padding: 90px 7vw; gap: 40px; }
    .content-note { gap: 30px; }
    footer { grid-template-columns: 1fr; gap: 18px; }
    .footer-links { flex-wrap: wrap; }
    footer p:last-child { justify-self: start; }
}

@media (max-width: 520px) {
    .site-header { padding: 0 20px; }
    .header-action { display: none; }
    .intro { padding: 52px 22px 64px; }
    h1 { font-size: 50px; }
    .diagram { transform: scale(.85); margin: -20px 0; }
    .checker-section { margin: 0 12px; padding: 42px 20px; }
    .measurement-grid { grid-template-columns: 1fr; }
    .opening-grid { grid-template-columns: 1fr 1fr; }
    .result .result-metrics { flex-direction: column; gap: 4px; }
}
