/* Yard Ruler — https://yardruler.com/ */
/* Self-hosted fonts (latin, variable woff2) */
  @font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/inter-latin-var.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
  @font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500 800; font-display: swap; src: url('/fonts/manrope-latin-var.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

  :root {
    --bg: #ffffff;
    --bg-soft: #f7f5ef;
    --card: #ffffff;
    --text: #17181a;
    --text-muted: #676b6f;
    --text-faint: #686c6f;
    --border: #e4e4e1;
    --border-strong: #d4d5d1;
    --green: #1f3d2b;
    --green-dark: #162d20;
    --green-ink: #12261a;
    --green-soft: #f3efe4;
    --green-soft-border: #d9c9a8;
    --warn: #b45309;
    --warn-soft: #fef3e2;
    --danger: #b42323;
    --danger-soft: #fdeaea;
    --brass: #b08d57;
    --cream: #f3efe4;
    --on-green: #ffffff;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(20,20,20,0.04);
    color-scheme: light;
  }
  :root:not([data-theme="light"]) {
    @media (prefers-color-scheme: dark) {
      --bg: #10140f;
      --bg-soft: #171c15;
      --card: #171c15;
      --text: #edf0ec;
      --text-muted: #a3a89f;
      --text-faint: #8f958b;
      --border: #2b322a;
      --border-strong: #3a4238;
      --green: #c9a76f;
      --green-dark: #e0c79a;
      --green-ink: #f3efe4;
      --green-soft: rgba(176,141,87,0.14);
      --green-soft-border: rgba(176,141,87,0.40);
      --warn: #e0a458;
      --warn-soft: rgba(224,164,88,0.12);
      --danger: #e2726a;
      --danger-soft: rgba(226,114,106,0.12);
    --on-green: #12261a;
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --bg: #10140f;
    --bg-soft: #171c15;
    --card: #171c15;
    --text: #edf0ec;
    --text-muted: #a3a89f;
    --text-faint: #8f958b;
    --border: #2b322a;
    --border-strong: #3a4238;
    --green: #c9a76f;
    --green-dark: #e0c79a;
    --green-ink: #f3efe4;
    --green-soft: rgba(176,141,87,0.14);
    --green-soft-border: rgba(176,141,87,0.40);
    --warn: #e0a458;
    --warn-soft: rgba(224,164,88,0.12);
    --danger: #e2726a;
    --danger-soft: rgba(226,114,106,0.12);
    --on-green: #12261a;
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  html, body {
    height: 100%;
  }
  html {
    scroll-padding-top: env(safe-area-inset-top, 0px);
  }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  h1, h2, h3, .display {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text);
  }
  a { color: var(--green); text-decoration: none; }
  a:hover { text-decoration: underline; }
  button { font-family: inherit; }
  img { max-width: 100%; display: block; }
  :focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
  }
  @media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  }

  /* ---------- top bar ---------- */
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
  .brand { display: flex; align-items: center; gap: 12px; }
  .brand-mark {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--green);
    color: var(--on-green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; font-family: 'Manrope', sans-serif;
    flex-shrink: 0;
  }
  .brand-name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 17px; line-height: 1.15; }
  .brand-name .accent { color: var(--green); }
  .brand-sub { font-size: 10.5px; letter-spacing: 0.09em; color: var(--text-faint); font-weight: 600; margin-top: 2px; }
  .top-actions { display: flex; align-items: center; gap: 22px; font-size: 13.5px; font-weight: 600; }
  .top-actions .free-tag { color: var(--green); }
  .top-actions .priv-link { color: var(--text-muted); background: transparent; border: 0; padding: 0; font: inherit; cursor: pointer; }
  .top-actions .priv-link:hover { color: var(--text); }

  /* ---------- layout ---------- */
  .shell {
    display: grid;
    grid-template-columns: 240px minmax(0,1fr);
    max-width: 1220px;
    margin: 0 auto;
  }
  .sidebar {
    padding: 26px 20px 40px;
    border-right: 1px solid var(--border);
  }
  .ws-label {
    font-size: 11px; letter-spacing: 0.09em; color: var(--text-faint);
    font-weight: 700; margin: 0 0 12px 4px;
  }
  .nav-list { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 600; font-size: 13.6px;
    cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  }
  .nav-item:hover { background: var(--bg-soft); color: var(--text); }
  .nav-item.active { background: var(--green-soft); color: var(--green-ink); }
  .nav-item .ic { width: 17px; height: 17px; flex-shrink: 0; }
  .nav-item.active .ic { color: var(--green); }

  .ws-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 16px 18px;
    text-align: center;
    background: var(--bg-soft);
  }
  .ws-card img { width: 100%; max-width: 148px; margin: 0 auto 10px; }
  .ws-card h3 { font-size: 14px; margin-bottom: 4px; }
  .ws-card p { margin: 0; font-size: 12.2px; color: var(--text-faint); line-height: 1.5; }
  .oss-link { display: block; width: 100%; text-align: center; margin-top: 16px; font-size: 12px; font-weight: 600; background: transparent; border: 0; padding: 0; font-family: inherit; color: var(--green); cursor: pointer; }

  .main { padding: 34px 32px 10px; min-width: 0; }
  .tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
  .eyebrow { font-size: 11px; letter-spacing: 0.09em; font-weight: 700; color: var(--text-faint); margin-bottom: 10px; }
  .tool-head h1, .tool-head h2 { font-size: 30px; line-height: 1.15; max-width: 20ch; }
  .tool-head .sub { color: var(--text-muted); font-size: 14.5px; margin-top: 9px; max-width: 46ch; }
  .device-pill {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border-strong); border-radius: 999px;
    padding: 6px 13px; font-size: 12px; font-weight: 600; color: var(--text-muted);
    white-space: nowrap;
  }

  .calc-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: var(--shadow-card);
    padding: 26px;
    margin-bottom: 30px;
  }

  /* shape/mode subtabs */
  .subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
  .subtab {
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-muted);
    font-weight: 600; font-size: 13px;
    padding: 7px 14px; border-radius: 999px; cursor: pointer;
  }
  .subtab.active { background: var(--green); border-color: var(--green); color: var(--on-green); }

  .calc-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 30px; align-items: start; }
  @media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }

  .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 13px; }
  .field-row.single { grid-template-columns: 1fr; }
  .field label {
    display: block; font-size: 12px; font-weight: 700; color: var(--text-muted);
    margin-bottom: 5px;
  }
  .field input, .field select {
    width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--bg);
    color: var(--text); font-size: 14px; font-family: inherit;
  }
  .field input:focus, .field select:focus { border-color: var(--green); }
  .field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
  .unit-suffix { position: relative; }

  .chip-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 2px 0 14px; }
  .chip {
    border: 1px solid var(--border-strong); background: var(--bg);
    border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
  }
  .chip:hover { border-color: var(--green); color: var(--green); }

  .pull-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--green-soft); border: 1px solid var(--green-soft-border);
    color: var(--green-ink); font-size: 12px; font-weight: 700;
    padding: 6px 11px; border-radius: 999px; cursor: pointer; margin-bottom: 14px;
  }
  .pull-pill:hover { filter: brightness(0.97); }

  .side-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .side-row { display: grid; grid-template-columns: 24px 1fr 1fr 30px; gap: 8px; align-items: center; }
  .side-row .idx { font-size: 12px; font-weight: 700; color: var(--text-faint); text-align: center; }
  .side-row input { padding: 7px 9px; font-size: 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); width: 100%; }
  .row-remove {
    border: none; background: none; color: var(--text-faint); cursor: pointer;
    font-size: 16px; line-height: 1; width: 26px; height: 26px; border-radius: 6px;
  }
  .row-remove:hover { background: var(--danger-soft); color: var(--danger); }
  .add-side-btn {
    border: 1px dashed var(--border-strong); background: none; color: var(--text-muted);
    font-weight: 600; font-size: 13px; padding: 8px; border-radius: var(--radius-sm);
    cursor: pointer; width: 100%; margin-top: 2px;
  }
  .add-side-btn:hover { border-color: var(--green); color: var(--green); }

  .btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--green); color: var(--on-green); border: none;
    padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 13.5px;
    cursor: pointer;
  }
  .btn:hover { background: var(--green-dark); }
  .btn.ghost {
    background: none; border: 1px solid var(--border-strong); color: var(--text);
  }
  .btn.ghost:hover { border-color: var(--green); color: var(--green); }
  .btn.small { padding: 7px 13px; font-size: 12.5px; }

  /* results panel */
  .results {
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg-soft); padding: 18px 20px;
  }
  .results-figures { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 14px; }
  .fig .num { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 26px; color: var(--green-ink); line-height: 1.1; }
  .fig .lbl { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-top: 3px; }
  .results-note { font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
  .results-note strong { color: var(--text); }
  .flag {
    display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px;
    padding: 5px 10px; border-radius: 999px; margin-bottom: 10px;
  }
  .flag.ok { background: var(--green-soft); color: var(--green-ink); }
  .flag.warn { background: var(--warn-soft); color: var(--warn); }
  .flag.danger { background: var(--danger-soft); color: var(--danger); }

  svg.preview { width: 100%; height: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }

  .compare-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
  .compare-table th, .compare-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--border); }
  .compare-table th { color: var(--text-faint); font-weight: 700; font-size: 11px; letter-spacing: 0.03em; }
  .compare-table td.num { font-weight: 700; color: var(--text); }

  .yard-nudge {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: var(--green-soft); border: 1px solid var(--green-soft-border);
    border-radius: var(--radius-md); padding: 14px 18px; margin-top: 4px;
    font-size: 13px; color: var(--green-ink);
  }
  .yard-nudge strong { display: block; margin-bottom: 2px; font-size: 13.5px; }

  /* feature row */
  .feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin: 8px 0 46px; }
  @media (max-width: 760px) { .feature-row { grid-template-columns: 1fr; } }
  .feature .num-mark { font-size: 11px; font-weight: 700; color: var(--green); letter-spacing: 0.04em; margin-bottom: 8px; }
  .feature h3 { font-size: 15.5px; margin-bottom: 6px; }
  .feature p { margin: 0; font-size: 13px; color: var(--text-muted); }

  /* family section — ship classes in style.css (.tool-grid / .tool-card).
     Old .family-grid / .fam-card (5-col + mid breakpoints) removed. */

  /* footer */
  .site-footer { border-top: 1px solid var(--border); padding: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
  .site-footer .who b { display: block; font-size: 13.5px; }
  .site-footer .who span { font-size: 11.5px; color: var(--text-faint); }
  .site-footer .disclaimer { font-size: 11.5px; color: var(--text-faint); text-align: center; max-width: 40ch; }
  .coffee-btn {
    display: inline-flex; align-items: center; gap: 7px; background: var(--green); color: var(--on-green);
    padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 12.5px; border: none; cursor: pointer;
  }
  .footer-support { font-size: 10.8px; color: var(--text-faint); text-align: right; margin-top: 5px; }

  .footer-links { display: flex; flex-wrap: wrap; gap: 5px 16px; padding: 16px 0 6px; font-size: 11.8px; }
  .footer-links a, .footer-links button {
    color: var(--text-muted); background: transparent; border: 0; padding: 0;
    font: inherit; cursor: pointer; text-decoration: none;
  }
  .footer-links a:hover, .footer-links button:hover { color: var(--text); }
  .coffee-btn { text-decoration: none; color: var(--on-green); }
  .coffee-btn:hover { color: var(--on-green); filter: brightness(0.95); }
  .copyright { font-size: 11px; color: var(--text-faint); padding-bottom: 30px; }

  /* footer legal dialogs (PDF/Converter pattern) */
  dialog#modal {
    border: 1px solid var(--border); border-radius: 14px; padding: 28px 32px;
    width: 560px; max-width: calc(100% - 24px); color: var(--text);
    background: var(--card); box-shadow: 0 16px 48px rgba(20,20,20,0.18);
  }
  dialog#modal::backdrop { background: rgba(16, 39, 27, 0.72); }
  dialog#modal .close {
    float: right; padding: 5px 10px; border: 1px solid var(--border);
    background: var(--bg-soft); color: var(--text); border-radius: 8px;
    cursor: pointer; font-size: 16px; line-height: 1;
  }
  dialog#modal .close:hover { background: var(--border); }
  dialog#modal h2 { font-size: 22px; margin: 8px 0 12px; font-family: 'Manrope','Inter',sans-serif; }
  dialog#modal p, dialog#modal li { font-size: 14px; color: var(--text-muted); line-height: 1.55; }
  dialog#modal ul, dialog#modal ol { padding-left: 1.25em; margin: 0.6em 0; }
  dialog#modal a { color: var(--green); }

  .sponsor {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 22px 26px; margin: 4px 0 34px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    background: var(--bg-soft);
  }
  .sponsor .tag { font-size: 10.5px; letter-spacing: 0.08em; font-weight: 700; color: var(--text-faint); margin-bottom: 8px; }
  .sponsor h4 { font-size: 16.5px; margin-bottom: 5px; }
  .sponsor p { margin: 0; font-size: 12.8px; color: var(--text-muted); max-width: 44ch; }

  /* mobile sidebar */
  @media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
      border-right: none; border-bottom: 1px solid var(--border);
      padding: 16px 20px;
    }
    .nav-list { flex-direction: row; overflow-x: auto; gap: 6px; margin-bottom: 16px; padding-bottom: 4px; }
    .nav-item { white-space: nowrap; flex-shrink: 0; }
    .ws-card { display: none; }
    .oss-link { display: none; }
    .main { padding: 26px 18px 10px; }
    .topbar { padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  }

  .tool-panel { display: none; }
  .tool-panel.active { display: block; }
  /* FAQ */
  .faq { padding: 28px 0 8px; }
  .faq h2 { font-size: 24px; margin-bottom: 14px; }
  .faq details { border-top: 1px solid var(--border); padding: 12px 0; }
  .faq summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
  .faq details p { color: var(--text-muted); font-size: 13.5px; margin-top: 8px; max-width: 70ch; }
  .ys-context { margin-top: 8px; }
  .ys-context a { color: inherit; text-decoration: underline; }

/* P0 footer trust badge — USA-only (2026-09-26) */
/* USA-only footer trust badge. */
.ms-site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
}
.ms-trust-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ms-trust-badges li { margin: 0; padding: 0; line-height: 0; }
.ms-trust-badges img {
  display: block;
  height: 56px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: transparent;
}
.ms-site-footer--light { background: #f7f5ef; color: #2a2a2a; }
.ms-site-footer--dark { background: #121412; color: #e8e8e8; }
.ms-site-footer .ms-copyright { margin: 0; font-size: 0.8rem; line-height: 1.4; opacity: 0.85; }
@media (max-width: 420px) {
  .ms-trust-badges { gap: 1rem; }
  .ms-trust-badges img { height: 48px; }
}


/* ---- Yard Ruler additions (replaces inline style= attributes) ---- */
.js-hide { display: none; }
.hint-tight { margin-top: -6px; }
.hint-gap { margin-bottom: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.content { max-width: 74ch; padding: 10px 0 8px; }
.content h2 { font-size: 22px; margin: 26px 0 10px; }
.content p, .content li { font-size: 14.5px; color: var(--text-muted); }
.content ol, .content ul { padding-left: 1.3em; }
.content li { margin-bottom: 6px; }
.related { border-top: 1px solid var(--border); padding: 22px 0 10px; margin-top: 18px; }
.related h2 { font-size: 18px; margin-bottom: 10px; }
.related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-weight: 600; font-size: 14px; }
.calc-links { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-direction: column; gap: 6px; font-size: 13.4px; font-weight: 600; }
.brand-logo { display: block; line-height: 0; }
.brand-logo img { height: 40px; width: auto; }
.sidebar .nav-item { white-space: nowrap; letter-spacing: -0.005em; }
.ws-card img, .mascot-inline { height: auto; }
.tagline { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 3px; letter-spacing: 0.01em; }
.brand a:hover { text-decoration: none; }
.page-wrap { max-width: 1000px; margin: 0 auto; padding: 30px 28px 10px; }
.mascot-inline { max-width: 150px; margin: 0 0 14px; }
.credit { font-size: 11px; color: var(--text-faint); }
.credit a { color: var(--text-muted); }
/* YR-O15-03: no horizontal overflow on small screens */
html, body { overflow-x: hidden; }
.shell > * { min-width: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; max-width: 100%; }
  .nav-list { max-width: 100%; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .top-actions { gap: 14px; }
  .page-wrap { padding: 20px 0 10px; }
  .calc-card { padding: 18px; }
  .field-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .compare-table { table-layout: fixed; }
  .footer-support { text-align: left; }
}
@media (max-width: 420px) {
  .field-row { grid-template-columns: minmax(0,1fr); }
  .side-row { grid-template-columns: 20px minmax(0,1fr) minmax(0,1fr) 26px; }
  .tool-head h1, .tool-head h2 { font-size: 25px; }
  .brand-logo img { height: 34px; }
}
