/* ==========================================================
   Health article styles - used by health/*.htm
   Builds on the variables defined in kitchen-design.css
   ========================================================== */

/* Page headline (sits directly under <header>) */
body > h1 {
    max-width: 860px;
    margin: 2rem auto 0.75rem;
    padding: 0 20px;
    color: var(--primary);
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    line-height: 1.25;
}

/* Article card */
.cssNote {
    max-width: 820px;
    margin: 1rem auto 2.5rem;
    padding: 2rem 2.25rem;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 1.05rem;
    line-height: 1.75;
}
.cssNote::after { content: ""; display: table; clear: both; }

.cssNote h2 {
    clear: both;
    color: var(--secondary);
    font-size: 1.35rem;
    line-height: 1.35;
    margin: 2.25rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--light-gray);
}
.cssNote h3 { color: var(--primary); font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.cssNote p { margin: 0 0 1rem; }
.cssNote ul, .cssNote ol { margin: 0 0 1.25rem 1.5rem; }
.cssNote li { margin-bottom: 0.4rem; }
.cssNote a { color: var(--secondary-light); }
.cssNote a:hover { color: var(--primary); }
.cssNote img { max-width: 100%; height: auto; border-radius: var(--radius); }

.article-meta {
    color: var(--gray);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
}
.article-meta i { margin-right: 0.3rem; }

.lead { font-size: 1.15rem; color: #333; }

/* Images */
.floatRight { float: right; margin: 0.25rem 0 1rem 1.5rem; max-width: 45%; }
.floatLeft  { float: left;  margin: 0.25rem 1.5rem 1rem 0; max-width: 45%; }
.circle-img { width: 220px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 50% !important; }
.cssNote figure { margin: 0 0 1.5rem; text-align: center; }
.cssNote figcaption { font-size: 0.85rem; color: var(--gray); margin-top: 0.4rem; }
/* Floated figures: keep the float's side margin (the figure rule above would otherwise zero it) */
.cssNote figure.floatRight { margin: 0.25rem 0 1rem 1.5rem; }
.cssNote figure.floatLeft  { margin: 0.25rem 1.5rem 1rem 0; }

/* Call-out boxes */
.key-points, .tip-box, .warning-box {
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.key-points  { background: #fbf1f1; border-left: 4px solid var(--primary); }
.tip-box     { background: #eef2fb; border-left: 4px solid var(--secondary); }
.warning-box { background: #fff7e0; border-left: 4px solid #c98a00; }
.key-points h2, .tip-box h2, .warning-box h2 {
    border: none; margin: 0 0 0.5rem; padding: 0; font-size: 1.1rem;
}
.key-points h2  { color: var(--primary); }
.tip-box h2     { color: var(--secondary); }
.warning-box h2 { color: #8a5d00; }
.key-points ul, .tip-box ul, .warning-box ul,
.key-points ol, .tip-box ol, .warning-box ol { margin-bottom: 0; }
.key-points p:last-child, .tip-box p:last-child, .warning-box p:last-child { margin-bottom: 0; }

/* Number tiles */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 0.5rem 0 1.5rem;
}
.stat {
    background: var(--light);
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
}
.stat strong { display: block; font-size: 1.75rem; color: var(--primary); margin-bottom: 0.25rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--light-gray);
    text-align: left;
    vertical-align: top;
}
.data-table th { background: var(--light); color: var(--secondary); }
.data-table td.num, .data-table th.num { text-align: right; white-space: nowrap; }

/* Sources, related links, disclaimer */
.sources, .related {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
    font-size: 0.92rem;
}
.sources h2, .related h2 { border: none; font-size: 1.05rem; margin: 0 0 0.5rem; padding: 0; }
.sources ol { margin-left: 1.25rem; }
.related ul { list-style: none; margin-left: 0; }
.related li::before { content: "\203A"; color: var(--primary); font-weight: bold; margin-right: 0.5rem; }

.disclaimer {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--light);
    border-radius: var(--radius);
    color: var(--gray);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Responsive video */
.video-wrap { max-width: 820px; margin: 1rem auto; padding: 0 20px; }
.video-wrap .ratio { position: relative; aspect-ratio: 16 / 9; }
.video-wrap iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
}
.video-wrap .ratio + .ratio, .video-wrap p + .ratio { margin-top: 1rem; }
.video-wrap > p { text-align: center; color: var(--gray); font-size: 0.95rem; margin: 0.6rem 0 1.25rem; }
.video-wrap > div[style] { margin: 0 auto; } /* old fixed-width image boxes */

/* Keep the fixed-width ad from forcing horizontal scroll */
ins.adsbygoogle { max-width: 100%; }

/* ---------- Section index (health/index.htm) ---------- */
.mega-menu { max-width: 1100px; margin: 1rem auto 2.5rem; padding: 0 20px; }
.mega-intro { text-align: center; color: var(--gray); max-width: 680px; margin: 0 auto 1.5rem; }
.search-container { position: relative; max-width: 480px; margin: 0 auto 2rem; }
.search-container input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid #ccc;
    border-radius: 50px;
    font-size: 1rem;
    background: #fff;
}
.search-container input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.12); }
.search-container i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--gray); }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.category {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
}
.category h3 { color: var(--secondary); font-size: 1.1rem; margin-bottom: 0.75rem; }
.category h3 i { color: var(--primary); margin-right: 0.4rem; }
.category ul { list-style: none; }
.category li { padding: 0.6rem 0; border-bottom: 1px dashed var(--light-gray); }
.category li:last-child { border-bottom: none; }
.category a { color: var(--dark); text-decoration: none; font-weight: 600; }
.category a:hover { color: var(--primary); }
.category li small { display: block; color: var(--gray); font-size: 0.86rem; line-height: 1.45; margin-top: 0.15rem; }
.no-results { display: none; text-align: center; color: var(--gray); margin-top: 1.5rem; }

@media (max-width: 640px) {
    .cssNote { margin: 1rem 10px 2rem; padding: 1.25rem 1.1rem; font-size: 1rem; }
    .floatRight, .floatLeft { float: none; display: block; max-width: 100%; margin: 0 auto 1rem; }
    .cssNote figure.floatRight, .cssNote figure.floatLeft { margin: 0 auto 1rem; }
}

/* ---------- Chinese pages (zh/*) ---------- */
html:lang(zh-TW) body > h1,
html:lang(zh-TW) .cssNote {
    font-family: 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', sans-serif;
}
html:lang(zh-TW) .cssNote { line-height: 1.9; letter-spacing: 0.02em; }
html:lang(zh-TW) .cssNote p { text-align: justify; }

/* Caption under a video */
.video-note {
    max-width: 820px;
    margin: 0 auto 0.5rem;
    padding: 0 20px;
    color: var(--gray);
    font-size: 0.95rem;
    text-align: center;
}
.video-note p { margin: 0.25rem 0; }

/* Pull quote */
.cssNote blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--primary-light);
    background: var(--light);
    font-size: 1.1rem;
    color: #333;
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* Amsler grid self-test */
.amsler { display: block; width: 100%; max-width: 320px; margin: 0.5rem auto 1rem; background: #fff; }

/* Link to the other language version */
.lang-switch { text-align: right; font-size: 0.88rem; margin-bottom: 0.5rem; }

/* Text tiles: same grid as .stat-grid, with smaller headings */
.stat-grid.cards .stat { text-align: left; font-size: 0.95rem; }
.stat-grid.cards .stat strong { font-size: 1.05rem; color: var(--secondary); margin-bottom: 0.4rem; }

/* ---------- Interactive tool panel (e.g. sleep planner) ---------- */
.tool-panel {
    margin: 0 0 1.75rem;
    padding: 1.25rem 1.4rem 1.4rem;
    background: var(--light);
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
}
.cssNote .tool-panel h2 { margin-top: 0; border: none; padding: 0; color: var(--primary); }
.tool-panel h2 i { margin-right: 0.35rem; }
.tool-panel .tool-intro { font-size: 0.95rem; color: #444; }
.tool-inputs { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; margin: 0 0 1.25rem; }
.tool-inputs label { display: flex; flex-direction: column; font-size: 0.85rem; font-weight: 600; color: var(--secondary); gap: 0.3rem; }
.tool-inputs input, .tool-inputs select {
    font: inherit; font-size: 1.05rem; font-weight: normal;
    padding: 0.45rem 0.6rem; min-height: 2.6rem;
    border: 1px solid #bbb; border-radius: 8px; background: #fff; color: #222;
}
.tool-inputs input:focus, .tool-inputs select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.12); }
.cssNote .tool-panel h3 { margin: 0.25rem 0 0.6rem; font-size: 1rem; color: var(--secondary); }
.bedtime-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 0 0 1.25rem; }
.bedtime-option {
    font: inherit; text-align: center; cursor: pointer;
    padding: 0.75rem 0.5rem; line-height: 1.35;
    background: #fff; color: #333;
    border: 2px solid var(--light-gray); border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.bedtime-option strong { display: block; font-size: 1.45rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.bedtime-option small { display: block; color: var(--gray); font-size: 0.8rem; }
.bedtime-option .badge {
    display: inline-block; margin-top: 0.3rem; padding: 0.05rem 0.5rem;
    border-radius: 50px; font-size: 0.72rem; font-weight: 600;
    background: #eef2fb; color: var(--secondary);
}
.bedtime-option .badge.short { background: #fff7e0; color: #8a5d00; }
.bedtime-option:hover { border-color: var(--secondary-light); }
.bedtime-option:focus-visible { outline: 3px solid rgba(128, 0, 0, 0.3); outline-offset: 2px; }
.bedtime-option[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.12); }
.timeline { list-style: none; margin: 0 0 1rem !important; padding: 0; border-left: 3px solid var(--light-gray); }
.timeline li { position: relative; display: flex; gap: 1rem; margin: 0 !important; padding: 0.45rem 0 0.45rem 1.1rem; }
.timeline li::before {
    content: ""; position: absolute; left: -7px; top: 0.95rem;
    width: 11px; height: 11px; border-radius: 50%;
    background: #fff; border: 2px solid var(--secondary-light);
}
.timeline li.is-bedtime::before { background: var(--primary); border-color: var(--primary); }
.timeline time { flex: 0 0 5.5rem; font-weight: 700; color: var(--secondary); font-variant-numeric: tabular-nums; }
.timeline li.is-bedtime time, .timeline li.is-bedtime span { color: var(--primary); font-weight: 700; }
.timeline span { flex: 1; font-size: 0.97rem; line-height: 1.5; }
.tool-note { font-size: 0.85rem; color: var(--gray); margin: 0 !important; }
.tool-button {
    font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.6rem 1.1rem; min-height: 2.6rem;
    background: var(--secondary); color: #fff;
    border: none; border-radius: 50px;
}
.tool-button:hover { background: var(--primary); }
.tool-button:focus-visible { outline: 3px solid rgba(128, 0, 0, 0.3); outline-offset: 2px; }
@media (max-width: 640px) {
    .tool-panel { padding: 1rem; }
    .timeline time { flex-basis: 4.75rem; }
}

/* Evidence verdict labels (fact-check articles) */
.verdict {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.6;
}
.verdict i { margin-right: 0.25rem; }
.verdict.good  { background: #e6f4ea; color: #1e6b34; }
.verdict.mixed { background: #fff7e0; color: #8a5d00; }
.verdict.bad   { background: #fbe9e9; color: #9b1c1c; }
.claim { margin: 0 0 1.75rem; }
.cssNote .claim h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 1.5rem; }
.claim .original {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.9rem;
    border-left: 3px solid var(--light-gray);
    color: #555;
    font-style: italic;
    font-size: 0.97rem;
}
