/* BSB damper sizing calculator. Tokens from the BSB design system (Brand Guide V1.1). */
@font-face { font-family: "Montserrat"; src: url("assets/fonts/Montserrat.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("assets/fonts/OpenSans.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }

:root {
  --navy: #090446; --navy-hover: #161063; --navy-900: #050227;
  --yellow: #DE9713; --yellow-hover: #C4820E; --yellow-700: #A86D08;
  --smoke-900: #2d2e2f; --smoke-700: #434445; --smoke: #575859; --smoke-400: #8C8D8E; --smoke-200: #C8C9C9; --smoke-100: #eceded;
  --offwhite: #EEF0EA; --lightblue: #BDD5EA; --lightblue-200: #E2ECF5;
  --danger: #B3341F; --success: #2F6B4F;
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-body: "Open Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22,.61,.36,1);
  --shadow-md: 0 8px 24px rgba(9,4,70,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); font-size: 15px; line-height: 1.65; color: var(--smoke); background: #fff; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); color: var(--navy); margin: 0; line-height: 1.16; }
p { margin: 0; }
a { color: var(--navy); transition: color 120ms var(--ease); }
a:hover { color: var(--yellow); }
img { display: block; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ── Buttons ── */
.btn {
  font-family: var(--font-display); font-weight: 600; letter-spacing: .04em; white-space: nowrap;
  border-radius: 999px; border: 2px solid transparent; cursor: pointer;
  font-size: 15px; padding: 12px 26px; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), border-color 120ms var(--ease);
}
.btn-sm { font-size: 14px; padding: 8px 18px; }
.btn-lg { font-size: 17px; padding: 16px 34px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-hover); }
.btn-accent { background: var(--yellow); color: var(--navy); }
.btn-accent:hover { background: var(--yellow-hover); }
.btn-secondary { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--navy); color: #fff; }
.btn .arrow { display: inline-block; transition: transform 120ms var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--yellow); }

/* ── Form fields (design system Input) ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--navy); }
.field .opt { font-weight: 400; color: var(--smoke-400); }
.field input, .field textarea {
  font: 15px/1.4 var(--font-body); color: var(--smoke-900);
  padding: 11px 14px; border: 1px solid var(--smoke-200); border-radius: 4px; background: #fff; width: 100%;
  transition: border-color 120ms var(--ease);
}
.field textarea { resize: vertical; }
.field input:hover, .field textarea:hover { border-color: var(--smoke-400); }
.field input:focus, .field textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 2px rgba(222,151,19,.9); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field-error { font-size: 13px; line-height: 1.4; color: var(--danger); }
.field-error:empty { display: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--smoke-700); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--navy); flex: none; }
.fine { font-size: 12px; color: var(--smoke-400); }
.fine a { color: var(--smoke-400); }
.notice { font-size: 14px; color: var(--navy); background: var(--lightblue-200); border-radius: 4px; padding: 10px 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ── Screen 1: gate ── */
.gate { position: relative; min-height: 100vh; min-height: 100dvh; background: var(--navy); display: grid; place-items: center; padding: 160px 24px 48px; overflow: hidden; }
.gate-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .3; }
.gate-wave { position: absolute; left: -10%; width: 120%; max-width: none; height: auto; top: 55%; transform: translateY(-50%) rotate(-4deg); opacity: .4; pointer-events: none; }
.gate-brand { position: absolute; top: 36px; left: 48px; z-index: 1; }
.gate-brand img { height: 76px; width: auto; }
.beta-badge { position: absolute; top: 24px; right: 32px; z-index: 2; margin: 0; padding: 4px 12px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .04em; color: #fff; }
.logo-glow { filter: drop-shadow(0 0 12px rgba(0,0,0,.55)); }
.gate-band-title { display: none; }
.gate-card { position: relative; width: 520px; max-width: 100%; background: #fff; border-radius: 8px; box-shadow: 0 24px 48px rgba(5,2,39,.35); overflow: hidden; }
.gate-head { padding: 36px 40px 0; display: flex; flex-direction: column; gap: 10px; }
.gate-label { font-size: 15px; color: var(--smoke); }
.gate-head h1 { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.tabs { margin: 24px 40px 0; border-bottom: 1px solid var(--smoke-200); display: flex; gap: 28px; }
.tabs button { font-family: var(--font-display); font-weight: 600; font-size: 14px; padding: 10px 0; border: 0; background: none; color: var(--smoke-400); cursor: pointer; transition: color 120ms var(--ease), box-shadow 120ms var(--ease); }
.tabs button[aria-selected="true"] { color: var(--navy); box-shadow: inset 0 -2px 0 var(--yellow); }
.tabs button:hover { color: var(--navy); }
.gate-form { padding: 24px 40px 36px; display: flex; flex-direction: column; gap: 16px; }
.gate-form.returning .new-only { display: none; }

/* ── Screen 2: calculator (2b) ── */
.calc { display: grid; grid-template-columns: 400px 1fr; min-height: 100vh; min-height: 100dvh; }
.m-header, .m-footer { display: none; }

.inputs { background: var(--navy); color: #fff; padding: 32px 36px; display: flex; flex-direction: column; gap: 28px; }
.logo-wrap { align-self: flex-start; }
.logo-wrap img { height: 30px; width: auto; }
.inputs-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.help-btn { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-grid; place-items: center; font: 700 13px/1 var(--font-display); background: none; color: inherit; padding: 0; cursor: pointer; flex: none; }
.help-link { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; cursor: pointer; color: rgba(255,255,255,.75); font: 600 12px var(--font-display); letter-spacing: .02em; transition: color 120ms var(--ease); }
.help-link:hover { color: var(--yellow); }
.help-link .help-btn { width: 22px; height: 22px; font-size: 12px; }
.m-header-end { display: flex; align-items: center; gap: 12px; }
.m-header .help-btn { width: 30px; height: 30px; color: var(--navy); }

/* ── "How it works" tour ── */
.tour { position: fixed; inset: 0; z-index: 50; }
.tour-shade { position: fixed; inset: 0; background: rgba(9,4,70,.6); }
.tour-spot { position: fixed; border-radius: 8px; box-shadow: 0 0 0 3px var(--yellow), 0 0 0 9999px rgba(9,4,70,.6); pointer-events: none; transition: left 220ms var(--ease), top 220ms var(--ease), width 220ms var(--ease), height 220ms var(--ease); }
.tour-pop { position: fixed; background: #fff; border-radius: 8px; padding: 22px 22px 18px; box-shadow: 0 24px 48px rgba(5,2,39,.35); transition: left 220ms var(--ease), top 220ms var(--ease); }
.tour-pop h2 { font-size: 18px; font-weight: 700; margin: 0 28px 8px 0; letter-spacing: -.01em; }
.tour-pop p#tour-body { font-size: 14px; line-height: 1.55; color: var(--smoke-700); margin: 0; }
.tour-pop strong { color: var(--navy); }
.tour-count { font: 600 11px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--yellow-700); margin: 0 0 6px; }
.tour-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--smoke-400); cursor: pointer; border-radius: 4px; }
.tour-close:hover { color: var(--navy); background: var(--smoke-100); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--smoke-200); transition: background-color 120ms var(--ease), width 120ms var(--ease); }
.tour-dots span.on { background: var(--navy); width: 16px; border-radius: 3px; }
.tour-btns { display: flex; gap: 8px; }
.tour-btns [hidden] { display: none; }
.group { display: flex; flex-direction: column; gap: 12px; }
.group-label { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: rgba(255,255,255,.72); padding: 0; margin-bottom: 12px; }

.toggles { display: flex; flex-direction: column; gap: 12px; }
.more-soon { margin: 10px 0 0; font-size: 13px; font-style: italic; color: rgba(255,255,255,.6); }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: 4px; border: 2px solid rgba(255,255,255,.22); background: transparent; color: #fff; cursor: pointer;
  transition: all 120ms var(--ease); font: inherit;
}
.toggle .code { display: block; font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.toggle .desc { display: block; font-size: 13px; opacity: .75; }
.toggle .tick { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); display: grid; place-items: center; font-size: 12px; color: transparent; flex: none; transition: all 120ms var(--ease); }
.toggle[aria-pressed="true"] { border-color: var(--yellow); background: rgba(255,255,255,.1); }
.toggle[aria-pressed="true"] .tick { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 700; }
.toggle:hover { border-color: rgba(255,255,255,.5); }
.toggle[aria-pressed="true"]:hover { border-color: var(--yellow); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: rgba(255,255,255,.08); border-radius: 999px; }
.segmented button { font-family: var(--font-display); font-weight: 600; font-size: 13px; padding: 10px 8px; border-radius: 999px; border: 0; background: transparent; color: rgba(255,255,255,.82); cursor: pointer; transition: background-color 220ms var(--ease), color 220ms var(--ease); white-space: nowrap; }
.segmented button[aria-checked="true"] { background: #fff; color: var(--navy); }

.size-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.size-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.size-field label { font-size: 12px; color: rgba(255,255,255,.7); }
.size-field input {
  font: 20px/1.2 var(--font-mono); padding: 12px 14px; border-radius: 4px; width: 100%;
  border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.06); color: #fff;
}
.size-field input::placeholder { color: rgba(255,255,255,.3); }
.size-field input:focus { outline: 2px solid var(--yellow); outline-offset: 2px; }
.size-field input.invalid { border-color: #e2725f; }
.times { padding-bottom: 14px; color: rgba(255,255,255,.6); font-size: 18px; }
.size-error { font-size: 13px; color: #f3a597; }
.size-error:empty { display: none; }

.user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.18); padding-top: 20px; display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 1.4; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--lightblue); color: var(--navy); font: 700 12px var(--font-display); display: grid; place-items: center; flex: none; }
.avatar-sm { width: 30px; height: 30px; }
.user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name { color: rgba(255,255,255,.82); }
.user-company { color: rgba(255,255,255,.62); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .link-btn { color: rgba(255,255,255,.62); font-size: 12px; }
.user .link-btn:hover { color: var(--yellow); }

.results { padding: 36px 40px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.results h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.summary { font: 13px var(--font-mono); color: var(--smoke); margin-top: -12px; }
.cards { display: flex; flex-direction: column; gap: 18px; }
.card { border: 1px solid var(--smoke-200); border-radius: 4px; overflow: hidden; flex: none; }
.card-head { background: var(--offwhite); padding: 14px 20px; display: flex; align-items: baseline; gap: 12px; }
.card-head .code { font: 600 16px var(--font-mono); color: var(--navy); }
.card-head .name { font-size: 13px; color: var(--smoke); }
.card-body { display: grid; grid-template-columns: repeat(3, 1fr); }
.cell { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--smoke-200); min-width: 0; }
.cell:first-child { border-left: 0; }
.cell-frame { font: 600 12px var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--navy); }
.cell-label { font-size: 12px; color: var(--smoke-400); line-height: 1.3; }
.cell-value { font: 700 24px/1.2 var(--font-display); color: var(--navy); white-space: nowrap; }
.cell-value small { font-size: 14px; font-weight: 600; color: var(--smoke); }
.cell-value.bad { font-size: 15px; color: var(--danger); }
.extra { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; line-height: 1.4; border-top: 1px dashed var(--smoke-200); padding-top: 6px; }
.extra .v { font-family: var(--font-mono); color: var(--navy); white-space: nowrap; }
.extra .v.bad { color: var(--danger); }
.extras { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.empty { border: 1px dashed var(--smoke-200); border-radius: 4px; padding: 48px; text-align: center; color: var(--smoke-400); }

.expert { margin-top: auto; background: var(--lightblue-200); border-radius: 4px; padding: 20px 24px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.expert h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.expert p { font-size: 14px; color: var(--smoke-700); line-height: 1.5; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-email { max-width: 360px; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: 13px; color: var(--success); min-height: 1em; }
.status.err { color: var(--danger); }
.status:empty { display: none; }

/* ── Modal ── */
.modal { border: 0; padding: 0; border-radius: 8px; width: 560px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); box-shadow: 0 24px 48px rgba(5,2,39,.35); }
.modal::backdrop { background: rgba(9,4,70,.6); }
.modal-fields, .modal-done { padding: 24px 40px 36px; display: flex; flex-direction: column; gap: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.done-text { font-size: 15px; color: var(--smoke-700); }

/* ── Mobile (2d) ── */
@media (max-width: 900px) {
  .calc { display: flex; flex-direction: column; min-height: 100dvh; }
  .m-header { display: flex; position: sticky; top: 0; z-index: 2; height: 60px; padding: 0 20px; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--smoke-200); }
  .m-header img { height: 24px; width: auto; }
  .inputs { background: #fff; color: var(--navy); padding: 20px 20px 0; gap: 18px; }
  .inputs-top, .user, .toggle .desc, .toggle .tick { display: none; }
  .group-label { color: var(--navy); font-size: 13px; margin-bottom: 8px; }
  .toggles { flex-direction: row; gap: 10px; }
  .more-soon { color: var(--smoke-400); font-size: 12px; margin-top: 8px; }
  .beta-badge { top: 16px; right: 16px; font-size: 11px; }
  .toggle { min-height: 44px; border-radius: 999px; border: 1px solid var(--navy); background: #fff; color: var(--navy); justify-content: center; padding: 8px 20px; flex: 1; }
  .toggle .code { font-size: 14px; }
  .toggle[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
  .toggle:hover, .toggle[aria-pressed="true"]:hover { border-color: var(--navy); }
  .segmented { background: var(--offwhite); }
  .segmented button { min-height: 44px; color: var(--navy); }
  .segmented button[aria-checked="true"] { background: var(--navy); color: #fff; }
  .size-field label { color: var(--smoke); }
  .size-field input { font-size: 18px; color: var(--navy); border-color: var(--smoke-200); background: #fff; }
  .size-field input::placeholder { color: var(--smoke-200); }
  .times { color: var(--smoke-400); }
  .size-error { color: var(--danger); }
  .results { padding: 20px 20px 24px; gap: 18px; }
  .results h2 { font-size: 22px; }
  .expert, .results > .actions, .results > .status { display: none; }
  .card { border-color: var(--navy); }
  .card-head { background: var(--navy); }
  .card-head .code { color: #fff; }
  .card-head .name { color: rgba(255,255,255,.75); }
  .card-body { grid-template-columns: 1fr; }
  .cell { border-left: 0; border-top: 1px solid var(--smoke-200); display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; padding: 14px 16px; }
  .cell:first-child { border-top: 0; }
  .cell-frame { grid-column: 1; }
  .cell-label { grid-column: 1; }
  .cell-value { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 18px; }
  .cell-value small { font-size: 13px; }
  .extras { grid-column: 1 / -1; margin-top: 8px; }
  .m-footer { display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: 0; margin-top: auto; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--smoke-200); box-shadow: 0 -4px 16px rgba(9,4,70,.06); }
  .m-footer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}

@media (max-width: 640px) {
  .gate { display: block; padding: 0; background: #fff; min-height: 100dvh; }
  .gate-bg, .gate-wave { display: none; }
  .gate-brand { position: relative; top: auto; left: auto; overflow: hidden; background: var(--navy); min-height: 200px; padding: 28px 24px 32px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
  .gate-brand::after { content: ''; position: absolute; left: -40%; right: -40%; bottom: -6px; height: 90px; background: url(assets/img/wave-white.png) center / contain no-repeat; opacity: .16; pointer-events: none; }
  .gate-brand > * { position: relative; z-index: 1; }
  .gate-brand img { height: 64px; width: auto; align-self: flex-start; filter: none; }
  .gate-band-title { display: block; color: #fff; font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
  .gate-card { width: 100%; border-radius: 0; box-shadow: none; }
  .gate-card .gate-head { display: none; }
  .tabs { margin: 16px 24px 0; }
  .gate-form { padding: 24px; }
  .row-2 { grid-template-columns: 1fr; }
  .modal-fields, .modal-done, .modal .gate-head { padding-left: 24px; padding-right: 24px; }
  .modal .gate-head h1 { font-size: 22px; }
}

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