/* maljosim.com — Watch Your Words
 * Swiss typographic precision, F-pattern hierarchy.
 * Palette and type taken verbatim from DESIGN.md.
 *
 * Typography sources:
 *   Noto Sans KR — display/headings (Google Fonts)
 *   Noto Serif KR — body (Google Fonts)
 *   Source Code Pro — annotations (Google Fonts)
 */

/* -----------------------------------------------------------
   1. Tokens
   ----------------------------------------------------------- */
:root {
    --c-paper: #faf9f6;       /* Rice Paper White */
    --c-ink: #1a1a1e;         /* Ink Stone */
    --c-vermillion: #c84b31;  /* Warning Vermillion */
    --c-steel: #4a4a52;       /* Steel Text */
    --c-hanji: #e8e4dc;       /* Hanji Warm */
    --c-trust: #2a5f4a;       /* Trust Green */
    --c-rule: #d4d0c8;        /* Rule Gray */

    --f-display: "Noto Sans KR", "Helvetica Neue", Arial, sans-serif;
    --f-body: "Noto Serif KR", Georgia, "Times New Roman", serif;
    --f-mono: "Source Code Pro", "SFMono-Regular", Menlo, Consolas, monospace;

    --measure: 1080px;
    --pad-x: clamp(1.25rem, 4vw, 2.5rem);
    --section-gap: clamp(3rem, 8vh, 6rem);
}

/* -----------------------------------------------------------
   2. Reset / base
   ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-paper);
    color: var(--c-ink);
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--c-ink);
    text-decoration: none;
    border-bottom: 1px solid var(--c-rule);
    transition: color 200ms ease, border-color 200ms ease;
}
a:hover { color: var(--c-vermillion); border-bottom-color: var(--c-vermillion); }

p { margin: 0 0 1rem; }
em { font-style: italic; color: var(--c-steel); }

hr.rule {
    border: 0;
    border-top: 1px solid var(--c-rule);
    margin: 0;
    width: 100%;
}

/* -----------------------------------------------------------
   3. Page frame
   ----------------------------------------------------------- */
.page {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--pad-x);
}

main {
    display: block;
}

/* -----------------------------------------------------------
   4. Header / masthead
   ----------------------------------------------------------- */
.site-header {
    padding: clamp(1.5rem, 3vh, 2.25rem) 0 1.25rem;
    border-bottom: 1px solid var(--c-rule);
}

.masthead {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 2rem;
}

.mark {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
.mark-han {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--c-ink);
    letter-spacing: 0.02em;
}
.mark-rom {
    font-family: var(--f-mono);
    font-size: 0.78rem;
    color: var(--c-steel);
    letter-spacing: 0.16em;
    text-transform: lowercase;
}

.topnav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: flex-start;
    padding-left: 2rem;
}
.topnav a {
    font-family: var(--f-mono);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-steel);
    border-bottom: 0;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}
.topnav a:hover {
    color: var(--c-vermillion);
    border-bottom-color: var(--c-vermillion);
}

.meta-stamp {
    font-family: var(--f-mono);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    color: var(--c-steel);
    display: flex;
    gap: 0.4rem;
    text-transform: uppercase;
}
.stamp-num { color: var(--c-ink); }

/* -----------------------------------------------------------
   5. Hero
   ----------------------------------------------------------- */
.hero {
    padding: clamp(3rem, 9vh, 6.5rem) 0 var(--section-gap);
}

.hero-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2.5rem;
    align-items: start;
}

.hero-left { padding-right: 1rem; }

.eyebrow {
    font-family: var(--f-mono);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-vermillion);
    margin: 0 0 1.5rem;
}

.display {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 4.4rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--c-ink);
}
.display .dot { color: var(--c-vermillion); }

/* Korean brush accent under the hero domain name */
.brush-accent {
    width: 96px;
    height: 14px;
    margin: 1.1rem 0 1.6rem;
    border-bottom: 3px solid var(--c-vermillion);
    border-radius: 0 0 50% 50%;
}

.lede {
    font-family: var(--f-body);
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--c-ink);
    max-width: 56ch;
    margin: 0 0 2.5rem;
}

/* Verification scale -- decorative CSS in the hero */
.hero-scale {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.scale-arm {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 6px;
    height: 14px;
}
.bar {
    width: 60px;
    height: 6px;
    background: var(--c-ink);
}
.bar-left { transform-origin: right center; animation: tip-left 6s ease-in-out infinite; }
.bar-right { transform-origin: left center; animation: tip-right 6s ease-in-out infinite; }
.beam {
    width: 12px;
    height: 2px;
    background: var(--c-ink);
    align-self: center;
}
.fulcrum {
    width: 26px;
    height: 22px;
    background: var(--c-vermillion);
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
    margin-top: -2px;
}
.plinth {
    width: 80px;
    height: 2px;
    background: var(--c-ink);
    margin-top: 4px;
}
.scale-caption {
    font-family: var(--f-mono);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    color: var(--c-steel);
    text-transform: uppercase;
    margin: 1rem 0 0;
}

@keyframes tip-left {
    0%, 100% { transform: rotate(-2deg); }
    50%      { transform: rotate(2deg); }
}
@keyframes tip-right {
    0%, 100% { transform: rotate(2deg); }
    50%      { transform: rotate(-2deg); }
}

.hero-right {
    padding-top: 0.5rem;
}

/* -----------------------------------------------------------
   6. Sections
   ----------------------------------------------------------- */
.section {
    padding: var(--section-gap) 0;
}

.section-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2.5rem;
    align-items: start;
}

.section-left { min-width: 0; }

.kicker {
    font-family: var(--f-mono);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-vermillion);
    margin: 0 0 1.2rem;
}

.heading {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 1.75rem;
    color: var(--c-ink);
    max-width: 24ch;
}

.body {
    font-family: var(--f-body);
    font-size: 1rem;
    line-height: 1.85;
    color: var(--c-ink);
    max-width: 60ch;
}

/* -----------------------------------------------------------
   7. Margin notes (right-column annotations)
   ----------------------------------------------------------- */
.section-right,
.hero-right {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.margin-note {
    border-left: 2px solid var(--c-vermillion);
    padding: 0.05rem 0 0.05rem 0.9rem;
}

.anno-head {
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-vermillion);
    margin: 0 0 0.35rem;
}

.annotation {
    font-family: var(--f-body);
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--c-steel);
    margin: 0;
    font-style: italic;
}

.data-block {
    background: var(--c-hanji);
    border: 1px solid var(--c-rule);
    padding: 1rem 1.1rem 1.1rem;
    margin-top: 0.5rem;
}
.data-label {
    font-family: var(--f-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-steel);
    margin: 0 0 0.6rem;
}
.data-list,
.kv {
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: var(--f-mono);
    font-size: 0.82rem;
    color: var(--c-ink);
}
.data-list li {
    display: flex;
    gap: 0.9rem;
    align-items: baseline;
    border-top: 1px dashed var(--c-rule);
    padding: 0.45rem 0;
}
.data-list li:first-child { border-top: 0; padding-top: 0.2rem; }
.data-list .num {
    color: var(--c-vermillion);
    font-weight: 500;
    width: 1.6rem;
    flex-shrink: 0;
}
.kv li {
    display: flex;
    justify-content: space-between;
    border-top: 1px dashed var(--c-rule);
    padding: 0.45rem 0;
}
.kv li:first-child { border-top: 0; padding-top: 0.2rem; }
.kv li span:last-child { color: var(--c-vermillion); }

/* -----------------------------------------------------------
   8. Specimens (speech-bubble quotation frames)
   ----------------------------------------------------------- */
.specimen {
    margin: 0 0 2.5rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px dashed var(--c-rule);
}
.specimen:last-child { border-bottom: 0; margin-bottom: 0; }

.specimen-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin: 0 0 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--c-rule);
}
.spec-num {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--c-ink);
}
.spec-meta {
    font-family: var(--f-mono);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-steel);
}

.bubble {
    position: relative;
    background: var(--c-hanji);
    border: 1px solid var(--c-rule);
    padding: 1rem 1.1rem;
    margin: 0.5rem 0 1.2rem 14px;
    max-width: 56ch;
}
.bubble::before {
    content: "";
    position: absolute;
    top: 16px;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--c-rule);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}
.bubble::after {
    content: "";
    position: absolute;
    top: 17px;
    left: -7px;
    width: 0;
    height: 0;
    border-right: 7px solid var(--c-hanji);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}
.bubble p {
    margin: 0;
    font-family: var(--f-body);
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--c-ink);
}

/* Reading bars */
.reading {
    margin: 1rem 0 0.75rem;
    padding-left: 14px;
}
.reading-line {
    display: grid;
    grid-template-columns: 5.5rem 1fr 9rem;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.4rem;
    font-family: var(--f-mono);
    font-size: 0.8rem;
}
.r-key {
    color: var(--c-steel);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
}
.r-bar {
    display: block;
    height: 6px;
    background: var(--c-hanji);
    border: 1px solid var(--c-rule);
    position: relative;
    overflow: hidden;
}
.r-fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--c-ink);
    transition: width 900ms cubic-bezier(.2,.6,.2,1);
}
.r-val {
    color: var(--c-ink);
    text-align: right;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
}
.r-warn { color: var(--c-vermillion); }
.r-good { color: var(--c-trust); }

.counsel {
    font-family: var(--f-body);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--c-steel);
    font-style: italic;
    margin: 0.75rem 0 0;
    padding-left: 14px;
    max-width: 60ch;
}
.counsel-mark {
    color: var(--c-vermillion);
    font-style: normal;
    font-family: var(--f-display);
    font-weight: 700;
    margin-right: 0.4rem;
}

/* -----------------------------------------------------------
   9. Procedure list
   ----------------------------------------------------------- */
.procedure {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    counter-reset: proc;
}
.procedure li {
    display: grid;
    grid-template-columns: 2.4rem 1fr;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--c-rule);
}
.procedure li:last-child { border-bottom: 1px solid var(--c-rule); }
.proc-num {
    font-family: var(--f-display);
    font-weight: 700;
    color: var(--c-vermillion);
    font-size: 1rem;
    line-height: 1.5;
}
.proc-head {
    font-family: var(--f-display);
    font-weight: 700;
    color: var(--c-ink);
    font-size: 1.05rem;
    margin: 0 0 0.25rem;
    line-height: 1.35;
}
.proc-body {
    font-family: var(--f-body);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--c-steel);
    margin: 0;
    max-width: 56ch;
}

/* -----------------------------------------------------------
   10. Glossary
   ----------------------------------------------------------- */
.glossary {
    margin: 1.5rem 0 0;
    padding: 0;
}
.gloss-row {
    display: grid;
    grid-template-columns: 13rem 1fr;
    gap: 1.25rem;
    padding: 1rem 0;
    border-top: 1px solid var(--c-rule);
}
.gloss-row:last-child { border-bottom: 1px solid var(--c-rule); }
.gloss-row dt {
    font-family: var(--f-display);
    font-weight: 700;
    color: var(--c-ink);
    font-size: 0.98rem;
    line-height: 1.5;
}
.gloss-row dd {
    margin: 0;
    font-family: var(--f-body);
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--c-steel);
    max-width: 56ch;
}

/* -----------------------------------------------------------
   11. Footer
   ----------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--c-rule);
    padding: 2rem 0 3rem;
    margin-top: var(--section-gap);
}
.foot-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 2rem;
    align-items: start;
}
.foot-mark {
    font-family: var(--f-display);
    font-weight: 700;
    color: var(--c-ink);
    margin: 0 0 0.25rem;
}
.foot-tag {
    font-family: var(--f-mono);
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--c-vermillion);
    margin: 0;
}
.foot-line {
    font-family: var(--f-mono);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    color: var(--c-steel);
    margin: 0 0 0.2rem;
    text-transform: uppercase;
}
.foot-right { text-align: right; }

/* -----------------------------------------------------------
   12. Reveal animation (subtle, 500ms)
   ----------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 500ms ease, transform 500ms ease;
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* -----------------------------------------------------------
   13. Responsive
   ----------------------------------------------------------- */
@media (max-width: 880px) {
    .masthead {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .topnav {
        padding-left: 0;
        gap: 1.1rem;
    }
    .meta-stamp { justify-content: flex-start; }

    .hero-grid,
    .section-grid {
        grid-template-columns: 1fr;
        gap: 2.25rem;
    }
    .hero-right,
    .section-right {
        order: 2;
        padding-top: 0;
    }
    .heading { max-width: none; }
}

@media (max-width: 560px) {
    .reading-line {
        grid-template-columns: 4.5rem 1fr 6.5rem;
        gap: 0.5rem;
    }
    .gloss-row {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    .foot-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .foot-right { text-align: left; }
    .specimen-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .bar-left, .bar-right { animation: none; }
    .r-fill { transition: none; }
}
