/* ==========================================================================
   ASEAN50 — editorial design system
   Serif headlines over a sans body, the standard news-portal pairing.
   Both are system stacks: no webfont request, so text paints on first frame.
   ========================================================================== */

:root {
    --ink:          #0f1419;
    --ink-2:        #2b3440;
    --muted:        #5b6672;
    --muted-2:      #8a929c;
    --rule:         #e2e6ea;
    --rule-strong:  #c9d0d7;
    --surface:      #f6f8fa;
    --surface-2:    #eef1f5;
    --paper:        #ffffff;

    --brand:        #0e2a47;
    --brand-ink:    #ffffff;
    --accent:       #c8102e;
    --accent-dark:  #a30d26;
    --link:         #0b4f8a;

    --serif: Georgia, "Times New Roman", "Noto Serif", "Liberation Serif", serif;
    --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
    --step-0:  clamp(0.95rem, 0.92rem + 0.15vw, 1.02rem);
    --step-1:  clamp(1.1rem, 1.04rem + 0.3vw, 1.25rem);
    --step-2:  clamp(1.3rem, 1.18rem + 0.6vw, 1.6rem);
    --step-3:  clamp(1.55rem, 1.3rem + 1.1vw, 2.1rem);
    --step-4:  clamp(1.85rem, 1.4rem + 2vw, 2.9rem);

    --gap:   1rem;
    --gap-2: 1.5rem;
    --gap-3: 2.25rem;
    --gap-4: 3.5rem;

    --wrap: 1200px;
    --prose: 44rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink:         #e8eaed;
        --ink-2:       #c7ccd3;
        --muted:       #9aa3ad;
        --muted-2:     #78818b;
        --rule:        #262c34;
        --rule-strong: #343b45;
        --surface:     #14181d;
        --surface-2:   #1a1f25;
        --paper:       #0d1116;
        --brand:       #0d1116;
        --brand-ink:   #e8eaed;
        --accent:      #ff5c74;
        --accent-dark: #ff8094;
        --link:        #7fb5e6;
    }
}

:root[data-theme="dark"] {
    --ink:         #e8eaed;
    --ink-2:       #c7ccd3;
    --muted:       #9aa3ad;
    --muted-2:     #78818b;
    --rule:        #262c34;
    --rule-strong: #343b45;
    --surface:     #14181d;
    --surface-2:   #1a1f25;
    --paper:       #0d1116;
    --brand:       #0d1116;
    --brand-ink:   #e8eaed;
    --accent:      #ff5c74;
    --accent-dark: #ff8094;
    --link:        #7fb5e6;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: var(--step-0);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

img, picture, svg { max-width: 100%; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 {
    font-family: var(--serif);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.012em;
    color: var(--ink);
    margin: 0 0 0.5em;
    text-wrap: balance;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }

.skip {
    position: absolute; left: -9999px;
    background: var(--accent); color: #fff; padding: 0.6rem 1rem; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* -------------------------------------------------------------- masthead */

.masthead { background: var(--brand); color: var(--brand-ink); border-bottom: 3px solid var(--accent); }

.masthead__bar {
    display: flex; align-items: center; gap: var(--gap-2);
    padding-block: 0.85rem;
}

.masthead__brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; }
.masthead__brand:hover { text-decoration: none; }

.logo { display: block; height: 34px; width: auto; }

.masthead__meta {
    margin-left: auto; display: flex; align-items: center; gap: var(--gap);
    font-size: var(--step--1); color: color-mix(in srgb, var(--brand-ink) 72%, transparent);
}

.search {
    display: flex; align-items: center;
    background: color-mix(in srgb, var(--brand-ink) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-ink) 22%, transparent);
    border-radius: 999px; padding: 0.25rem 0.3rem 0.25rem 0.75rem;
}
.search input {
    border: 0; background: none; color: var(--brand-ink);
    font: inherit; font-size: var(--step--1); width: 9rem; padding: 0.2rem 0;
}
.search input::placeholder { color: color-mix(in srgb, var(--brand-ink) 55%, transparent); }
.search input:focus { outline: none; }
.search button {
    border: 0; background: none; color: var(--brand-ink);
    cursor: pointer; padding: 0.2rem 0.4rem; line-height: 1;
}

/* ------------------------------------------------------------------- nav */

.nav { background: var(--paper); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 20; }
.nav__list {
    display: flex; gap: 0; margin: 0; padding: 0; list-style: none;
    overflow-x: auto; scrollbar-width: none;
}
.nav__list::-webkit-scrollbar { display: none; }
.nav__list a {
    display: block; padding: 0.7rem 0.85rem;
    font-size: var(--step--1); font-weight: 600; letter-spacing: 0.02em;
    text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.nav__list a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
.nav__list a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ----------------------------------------------------------------- kicker */

.kicker {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-family: var(--sans); font-size: var(--step--1); font-weight: 700;
    letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent);
    margin-bottom: 0.35rem;
}

.section-head {
    display: flex; align-items: baseline; gap: var(--gap);
    border-bottom: 2px solid var(--ink); padding-bottom: 0.5rem;
    margin: var(--gap-4) 0 var(--gap-2);
}
.section-head h2 { font-size: var(--step-2); margin: 0; }
.section-head a { margin-left: auto; font-size: var(--step--1); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ------------------------------------------------------------------ lead */

.lead { display: grid; gap: var(--gap-2); padding-block: var(--gap-3); }

@media (min-width: 900px) {
    .lead { grid-template-columns: 1.55fr 1fr; gap: var(--gap-3); }
    .lead__rest { display: grid; gap: var(--gap-2); align-content: start; }
}

.lead__main h2 { font-size: var(--step-4); }
.lead__main .card__media { margin-bottom: 0.9rem; }

/* ------------------------------------------------------------------ card */

.card { display: grid; gap: 0.55rem; }
.card__media {
    position: relative; overflow: hidden; background: var(--surface-2);
    border-radius: 3px;
}
.card__media img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease;
}
.card:hover .card__media img { transform: scale(1.03); }
.card h2, .card h3 { margin: 0; font-size: var(--step-1); }
.card h2 a, .card h3 a { color: var(--ink); }
.card h2 a:hover, .card h3 a:hover { color: var(--accent); text-decoration: none; }
.card p { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.55; }

.meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    font-size: var(--step--1); color: var(--muted-2);
}
.meta__sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.meta a { color: var(--muted); font-weight: 600; }

.card--row { grid-template-columns: 96px 1fr; gap: var(--gap); align-items: start; }
.card--row h3 { font-size: var(--step-0); line-height: 1.3; }
.card--row .card__media { aspect-ratio: 1 / 1; }

/* ------------------------------------------------------------------ grid */

.grid { display: grid; gap: var(--gap-2); }
@media (min-width: 560px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

.layout { display: grid; gap: var(--gap-3); padding-bottom: var(--gap-4); }
@media (min-width: 1000px) { .layout { grid-template-columns: minmax(0,1fr) 300px; gap: var(--gap-4); } }

.rail { display: grid; gap: var(--gap-3); align-content: start; }
.rail__box { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: var(--gap); }
.rail__box h2 { font-size: var(--step-1); margin-bottom: 0.75rem; }
.rail ol { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.7rem; }
.rail ol a { color: var(--ink); font-weight: 600; font-size: var(--step--1); line-height: 1.4; }
.rail ol a:hover { color: var(--accent); text-decoration: none; }

/* --------------------------------------------------------------- article */

.breadcrumb { font-size: var(--step--1); color: var(--muted); padding-block: var(--gap); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 0.4rem; color: var(--muted-2); }

.article { max-width: var(--prose); }
.article__header { padding-bottom: var(--gap-2); border-bottom: 1px solid var(--rule); margin-bottom: var(--gap-2); }
.article__header h1 { font-size: var(--step-4); }
.article__dek { font-size: var(--step-1); color: var(--muted); font-family: var(--serif); line-height: 1.45; margin: 0.5rem 0 1rem; }
.article__figure { margin: 0 0 var(--gap-2); }
.article__figure figcaption { font-size: var(--step--1); color: var(--muted-2); padding-top: 0.5rem; }

.prose { font-size: var(--step-1); line-height: 1.75; color: var(--ink-2); }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: var(--step-2); margin-top: 2em; }
.prose h3 { font-size: var(--step-1); margin-top: 1.7em; }
.prose img { border-radius: 3px; margin-block: 1.5em; height: auto; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.45em; }
.prose blockquote {
    margin: 1.6em 0; padding: 0.2em 0 0.2em 1.2em;
    border-left: 3px solid var(--accent);
    font-family: var(--serif); font-style: italic; color: var(--ink);
}
.prose table { width: 100%; border-collapse: collapse; font-size: var(--step-0); }
.prose th, .prose td { border: 1px solid var(--rule); padding: 0.6em 0.8em; text-align: left; }
.prose th { background: var(--surface); }
.prose pre { background: var(--surface-2); padding: 1rem; overflow-x: auto; border-radius: 4px; font-size: var(--step--1); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--gap-3); }
.tags a {
    font-size: var(--step--1); font-weight: 600;
    background: var(--surface-2); color: var(--ink-2);
    padding: 0.3rem 0.7rem; border-radius: 999px;
}
.tags a:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ------------------------------------------------------------ pagination */

.pagination { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: var(--gap-3) 0; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.4rem; padding: 0.45rem 0.7rem;
    border: 1px solid var(--rule-strong); border-radius: 3px;
    font-size: var(--step--1); font-weight: 600; color: var(--ink-2);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination [aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pagination .is-disabled { opacity: 0.4; }

/* ---------------------------------------------------------------- footer */

.footer { background: var(--surface); border-top: 1px solid var(--rule); margin-top: var(--gap-4); padding-block: var(--gap-3); }
.footer__grid { display: grid; gap: var(--gap-2); }
@media (min-width: 760px) { .footer__grid { grid-template-columns: 2fr 1fr 1fr; gap: var(--gap-3); } }
.footer h2 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--sans); }
.footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.45rem; font-size: var(--step--1); }
.footer p { color: var(--muted); font-size: var(--step--1); }
.footer__legal { border-top: 1px solid var(--rule); margin-top: var(--gap-2); padding-top: var(--gap); font-size: var(--step--1); color: var(--muted-2); }

/* ------------------------------------------------------------------- misc */

.empty { padding: var(--gap-4) 0; text-align: center; color: var(--muted); }

.notice {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem; font-size: var(--step--1); margin-bottom: var(--gap-2);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------- masthead lockup */

.lockup { flex: 0 0 auto; }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark__name {
    font-family: var(--serif); font-weight: 700;
    font-size: 1.4rem; letter-spacing: -0.015em; color: currentColor;
}
.wordmark__num { color: var(--accent); }
.masthead .wordmark__num { color: #ff93a3; }
.wordmark__tag {
    font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase;
    color: color-mix(in srgb, currentColor 62%, transparent); margin-top: 2px;
}

@media (max-width: 620px) {
    .wordmark__tag { display: none; }
    .masthead__date { display: none; }
    .search input { width: 6.5rem; }
}

.footer__brand { color: var(--ink); margin-bottom: 0.75rem; display: inline-flex; }
.footer__brand:hover { text-decoration: none; }

/* ------------------------------------------------------------ card extras */

.card__body { display: grid; gap: 0.4rem; align-content: start; }
.card--row .card__body { gap: 0.3rem; }

.card__media--empty {
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    border: 1px solid var(--rule);
}

.archive__intro {
    max-width: var(--prose); color: var(--muted);
    font-size: var(--step-1); line-height: 1.6; margin: 0 0 var(--gap);
}

.sr-only, .masthead .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------- 404 page */

.notfound { max-width: var(--prose); padding-block: var(--gap-4); }
.notfound h1 { font-size: var(--step-4); }
.notfound p { color: var(--muted); font-size: var(--step-1); }
