:root {
    --ink: #eef2ef;
    --text: #d7dfda;
    --muted: #91a298;
    --panel: #15211d;
    --line: #2d4037;
    --accent: #d4bb7d;
    --accent-soft: #ddc994;
    --bg-1: #0f1714;
    --bg-2: #16221d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: 'Manrope', sans-serif;
    background: linear-gradient(165deg, var(--bg-1), var(--bg-2));
    display: grid;
    place-items: center;
    padding: 16px;
}

.frame {
    width: min(1400px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(6, 10, 9, 0.28);
    overflow: hidden;
}

.top-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 0;
}

.lang-switcher {
    display: inline-flex;
    gap: 4px;
    background: #1a2923;
    border: 1px solid #30443b;
    border-radius: 999px;
    padding: 4px;
}

.lang-btn {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 7px 11px;
    cursor: pointer;
}

.lang-btn.active {
    color: #12201b;
    background: var(--accent);
}

header {
    text-align: center;
    padding: 8px 14px 6px;
}

.header-panels {
    margin: 16px 6px 4px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
    gap: 14px;
    align-items: start;
}

h1 {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(34px, 7vw, 60px);
    line-height: 0.95;
    letter-spacing: 0.12em;
    color: #f3e8c8;
}

.tagline {
    margin: 8px 0 0;
    color: var(--muted);
    letter-spacing: 0.06em;
    font-size: clamp(10px, 2vw, 12px);
    text-transform: uppercase;
}

.header-subtitle-row {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.brand-subtitle {
    margin: 0;
    color: var(--accent-soft);
    font-size: clamp(11px, 2vw, 13px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-day-date {
    margin: 0;
    color: #f0e8d2;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(20px, 4vw, 28px);
    line-height: 1;
    letter-spacing: 0.05em;
}

.event-card {
    margin: 10px 12px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #31463d;
    background: #1a2a24;
}

.glossary-card {
    margin: 0;
    padding: 16px 16px 18px;
    border-radius: 14px;
    border: 1px solid #52634f;
    border-top: 3px solid #7b936b;
    background:
        radial-gradient(circle at top right, rgba(123, 147, 107, 0.16), transparent 34%),
        linear-gradient(180deg, #25332a, #1f2a22);
    box-shadow: 0 10px 24px rgba(4, 8, 7, 0.18);
}

.history-section {
    margin: 0;
    padding: 16px 16px 14px;
    border: 1px solid #31463d;
    border-radius: 14px;
    border-top: 3px solid #4ea1ff;
    background:
        radial-gradient(circle at top right, rgba(78, 161, 255, 0.14), transparent 34%),
        linear-gradient(180deg, #1a2724, #141d1c);
    box-shadow: 0 10px 24px rgba(4, 8, 7, 0.18);
}

.history-header {
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(145, 162, 152, 0.14);
}

.history-heading {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-heading::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid #4ea1ff;
    background: rgba(78, 161, 255, 0.12);
    flex: 0 0 10px;
}

.history-date {
    margin: 0;
    color: var(--text);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1;
}

.history-lead {
    margin: 8px 0 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
}

.history-events {
    list-style: none;
    margin: 0;
    padding: 0;
}

.history-item {
    margin: 0 0 8px;
    padding: 10px 10px 10px 12px;
    border: 1px solid #31463d;
    border-left: 3px solid #4ea1ff;
    border-radius: 8px;
    background: rgba(26, 42, 36, 0.72);
}

.history-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
}

.history-main {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
}

.history-year {
    color: #ffb86b;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 3.4rem;
    line-height: 1.45;
    padding-top: 1px;
    cursor: help;
}

.history-year:focus-visible {
    outline: 1px solid rgba(255, 184, 107, 0.7);
    outline-offset: 2px;
}

.history-years-back {
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.3;
    margin-top: 1px;
    position: absolute;
    left: 0;
    top: -16px;
    background: rgba(15, 23, 20, 0.95);
    border: 1px solid #31463d;
    border-radius: 6px;
    padding: 3px 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px);
    pointer-events: none;
}

.history-year:hover + .history-years-back,
.history-year:focus-visible + .history-years-back {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.history-empty {
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 14px 0 4px;
}

.glossary-term {
    margin: 6px 0 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(24px, 5vw, 32px);
    color: #f4eacd;
}

.glossary-description {
    margin: 8px 0 0;
    line-height: 1.45;
    font-size: clamp(14px, 2.2vw, 15px);
    color: var(--ink);
}

.glossary-text[data-lang] {
    display: none;
}

.event-title {
    margin: 0;
    font-size: 12px;
    color: var(--accent-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-title::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: linear-gradient(180deg, #9ab082, #7b936b);
    transform: rotate(45deg);
    flex: 0 0 10px;
}

.event-meta {
    margin-top: 4px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.event-year {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(24px, 5vw, 34px);
    color: #f4eacd;
}

.event-current-date {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.event-current-date [data-lang] {
    display: none;
}

.event-text {
    margin: 0;
    line-height: 1.45;
    font-size: clamp(14px, 2.2vw, 15px);
    color: var(--ink);
}

.event-text[data-lang] {
    display: none;
}

.event-body {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    column-gap: 8px;
}

.link-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #e9f0ec;
    border: 1px solid #3a5147;
    border-radius: 999px;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}

.link-wrap:hover {
    background: #22352e;
    border-color: #4b6a5e;
}

.link-icon {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
}

.status {
    border-radius: 10px;
    border: 1px solid #31463d;
    background: #1a2a24;
    margin: 20px 12px 18px;
    font-size: 13px;
    color: var(--accent-soft);
}


@media (max-width: 760px) {
    body {
        padding: 10px;
    }

    .header-panels {
        grid-template-columns: 1fr;
        margin: 14px 0 2px;
        padding-top: 12px;
        gap: 10px;
    }

    .top-row {
        justify-content: center;
        padding-top: 16px;
    }

    .event-card {
        margin: 8px;
        padding: 10px;
    }

    .glossary-card {
        margin: 0;
        padding: 10px;
    }

    .history-section {
        margin: 0;
    }

    .history-main {
        gap: 6px;
    }

    .history-year {
        min-width: 3rem;
    }

    .event-meta {
        gap: 8px;
    }

    .status {
        margin: 8px;
    }

    .event-body {
        column-gap: 8px;
    }

    .event-text {
        font-size: 14px;
        line-height: 1.4;
    }

    .link-wrap {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .summary-section {
        margin: 16px 8px;
        padding: 14px 12px 10px;
    }

    .summary-card-btn {
        padding: 14px 14px 14px 0;
        gap: 10px;
    }

    .summary-card-accent {
        width: 2px;
        min-height: 44px;
    }

    .summary-md {
        padding: 14px 14px 14px 16px;
    }
}

/* ── Daily Summary Section ─────────────────────────────────────────── */

.summary-section {
    margin: 14px auto 12px;
    width: min(1080px, calc(100% - 24px));
    border: 1px solid #3b473f;
    border-top: 3px solid var(--accent);
    border-radius: 14px;
    background:
        radial-gradient(circle at top right, rgba(212, 187, 125, 0.16), transparent 36%),
        linear-gradient(180deg, #201e1a, #171d1a);
    box-shadow: 0 10px 24px rgba(4, 8, 7, 0.18);
    padding: 24px 20px 20px;
}

.summary-header {
    margin: 0 auto 18px;
    max-width: 980px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(145, 162, 152, 0.14);
}

.summary-tools {
    display: flex;
    justify-content: flex-end;
}

.reading-mode-btn {
    border: 1px solid rgba(145, 162, 152, 0.32);
    background: rgba(26, 39, 35, 0.84);
    color: var(--muted);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
}

.reading-mode-btn:hover {
    border-color: rgba(145, 162, 152, 0.52);
    color: var(--text);
}

.reading-mode-btn.active {
    border-color: rgba(212, 187, 125, 0.55);
    color: var(--accent);
    background: rgba(212, 187, 125, 0.12);
}

.summary-label {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-label::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(180deg, #e1c785, #d4bb7d);
    flex: 0 0 10px;
}

.summary-label-date {
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    letter-spacing: 0.06em;
}

.summary-title {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(26px, 5vw, 38px);
    line-height: 1.05;
    letter-spacing: 0.03em;
    color: #f3e8c8;
    font-weight: 700;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 980px;
    margin: 0 auto;
}

.reading-focus .summary-list {
    gap: 10px;
}

.summary-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #192620;
    overflow: hidden;
}

.summary-card-active {
    border-color: rgba(212, 187, 125, 0.45);
}

.reading-focus .summary-card {
    opacity: 0.38;
    filter: saturate(0.82);
    transition: opacity 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

.reading-focus .summary-card.summary-card-active {
    opacity: 1;
    filter: none;
    border-color: rgba(212, 187, 125, 0.52);
}

.summary-card-today {
    border-color: rgba(212, 187, 125, 0.42);
    box-shadow: inset 0 0 0 1px rgba(212, 187, 125, 0.16);
}

.summary-card:hover {
    border-color: #3d5a4c;
}

.summary-card-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 16px 16px 0;
    color: inherit;
}

.summary-card-accent {
    flex-shrink: 0;
    align-self: stretch;
    width: 3px;
    min-height: 52px;
    border-radius: 0 2px 2px 0;
    background: var(--accent);
    opacity: 0.7;
}

.summary-card:hover .summary-card-accent,
.summary-card-btn[aria-expanded="true"] .summary-card-accent {
    opacity: 1;
}

.summary-card-inner {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-card-type {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(212, 187, 125, 0.12);
    color: var(--accent-soft);
    border: 1px solid rgba(212, 187, 125, 0.2);
}

.summary-card-badge-today {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(212, 187, 125, 0.18);
    color: var(--accent);
    border: 1px solid rgba(212, 187, 125, 0.35);
}

.summary-card-ts {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.summary-card-headline {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(18px, 3.5vw, 22px);
    font-weight: 700;
    line-height: 1.28;
    color: #f0e9d6;
    letter-spacing: 0.01em;
}

.summary-card-btn:hover .summary-card-headline,
.summary-card-btn[aria-expanded="true"] .summary-card-headline {
    color: var(--accent);
}

.summary-card-excerpt {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.summary-chevron {
    flex-shrink: 0;
    margin-top: 4px;
    width: 18px;
    height: 18px;
    color: var(--muted);
}

.summary-card-btn:hover .summary-chevron {
    color: var(--text);
}

.summary-chevron.open {
    transform: rotate(180deg);
}

/* Expandable body */
.summary-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.summary-card-body.open {
    max-height: 9999px;
}

/* Markdown rendering */
.summary-md {
    padding: 18px 22px 24px;
    border-top: 1px solid var(--line);
    max-width: 92ch;
    margin: 0 auto;
}

.reading-focus .summary-md {
    max-width: 80ch;
}

.summary-md h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 700;
    color: #f3e8c8;
    margin: 1.6rem 0 0.6rem;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    letter-spacing: 0.02em;
}

.summary-md h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(16px, 2.5vw, 19px);
    font-weight: 600;
    color: #e8dfc8;
    margin: 1.25rem 0 0.45rem;
}

.summary-md p {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(15px, 1.2vw, 16px);
    color: var(--ink);
    line-height: 1.85;
    margin: 0.55rem 0;
}

.summary-md p + p {
    margin-top: 0.85rem;
}

.summary-md ul,
.summary-md ol {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(15px, 1.2vw, 16px);
    color: var(--ink);
    padding-left: 1.55rem;
    margin: 0.6rem 0 1rem;
    line-height: 1.8;
}

.summary-md ul { list-style: disc; }
.summary-md ol { list-style: decimal; }
.summary-md li { margin: 0.2rem 0; }

.summary-md li + li { margin-top: 0.35rem; }

.summary-md strong {
    color: #f1f0ec;
    font-weight: 600;
}

.summary-md em {
    color: var(--muted);
    font-style: italic;
}

.summary-md code {
    background: #0f1e18;
    color: var(--accent);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: monospace;
}

.summary-md pre {
    background: #0f1e18;
    padding: 12px 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.8rem 0;
}

.summary-md pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

.summary-md hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 1.4rem 0;
}

.summary-md a {
    color: #91d6b8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.summary-md blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    color: var(--muted);
    margin: 1rem 0;
    font-style: italic;
}

@media (max-width: 760px) {
    .summary-section {
        width: auto;
    }

    .summary-tools {
        justify-content: center;
    }

    .reading-mode-btn {
        width: 100%;
    }
}

.summary-md > :first-child {
    margin-top: 0;
}

.summary-md > :last-child {
    margin-bottom: 0;
}

/* ── Today highlight ───────────────────────────────────────────────── */

.summary-today {
    border-top-color: rgba(212, 187, 125, 0.95);
    box-shadow: 0 14px 28px rgba(20, 16, 8, 0.22);
}

.summary-today .summary-title {
    color: var(--accent);
}

.summary-badge-today,
.summary-badge-past {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
}

.summary-badge-today {
    background: rgba(212, 187, 125, 0.18);
    color: var(--accent);
    border: 1px solid rgba(212, 187, 125, 0.35);
}

.summary-badge-past {
    background: rgba(145, 162, 152, 0.12);
    color: var(--muted);
    border: 1px solid rgba(145, 162, 152, 0.2);
}

/* ── Footer ────────────────────────────────────────────────────────── */

footer {
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-copy {
    color: #7f968b;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.footer-archive {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 6px;
}

.footer-archive-link {
    font-size: 10px;
    color: var(--muted);
    text-decoration: none;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

.footer-archive-link:hover {
    color: var(--text);
    border-color: var(--line);
}

.footer-archive-link--active {
    color: var(--accent);
    border-color: rgba(212, 187, 125, 0.35);
}
