/* TempConvert — shared stylesheet. No external fonts or images. */
:root {
  --bg: #FAF9F5;
  --card: #FFFFFF;
  --border: #E8E6DC;
  --text: #1F1E1D;
  --muted: #6B6A64;
  --btn: #B5532F;
  --btn-hover: #9E4628;
  --link: #B5532F;
  --focus: #D97757;
  --code: #F0EEE6;
  --soft: #F5F3EC;
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --col: 720px;
  --accent-soft: #FBEEE8;
  --accent-text: #9E4628;
  --ghost-text: #B5532F;
  --border-strong: #D3D0C3;
  --sep: #B4B2A9;
  --st-low: #3D6A8A;
  --st-normal: #3F6B3A;
  --st-raised: #8A6A1F;
  --st-fever: #B5532F;
  --st-high: #8E2E16;
  --shadow: rgba(31, 30, 29, 0.03);
  color-scheme: light;
}
/* Dark theme: follows the system unless the visitor picked a theme with the header toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #262624;
  --card: #30302E;
  --border: #46453F;
  --text: #EDEBE4;
  --muted: #B3B0A6;
  --btn: #B5532F;
  --btn-hover: #9A4426;
  --link: #EB9878;
  --focus: #E08664;
  --code: #1E1D1B;
  --soft: #2D2D2B;
  --accent-soft: #46302A;
  --accent-text: #F2B49A;
  --ghost-text: #EB9878;
  --border-strong: #5A5850;
  --sep: #75736B;
  --st-low: #8DB7D6;
  --st-normal: #9CC795;
  --st-raised: #DDBA66;
  --st-fever: #EE9474;
  --st-high: #FF8E70;
  --shadow: rgba(0, 0, 0, 0.25);
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262624;
  --card: #30302E;
  --border: #46453F;
  --text: #EDEBE4;
  --muted: #B3B0A6;
  --btn: #B5532F;
  --btn-hover: #9A4426;
  --link: #EB9878;
  --focus: #E08664;
  --code: #1E1D1B;
  --soft: #2D2D2B;
  --accent-soft: #46302A;
  --accent-text: #F2B49A;
  --ghost-text: #EB9878;
  --border-strong: #5A5850;
  --sep: #75736B;
  --st-low: #8DB7D6;
  --st-normal: #9CC795;
  --st-raised: #DDBA66;
  --st-fever: #EE9474;
  --st-high: #FF8E70;
  --shadow: rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; color: var(--text); }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin: 0.4em 0 0.35em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); margin: 2em 0 0.5em; }
h3 { font-size: 1.15rem; margin: 1.5em 0 0.35em; }
p, ul, ol { margin: 0 0 1em; }
li { margin-bottom: 0.3em; }
.muted, .lede { color: var(--muted); }
.lede { font-size: 1.08rem; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 12px; top: 12px; background: var(--card); padding: 10px 14px; z-index: 50; border: 1px solid var(--border); border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-family: var(--serif); font-size: 1.3rem; font-weight: 600; min-height: 44px; }
.brand svg { width: 26px; height: 26px; flex: none; }
.header-tools { display: flex; align-items: center; gap: 8px; order: 3; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px; cursor: pointer; }
.theme-btn:hover { background: var(--soft); }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
.no-js .theme-btn { display: none; }
.menu-btn { display: none; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px; font: inherit; font-size: 0.95rem; cursor: pointer; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: nowrap; gap: 0; }
.site-nav li { margin: 0; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--muted); text-decoration: none; font-size: 0.92rem; border-radius: 10px; white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--soft); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
@media (max-width: 1120px) {
  .menu-btn { display: inline-flex; align-items: center; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--border); padding: 6px 12px 12px; }
  .site-nav.open { display: block; max-height: calc(100dvh - 60px); overflow-y: auto; overscroll-behavior: contain; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { width: 100%; font-size: 1rem; }
  .no-js .site-nav { display: block; position: static; border: 0; }
}

/* Layout */
main { max-width: var(--col); margin: 0 auto; padding: 8px 18px 48px; }
.breadcrumb { font-size: 0.88rem; color: var(--muted); margin: 18px 0 0; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "/"; margin: 0 6px 0 2px; color: var(--sep); }
.breadcrumb a { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 1.25em 0; box-shadow: 0 1px 2px var(--shadow); }
.note { background: var(--soft); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin: 1.25em 0; }
.note.warn { border-left: 4px solid var(--btn); }
.note p:last-child { margin-bottom: 0; }

/* Converter (chat-composer style) */
.converter { padding: 18px; }
.composer { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); padding: 6px 8px 6px 16px; }
.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.18); }
.composer input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.6rem; color: var(--text); padding: 8px 0; font-variant-numeric: tabular-nums; outline: none; }
.composer .unit-badge { font-family: var(--serif); font-size: 1.3rem; color: var(--muted); padding: 0 8px; }
.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pill-label { font-size: 0.85rem; color: var(--muted); min-width: 40px; }
.pill { min-height: 44px; min-width: 52px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 0.95rem; cursor: pointer; }
.pill:hover { border-color: var(--border-strong); background: var(--soft); }
.pill[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--link); color: var(--accent-text); font-weight: 600; }
.result-wrap { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.result { font-family: var(--serif); font-size: clamp(2rem, 6vw, 2.8rem); line-height: 1.15; display: block; font-variant-numeric: tabular-nums; word-break: break-word; }
.step { color: var(--muted); font-size: 0.95rem; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.also { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.also li { margin: 0; }
.warn-text { color: var(--accent-text); font-size: 0.92rem; margin: 6px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--btn); background: var(--btn); color: #fff; font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: #fff; }
.btn.ghost { background: var(--card); color: var(--ghost-text); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--link); font: inherit; font-size: 0.92rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { border-color: var(--link); background: var(--accent-soft); color: var(--accent-text); }
.oven-out { width: 100%; border-collapse: collapse; margin-top: 4px; font-variant-numeric: tabular-nums; }
.oven-out th, .oven-out td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.oven-out th { font-weight: 500; color: var(--muted); width: 38%; }
.oven-out td strong { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }

/* Grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 1em 0; padding: 0; list-style: none; }
.grid li { margin: 0; }
.grid a, .grid .tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--text); min-height: 44px; font-variant-numeric: tabular-nums; }
.grid a:hover { border-color: var(--link); }
.grid .big { font-family: var(--serif); font-size: 1.15rem; display: block; }
.grid .small { color: var(--muted); font-size: 0.85rem; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1em 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.96rem; }
table.data caption { text-align: left; padding: 12px 14px 4px; color: var(--muted); font-size: 0.9rem; caption-side: top; }
table.data th, table.data td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data.wrap td:last-child { white-space: normal; min-width: 15em; }
table.data thead th { font-weight: 600; font-size: 0.85rem; color: var(--muted); text-transform: none; }
table.data tbody tr:last-child td, table.data tbody tr:last-child th { border-bottom: 0; }
table.data tbody th { font-weight: 600; }
details.more { margin: -0.5em 0 1em; }
details.more > summary { cursor: pointer; color: var(--link); min-height: 44px; display: flex; align-items: center; font-weight: 600; list-style-position: inside; }
details.more[open] > summary { margin-bottom: 0.3em; }
.status-low { color: var(--st-low); }
.status-normal { color: var(--st-normal); }
.status-raised { color: var(--st-raised); }
.status-fever { color: var(--st-fever); font-weight: 600; }
.status-high { color: var(--st-high); font-weight: 700; }

/* Code */
pre, code { font-family: var(--mono); font-size: 0.9rem; }
code { background: var(--code); padding: 1px 6px; border-radius: 6px; }
.code-block { position: relative; margin: 0.6em 0 1.4em; }
.code-block pre { background: var(--code); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; padding-right: 92px; overflow-x: auto; margin: 0; line-height: 1.5; }
.code-block pre code { background: none; padding: 0; }
.code-block .copy-code { position: absolute; top: 6px; right: 6px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--ghost-text); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.code-block .copy-code:hover { background: var(--accent-soft); }
.formula { font-family: var(--serif); font-size: 1.35rem; text-align: center; padding: 14px; margin: 0.8em 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; font-variant-numeric: tabular-nums; }

/* Worksheet */
.worksheet ol { padding-left: 1.4em; }
.worksheet li { margin-bottom: 0.9em; }
.worksheet details > summary { cursor: pointer; color: var(--link); min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.answer-line { display: none; }

/* FAQ + related + footer */
.faq h3 { margin-top: 1.3em; }
.related ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.related li { margin: 0; }
.related a { display: flex; align-items: center; min-height: 44px; padding: 8px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; }
.related a:hover { border-color: var(--link); }
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 44px 24px 24px; background: var(--soft); color: var(--muted); font-size: 0.9rem; }
.footer-inner { max-width: 1080px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 48px; padding-bottom: 32px; }
.footer-intro .brand { color: var(--text); font-size: 1.6rem; gap: 12px; }
.footer-intro > p { margin: 8px 0; }
.footer-description { max-width: 30ch; }
.site-footer h2 { font-family: var(--sans); font-size: 0.9rem; margin: 10px 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0; }
.site-footer a { color: var(--muted); display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.site-footer a:hover { color: var(--link); text-decoration: underline; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px; border-top: 1px solid var(--border-strong); padding-top: 16px; }
.footer-bottom p { margin: 0; }
.footer-bottom ul { display: flex; flex-wrap: wrap; gap: 24px; }
.footer-disclaimer { font-size: 0.8rem; margin: 12px 0 0; }
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-intro { grid-column: 1 / -1; }
}
@media (max-width: 360px) {
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
  .composer input { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .pill, .chip, .btn, .related a, .grid a { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Print */
@media print {
  html:root:not(.x) {
    --bg: #FAF9F5;
    --card: #FFFFFF;
    --border: #E8E6DC;
    --text: #1F1E1D;
    --muted: #6B6A64;
    --btn: #B5532F;
    --btn-hover: #9E4628;
    --link: #C6613F;
    --focus: #D97757;
    --code: #F0EEE6;
    --soft: #F5F3EC;
    --accent-soft: #FBEEE8;
    --accent-text: #9E4628;
    --ghost-text: #B5532F;
    --border-strong: #D3D0C3;
    --sep: #B4B2A9;
    --st-low: #3D6A8A;
    --st-normal: #3F6B3A;
    --st-raised: #8A6A1F;
    --st-fever: #B5532F;
    --st-high: #8E2E16;
    --shadow: rgba(31, 30, 29, 0.03);
  color-scheme: light;
  }
  .theme-btn { display: none !important; }
  body { background: #fff; font-size: 11pt; color: #000; }
  .site-header, .site-footer, .breadcrumb, .converter, .related, .no-print, .actions, .chips, .copy-code { display: none !important; }
  main { max-width: none; padding: 0; }
  .table-wrap, .card { border: 0; box-shadow: none; overflow: visible; }
  table.data th, table.data td { padding: 4px 8px; border-bottom: 1px solid #ccc; }
  details.more > summary { display: none; }
  a { color: #000; text-decoration: none; }
  body.print-scope main > *:not(.print-target) { display: none !important; }
  body.print-scope .print-target { display: block !important; }
  .worksheet details { display: none; }
  .worksheet .answer-line { display: block; margin-top: 6px; }
  @page { margin: 15mm; }
  .print-target > h2:first-child { margin-top: 0; }
  .worksheet li { break-inside: avoid; }
  table.data thead { display: table-header-group; }
  table.data th, table.data td { white-space: normal; }
  h2, h3 { break-after: avoid; }
  tr { break-inside: avoid; }
}

button:disabled { opacity: 0.55; cursor: not-allowed; }
.composer:has(input[aria-invalid="true"]) { border-color: var(--accent-text); }

.result[data-message="true"] { font-family: var(--sans); font-size: 1rem; line-height: 1.6; }

.sign-btn { flex: none; min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; font-size: 1.25rem; cursor: pointer; }
.sign-btn:hover { background: var(--accent-soft); }
