/* ==========================================================================
   Vita Nova Charting — design system
   A warm, soft, friendly palette for a calm and trustworthy feel.
   ========================================================================== */

:root {
    /* Palette */
    --rose-50:  #fff5f7;
    --rose-100: #ffe9ee;
    --rose-200: #ffd3dd;
    --rose-300: #ffb3c4;
    --rose-400: #f78fa7;
    --rose-500: #e86d8c;
    --rose-600: #d14f72;

    --plum-100: #f3ecf7;
    --plum-300: #d8bfe0;
    --plum-500: #9b6aa8;

    --cream:    #fffaf4;
    --ink:      #43383f;       /* warm near-black for text */
    --ink-soft: #6e6470;
    --line:     #efe3e8;

    /* Sticker colors */
    --sticker-red:    #e63946;
    --sticker-green:  #5bbf73;
    --sticker-white:  #ffffff;
    --sticker-yellow: #f4c542;

    /* UI tokens */
    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 22px;
    --shadow-sm: 0 2px 8px rgba(209, 79, 114, 0.08);
    --shadow:    0 8px 30px rgba(209, 79, 114, 0.12);
    --shadow-lg: 0 18px 50px rgba(209, 79, 114, 0.18);

    --font-head: 'Fraunces', Georgia, serif;
    --font-body: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;

    --maxw: 1080px;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;  /* stop iOS from re-zooming text on rotate */
    text-size-adjust: 100%;
}

button, a, .day-cell, .chip, .seg { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }  /* no 300ms tap delay / double-tap zoom */

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 100% -10%, var(--rose-100), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, var(--plum-100), transparent 55%),
        var(--cream);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.15;
    margin: 0 0 0.5em;
}

a { color: var(--rose-600); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
    background: var(--rose-100);
    color: var(--rose-600);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.88em;
}

.muted { color: var(--ink-soft); }
.small { font-size: 0.86rem; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 22px;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--rose-400), var(--rose-500));
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: #fff; }

.btn-outline {
    background: #fff;
    border-color: var(--rose-300);
    color: var(--rose-600);
}
.btn-outline:hover { background: var(--rose-50); transform: translateY(-2px); }

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: transparent;
}
.btn-ghost:hover { background: rgba(0,0,0,0.04); color: var(--ink); }

.btn-sm { padding: 8px 16px; font-size: 0.9rem; }
.btn-lg { padding: 15px 30px; font-size: 1.08rem; }
.btn-block { width: 100%; }

.link-btn {
    background: none; border: none; color: var(--rose-600);
    cursor: pointer; font: inherit; text-decoration: underline; padding: 8px 0;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 18px 24px;
}
.logo {
    font-family: var(--font-head);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo-mark { filter: saturate(1.1); }

.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a { color: var(--ink-soft); font-weight: 600; }
.site-nav a:hover { color: var(--rose-600); text-decoration: none; }
.site-nav .btn { color: #fff; }
.site-nav .btn:hover { color: #fff; }
.site-nav .btn-outline { color: var(--rose-600); }
.site-nav .btn-outline:hover { color: var(--rose-600); }

/* Hamburger toggle — hidden on desktop, shown on mobile via media query */
.nav-toggle {
    display: none;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 11px;
    background: transparent; border: none; cursor: pointer; border-radius: 12px;
}
.nav-toggle:hover { background: rgba(0, 0, 0, 0.04); }
.nav-toggle span {
    display: block; width: 100%; height: 2.5px;
    background: var(--ink); border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.18s ease;
}
.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    max-width: var(--maxw);
    margin: 20px auto 0;
    padding: 40px 24px 70px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 50px;
    align-items: center;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--rose-500);
    margin: 0 0 14px;
}
.hero h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); margin-bottom: 18px; }
.lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 36ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 28px 0 14px; }
.hero-note { font-size: 0.9rem; color: var(--ink-soft); }

.hero-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 26px;
    transform: rotate(-1.5deg);
}
.mini-strip { display: flex; gap: 8px; justify-content: space-between; }
.mini-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mini-day b { font-size: 0.8rem; color: var(--ink-soft); font-weight: 700; }
.mini-caption { text-align: center; color: var(--ink-soft); font-size: 0.9rem; margin: 18px 0 0; }

/* ==========================================================================
   Quote band (rotating reflections)
   ========================================================================== */
.quote-band {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 28px 24px 48px;
    text-align: center;
}
.quote {
    margin: 0 auto;
    max-width: 720px;
    background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(255,245,247,0.85));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 30px 32px 26px;
    position: relative;
}
.quote::before {
    content: '\201C';
    font-family: var(--font-head);
    font-size: 3.4rem;
    line-height: 0;
    color: var(--rose-300);
    position: absolute;
    top: 26px; left: 18px;
}
.quote blockquote {
    margin: 0 0 12px;
    font-family: var(--font-head);
    font-size: clamp(1.1rem, 2.4vw, 1.5rem);
    font-weight: 500;
    color: var(--ink);
    line-height: 1.4;
    transition: opacity 0.28s ease, transform 0.28s ease;
}
.quote figcaption {
    color: var(--rose-600);
    font-weight: 700;
    font-size: 0.92rem;
    transition: opacity 0.28s ease;
}
.quote figcaption cite { font-style: italic; }
.quote.is-fading blockquote, .quote.is-fading figcaption { opacity: 0; transform: translateY(6px); }
.quote-dots { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.quote-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--rose-200); cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.quote-dot:hover { background: var(--rose-300); }
.quote-dot.active { background: var(--rose-500); transform: scale(1.25); }

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 64px 24px;
}
.section-alt {
    max-width: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,245,247,0.7));
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.section-alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section-title { font-size: clamp(1.7rem, 3vw, 2.3rem); text-align: center; }
.section-lede {
    text-align: center;
    color: var(--ink-soft);
    font-size: 1.1rem;
    max-width: 64ch;
    margin: 0 auto 40px;
}

/* Info cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.info-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.info-icon { font-size: 2.2rem; display: block; margin-bottom: 12px; }
.info-card h3 { font-size: 1.25rem; }
.info-card p { color: var(--ink-soft); margin: 0; }

/* Steps */
.steps { list-style: none; counter-reset: step; padding: 0; max-width: 760px; margin: 0 auto; display: grid; gap: 22px; }
.steps li { display: flex; gap: 20px; align-items: flex-start; background: #fff; padding: 22px 24px; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.step-num {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--rose-300), var(--rose-500));
    color: #fff; font-weight: 800; font-family: var(--font-head);
    border-radius: 50%;
}
.steps h3 { font-size: 1.2rem; margin-bottom: 4px; }
.steps p { color: var(--ink-soft); margin: 0; }

/* Benefits */
.benefit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.benefit { display: flex; gap: 14px; background: #fff; padding: 22px; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.benefit > span { font-size: 1.7rem; line-height: 1; }
.benefit strong { display: block; margin-bottom: 4px; font-size: 1.05rem; }
.benefit p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

/* Rules */
.rule-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.rule-block h2 { font-size: 1.4rem; }
.rule-block h3 { font-size: 1.3rem; }
.rule-list { margin: 0; padding-left: 1.2em; }
.rule-list li { margin-bottom: 10px; color: var(--ink-soft); }
.rule-list li strong { color: var(--ink); }
.rule-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.code-table { width: 100%; border-collapse: collapse; }
.code-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.code-table td:first-child { white-space: nowrap; width: 38%; }
.code-table tr:last-child td { border-bottom: none; }
.disclaimer { font-size: 0.85rem; color: var(--ink-soft); max-width: 70ch; margin: 8px auto 0; text-align: center; font-style: italic; }

/* CTA */
.cta { text-align: center; padding: 70px 24px 90px; }
.cta h2 { font-size: 2rem; }
.cta p { color: var(--ink-soft); margin-bottom: 24px; }

/* Footer */
.site-footer { text-align: center; padding: 40px 24px; border-top: 1px solid var(--line); color: var(--ink-soft); }
.site-footer p { margin: 4px 0; }
.site-footer .logo-mark { margin-right: 6px; }

/* ==========================================================================
   Stickers
   ========================================================================== */
.sticker {
    --size: 34px;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 auto;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.12);
    font-size: calc(var(--size) * 0.5);
    line-height: 1;
    border: 2px solid rgba(0,0,0,0.06);
}
.sticker-red    { background: var(--sticker-red); }
.sticker-green  { background: var(--sticker-green); }
.sticker-white-baby { background: var(--sticker-white); border-color: #e2d7dc; }
.sticker-green-baby { background: var(--sticker-green); }
.sticker-yellow, .sticker-yellow-baby { background: var(--sticker-yellow); }
.sticker-none {
    background: repeating-linear-gradient(45deg, #f6eef1, #f6eef1 5px, #fbf4f6 5px, #fbf4f6 10px);
    border-style: dashed;
    border-color: #e2d2d8;
    box-shadow: none;
}
.sticker-baby { font-size: 0.95em; }
.sticker-count {
    position: absolute;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: calc(var(--size) * 0.34);
    color: var(--ink);
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    width: 1.45em; height: 1.45em;
    display: grid; place-items: center;
    right: -6px; top: -6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sticker-white-baby .sticker-count { background: var(--rose-500); color: #fff; }
.sticker-lg { --size: 56px; }

.badge-peak {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--rose-500); color: #fff;
    font-family: var(--font-head); font-weight: 700;
    flex: 0 0 auto;
}

/* Legend */
.legend-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; }
.legend-grid.wide { grid-template-columns: repeat(2, 1fr); }
.legend-item { display: flex; align-items: center; gap: 12px; }
.legend-item span:last-child { font-size: 0.95rem; }

/* ==========================================================================
   Chart page
   ========================================================================== */
.app-page { background-attachment: fixed; }
.chart-page { max-width: var(--maxw); margin: 0 auto; padding: 10px 24px 80px; }

.cycle-bar {
    display: flex; flex-wrap: wrap; gap: 10px 16px;
    align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px 16px;
    box-shadow: var(--shadow-sm); position: relative;
}
.cycle-bar-left { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.cycle-bar-right { display: flex; align-items: center; gap: 8px; position: relative; }
.field-inline { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ink-soft); font-size: 0.85rem; }
.field-inline select, .field-inline input,
.cycle-bar input[type="date"] {
    font: inherit; font-weight: 600; color: var(--ink);
    border: 1px solid var(--rose-200); border-radius: var(--radius-sm);
    padding: 6px 8px; background: var(--rose-50);
}

.menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 6px; min-width: 200px; z-index: 30;
}
.menu button {
    display: block; width: 100%; text-align: left;
    background: none; border: none; font: inherit; cursor: pointer;
    padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink);
}
.menu button:hover { background: var(--rose-50); }
.menu button.danger { color: var(--sticker-red); }

/* Summary */
.cycle-summary { display: flex; gap: 16px; flex-wrap: wrap; margin: 18px 0; }
.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 22px; box-shadow: var(--shadow-sm); flex: 1; min-width: 150px; text-align: center;
}
.stat-value { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--rose-600); }
.stat-label { font-size: 0.82rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }

/* Chart strip */
.chart-scroll {
    overflow-x: auto;
    padding: 8px 4px 16px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}
.chart-strip { display: flex; gap: 8px; padding: 10px; min-width: min-content; }
.day-cell {
    flex: 0 0 auto;
    width: 76px; min-height: 116px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 10px 6px;
    cursor: pointer;
    font: inherit; color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    position: relative;
}
.day-cell:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--rose-300); }
.day-cell.day-empty { background: #fff; }
.day-num { font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); display: flex; align-items: baseline; gap: 4px; }
.day-date { font-weight: 600; font-size: 0.68rem; color: var(--rose-400); }
.day-code {
    font-size: 0.74rem; font-weight: 700; color: var(--ink);
    text-align: center; word-break: break-word; min-height: 1em;
    margin-top: auto;
}
.day-i {
    position: absolute; bottom: 4px; right: 6px;
    font-size: 0.6rem; font-weight: 800; color: var(--plum-500);
}
.day-cell.has-intercourse { border-color: var(--plum-300); }

/* Per-day guidance accent (top bar) */
.day-cell .day-guide {
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm);
}
.day-cell[data-guide="fertile"]   .day-guide { background: var(--sticker-red); }
.day-cell[data-guide="available"] .day-guide { background: var(--sticker-green); }
.day-cell[data-guide="best"]      .day-guide { background: var(--sticker-yellow); }
.day-cell[data-guide="good"]      .day-guide { background: #8fd3a0; }
.day-cell[data-guide="wait"]      .day-guide { background: var(--plum-300); }

/* ==========================================================================
   Goal toggle (toolbar) + intercourse guidance
   ========================================================================== */
/* A small, low-key segmented control; only the active option picks up a tint. */
.goal-toggle.goal-avoid .seg.active { color: var(--sticker-red); }
.goal-toggle.goal-conceive .seg.active { color: #2f9e54; }

/* Guidance panel inside the entry modal */
.guidance {
    display: flex; gap: 14px; align-items: flex-start;
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px;
    border: 1px solid var(--line); background: #fff;
}
.guidance-icon { font-size: 1.5rem; line-height: 1.2; flex: 0 0 auto; }
.guidance-text { display: flex; flex-direction: column; gap: 2px; }
.guidance-text strong { font-family: var(--font-head); font-size: 1.1rem; }
.guidance-text > span { font-size: 0.9rem; color: var(--ink-soft); }
.guidance-note { font-size: 0.74rem !important; font-style: italic; opacity: 0.8; margin-top: 4px; }
.guidance.guide-fertile   { background: #fdedef; border-color: #f5b8c1; }
.guidance.guide-fertile   strong { color: var(--sticker-red); }
.guidance.guide-available { background: #ecf8f0; border-color: #a7dbb6; }
.guidance.guide-available strong { color: #2f9e54; }
.guidance.guide-best      { background: #fff7e3; border-color: #f3d886; }
.guidance.guide-best      strong { color: #c8941b; }
.guidance.guide-good      { background: #eef8f1; border-color: #b9e2c5; }
.guidance.guide-good      strong { color: #38a05c; }
.guidance.guide-wait      { background: var(--plum-100); border-color: var(--plum-300); }
.guidance.guide-wait      strong { color: var(--plum-500); }

/* Legend section on chart page */
.legend { margin-top: 26px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.legend-title { font-size: 1.2rem; margin-bottom: 16px; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(67, 56, 63, 0.45);
    backdrop-filter: blur(3px);
    display: grid; place-items: center;
    padding: 20px;
    animation: fade 0.18s ease;
}
.modal {
    background: var(--cream);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    padding: 28px;
    position: relative;
    animation: pop 0.2s cubic-bezier(0.18, 0.9, 0.34, 1.2);
}
.modal-narrow { max-width: 400px; }
.modal-close {
    position: absolute; top: 14px; right: 16px;
    background: none; border: none; font-size: 1.7rem; line-height: 1;
    color: var(--ink-soft); cursor: pointer; border-radius: 50%;
    width: 36px; height: 36px;
}
.modal-close:hover { background: rgba(0,0,0,0.06); color: var(--ink); }
.modal-title { font-size: 1.6rem; margin-bottom: 16px; }
body.modal-open { overflow: hidden; }

.entry-preview {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
}
.preview-code { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; color: var(--rose-600); }
.preview-interp { color: var(--ink-soft); font-size: 0.92rem; }

.entry-section { margin-bottom: 20px; }
.entry-label { font-size: 0.95rem; font-weight: 800; margin-bottom: 10px; color: var(--ink); font-family: var(--font-body); }
.entry-hint { font-weight: 600; color: var(--ink-soft); font-size: 0.82rem; }

/* Segmented control */
.seg-control { display: flex; background: var(--rose-100); border-radius: 999px; padding: 4px; gap: 4px; }
.seg {
    flex: 1; border: none; background: none; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--ink-soft);
    padding: 10px 8px; border-radius: 999px; transition: all 0.15s ease;
    font-size: 0.92rem;
}
.seg.active { background: #fff; color: var(--rose-600); box-shadow: var(--shadow-sm); }

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-col { flex-direction: column; }
.chip {
    border: 1.5px solid var(--rose-200);
    background: #fff; color: var(--ink);
    border-radius: 999px; padding: 8px 14px;
    cursor: pointer; font: inherit; font-size: 0.9rem; font-weight: 600;
    transition: all 0.13s ease; text-align: left;
}
.chip-col .chip { border-radius: var(--radius-sm); }
.chip:hover { border-color: var(--rose-400); background: var(--rose-50); }
.chip.selected {
    background: linear-gradient(135deg, var(--rose-400), var(--rose-500));
    border-color: var(--rose-500); color: #fff;
}
.chip.selected strong { color: #fff; }
.chip strong { color: var(--rose-600); }

.entry-toggles { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--rose-500); }

textarea, #notes-input {
    width: 100%; font: inherit; padding: 10px 12px;
    border: 1.5px solid var(--rose-200); border-radius: var(--radius-sm);
    resize: vertical; background: #fff;
}

.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.modal-actions-right { display: flex; gap: 10px; }

/* Toast */
.toast {
    position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 22px;
    border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 200;
    font-weight: 700; font-size: 0.92rem;
    animation: rise 0.25s ease;
}

/* Entry helpers — banners, notes, tips, disabled chips */
.entry-banner {
    background: var(--plum-100); border: 1px solid var(--plum-300);
    color: var(--ink); border-radius: var(--radius-sm);
    padding: 12px 14px; margin-bottom: 18px; font-size: 0.92rem;
}
.entry-note { color: var(--ink-soft); font-size: 0.86rem; margin: -2px 0 12px; }
.entry-note.subtle { font-size: 0.82rem; margin: 2px 0 6px; padding-left: 28px; }
.chip.chip-disabled, .chip:disabled {
    opacity: 0.4; cursor: not-allowed; text-decoration: line-through;
}
.chip.chip-disabled:hover, .chip:disabled:hover { border-color: var(--rose-200); background: #fff; }
.note-tips { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.note-tips-label { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); padding-top: 8px; }
.chip-note { font-size: 0.82rem; padding: 6px 11px; }

/* Compact segmented control (view options in the cycle bar) */
.seg-control.seg-sm { padding: 3px; gap: 2px; }
.seg-sm .seg { padding: 6px 10px; font-size: 0.8rem; flex: 0 0 auto; }

/* Multi-cycle view — one labelled, scrollable strip per cycle */
#multi-view { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.cycle-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 6px 6px 2px; }
.cycle-block-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; padding: 10px 12px 4px; }
.cycle-block-head strong { font-family: var(--font-head); font-size: 1.1rem; color: var(--ink); }
.cycle-block-head span { font-size: 0.84rem; color: var(--ink-soft); }
.cycle-block .chart-scroll { border: none; box-shadow: none; padding: 0 4px 8px; }
.cycle-block .day-cell { width: 60px; min-height: 104px; }

/* Day 7 breast self-exam marker */
.day-bse {
    position: absolute; top: 4px; right: 5px;
    font-size: 0.52rem; font-weight: 800; letter-spacing: 0.03em;
    color: var(--plum-500); background: var(--plum-100);
    border-radius: 5px; padding: 1px 4px;
}

/* ==========================================================================
   Print / Export to PDF
   ========================================================================== */
#print-area { display: none; }
@media print {
    @page { size: landscape; margin: 10mm; }
    body { background: #fff !important; }
    body.printing > *:not(#print-area) { display: none !important; }
    #print-area {
        display: block; color: #000;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .pc-head h1 { font-size: 18pt; margin: 0 0 6px; }
    .pc-cycle { margin-bottom: 22px; page-break-inside: avoid; border-top: 1pt solid #ccc; padding-top: 10px; }
    .pc-cycle:first-of-type { border-top: none; padding-top: 0; }
    .pc-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 9pt; margin-bottom: 14px; color: #333; }
    .pc-notes h3 { font-size: 10pt; margin: 0 0 4px; }
    .pc-row { border-collapse: collapse; width: 100%; margin-bottom: 10px; table-layout: fixed; page-break-inside: avoid; }
    .pc-cell {
        border: 0.5pt solid #999; text-align: center; vertical-align: top;
        padding: 3px 1px; font-size: 7pt; width: 2.8%;
    }
    .pc-daynum { font-weight: 800; }
    .pc-date { color: #555; font-size: 6pt; }
    .pc-sticker { --size: 19px; margin: 2px auto; box-shadow: none; border-width: 1px; }
    .pc-sticker .sticker-count { font-size: 6pt; box-shadow: none; }
    .pc-code { font-weight: 700; word-break: break-all; min-height: 1em; }
    .pc-i { color: #6a4a8a; font-weight: 800; min-height: 0.9em; }
    .pc-notes { margin-top: 16px; page-break-inside: avoid; }
    .pc-notes h2 { font-size: 11pt; margin: 0 0 6px; }
    .pc-note { font-size: 8.5pt; margin-bottom: 3px; }
    .pc-foot { margin-top: 18px; font-size: 7.5pt; color: #666; font-style: italic; }

    /* Standard Chart layout */
    .sc-cycle { margin-bottom: 20px; page-break-inside: avoid; border-top: 1pt solid #ccc; padding-top: 10px; }
    .sc-cycle:first-of-type { border-top: none; padding-top: 0; }
    .sc-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
    .sc-label { width: 10%; font-size: 7pt; font-weight: 700; text-align: right; padding-right: 5pt; color: #444; border-right: 1pt solid #999; white-space: nowrap; }
    .sc-cell { border: 0.5pt solid #bbb; text-align: center; padding: 2px 0; font-size: 7pt; vertical-align: middle; }
    .sc-day { font-weight: 800; }
    .sc-date { font-size: 5.5pt; color: #555; }
    .sc-sticker { --size: 20px; margin: 1px auto; box-shadow: none; border-width: 1pt; }
    .sc-sticker .sticker-count { font-size: 5.5pt; box-shadow: none; }
    .sc-code { font-size: 6pt; font-weight: 700; word-break: break-all; }
    .sc-i { color: #6a4a8a; font-weight: 800; }
}

/* Utilities */
.hidden { display: none !important; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; gap: 30px; padding-bottom: 40px; }
    .hero-card { transform: none; max-width: 460px; }
    .cards, .benefit-grid { grid-template-columns: 1fr; }
    .rule-columns { grid-template-columns: 1fr; }
    .legend-grid, .legend-grid.wide { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    /* Collapse the nav into a hamburger dropdown. */
    .site-header {
        position: relative; flex-wrap: nowrap; gap: 12px;
        padding: 12px 18px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    .nav-toggle { display: inline-flex; }
    .site-nav {
        position: absolute; top: 100%; right: 12px; left: 12px;
        flex-direction: column; align-items: stretch; gap: 4px;
        background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 8px; z-index: 60; display: none;
    }
    .site-header.nav-open .site-nav { display: flex; }
    .site-nav a, .site-nav .btn {
        width: 100%; text-align: center;
        padding: 13px 14px; border-radius: var(--radius-sm); font-size: 1rem;
    }
    .site-nav a:not(.btn) { color: var(--ink); }
    .site-nav a:not(.btn):hover { background: var(--rose-50); }

    /* Form controls at 16px so iOS doesn't zoom in on focus. */
    input, select, textarea { font-size: 16px; }

    /* Cycle bar stacks cleanly; controls go full width and tap-friendly. */
    .cycle-bar { flex-direction: column; align-items: stretch; }
    .cycle-bar-left { flex-direction: column; gap: 12px; }
    .cycle-bar-right { flex-wrap: wrap; gap: 10px; }
    .field-inline { justify-content: space-between; }
    .field-inline select, .field-inline input, .cycle-bar input[type="date"] { flex: 1; min-height: 42px; }
    #view-modes { width: 100%; }
    #view-modes .seg { flex: 1 0 auto; }
    .goal-field { justify-content: space-between; }
    .goal-field .goal-toggle { flex: 1; }
    .goal-toggle .seg { flex: 1; text-align: center; }

    /* Bigger summary tiles, two-up. */
    .cycle-summary { gap: 10px; }
    .stat { padding: 12px 10px; min-width: 0; flex: 1 1 calc(50% - 10px); }

    /* Roomier day cells for touch. */
    .day-cell { width: 64px; min-height: 104px; }
    .chart-page { padding: 10px 14px 70px; }
}

@media (max-width: 560px) {
    .section { padding: 40px 18px; }
    .hero { padding: 24px 18px 30px; }
    .hero h1 { font-size: clamp(1.9rem, 8vw, 2.4rem); }
    .lede { font-size: 1.05rem; }
    .hero-actions .btn { width: 100%; }
    .cta { padding: 50px 18px 64px; }
    .quote-band { padding: 16px 16px 36px; }
    .quote { padding: 26px 22px 22px; }
    .quote::before { font-size: 2.6rem; top: 22px; left: 12px; }

    /* Make tappable targets comfortable on phones. */
    .chip { padding: 11px 15px; font-size: 0.95rem; }
    .btn { min-height: 46px; }
    .btn-sm { min-height: 40px; }
    .check input { width: 22px; height: 22px; }

    /* ----- Entry modal becomes a bottom sheet for thumb-friendly editing ----- */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 22px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        animation: sheet-up 0.26s cubic-bezier(0.18, 0.9, 0.34, 1.1);
    }
    .modal-narrow { max-width: 100%; }
    .modal::before {
        content: ''; display: block;
        width: 42px; height: 5px; border-radius: 999px;
        background: var(--rose-200); margin: -6px auto 14px;
    }
    .modal-title { font-size: 1.4rem; }
    .modal-close { top: 10px; right: 12px; }

    /* Keep Save/Cancel reachable at the bottom of the sheet. */
    .modal-actions {
        position: sticky; bottom: 0;
        flex-direction: row; align-items: stretch;
        gap: 10px; margin: 16px -16px 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--cream);
        border-top: 1px solid var(--line);
    }
    .modal-actions-right { flex: 1; display: flex; gap: 10px; }
    .modal-actions-right .btn { flex: 1; }
    #entry-clear { flex: 0 0 auto; }

    /* Stack the day-type-free observation chips comfortably. */
    .chip-col .chip { width: 100%; }
    .note-tips-label { width: 100%; padding-top: 0; }
}

@keyframes sheet-up { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 420px) {
    .site-header { padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
    .logo { font-size: 1.25rem; }
    .day-cell { width: 58px; min-height: 98px; padding: 9px 4px; }
    .day-code { font-size: 0.7rem; }
    .stat-value { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
