:root {
    --paper:       #f3ece0;
    --paper-soft:  #ede5d4;
    --ink:         #1f1812;
    --ink-soft:    #4a3d33;
    --ink-dim:     #7a6a5b;
    --accent:      #8a2e2b;
    --accent-soft: #c47a52;
    --rule:        #cdbfa8;
    --maxw:        720px;

    --m-bg:     #100e0d;
    --m-bg2:    #16120f;
    --m-text:   #efe8de;
    --m-soft:   #c4bab0;
    --m-dim:    #8d8378;
    --m-accent: #c8744e;
    --m-line:   rgba(238, 230, 220, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body { margin: 0; min-height: 100vh; }

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

[data-only] { }

body[data-style="modern"] [data-only="paper"] { display: none !important; }
body[data-style="paper"]  [data-only="modern"] { display: none !important; }

.switch {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    backdrop-filter: saturate(1.1);
}

.switch__btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.6px;
    padding: 7px 15px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.25s ease, color 0.25s ease;
}

body[data-style="paper"] .switch {
    background: rgba(31, 24, 18, 0.06);
    border: 1px solid var(--rule);
}

body[data-style="paper"] .switch__btn {
    color: var(--ink-dim);
    font-family: "Courier New", ui-monospace, monospace;
}

body[data-style="paper"] .switch__btn[data-set-style="paper"] {
    background: var(--ink);
    color: var(--paper);
}

body[data-style="modern"] .switch {
    background: rgba(20, 17, 14, 0.55);
    border: 1px solid var(--m-line);
}

body[data-style="modern"] .switch__btn {
    color: var(--m-dim);
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

body[data-style="modern"] .switch__btn[data-set-style="modern"] {
    background: var(--m-text);
    color: var(--m-bg);
}

body[data-style="paper"] {
    background: var(--paper);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(120, 90, 60, 0.05) 0, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(120, 90, 60, 0.04) 0, transparent 40%),
        repeating-linear-gradient(0deg, transparent 0 2px, rgba(60, 40, 20, 0.012) 2px 3px);
    color: var(--ink);
    font-family: "Iowan Old Style", "Charter", "Georgia", "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    padding: 32px 20px 80px;
}

body[data-style="paper"] .page { max-width: var(--maxw); margin: 0 auto; }

body[data-style="paper"] a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

body[data-style="paper"] a:hover { color: var(--accent-soft); }

body[data-style="paper"] .topbar {
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 11.5px;
    letter-spacing: 1.5px;
    text-transform: lowercase;
    color: var(--ink-dim);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 50px;
}

body[data-style="paper"] .topbar__dot { opacity: 0.4; }

body[data-style="paper"] .masthead { margin-bottom: 70px; }

body[data-style="paper"] .masthead__kicker {
    font-style: italic;
    color: var(--ink-soft);
    margin: 0 0 6px;
    font-size: 16px;
}

body[data-style="paper"] .masthead__title {
    margin: 0;
    line-height: 1.02;
    font-weight: 400;
}

body[data-style="paper"] .masthead__name {
    display: block;
    font-size: clamp(64px, 14vw, 132px);
    letter-spacing: -3px;
    font-style: italic;
    font-weight: 500;
}

body[data-style="paper"] .masthead__sub {
    display: block;
    font-size: clamp(18px, 2.4vw, 23px);
    color: var(--ink-soft);
    margin-top: 6px;
    font-weight: 400;
}

body[data-style="paper"] .masthead__meta {
    margin-top: 26px;
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 13px;
    color: var(--ink-dim);
    letter-spacing: 0.5px;
}

body[data-style="paper"] .entry { margin: 0 0 60px; position: relative; }

body[data-style="paper"] .entry::after { content: ""; display: block; clear: both; }

body[data-style="paper"] .entry__no {
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 6px;
}

body[data-style="paper"] .entry__title {
    font-weight: 500;
    font-style: italic;
    font-size: clamp(26px, 4.2vw, 36px);
    margin: 0 0 24px;
    letter-spacing: -0.4px;
    line-height: 1.15;
}

body[data-style="paper"] .entry p { margin: 0 0 18px; }

body[data-style="paper"] .entry__lede {
    color: var(--ink-soft);
    font-size: 17px;
    font-style: italic;
    max-width: 56ch;
}

body[data-style="paper"] .dropcap::first-letter {
    font-size: 4.4em;
    line-height: 0.85;
    float: left;
    font-weight: 500;
    padding: 6px 10px 0 0;
    color: var(--accent);
    font-style: italic;
}

body[data-style="paper"] .float-photo {
    margin: 6px 0 18px;
    max-width: 250px;
}

body[data-style="paper"] .float-photo--right { transform: rotate(-2.4deg); }
body[data-style="paper"] .float-photo--left  { transform: rotate(2.6deg); }

body[data-style="paper"] .float-photo img {
    width: 100%;
    background: #fff;
    padding: 8px 8px 0;
    border: 1px solid rgba(60, 40, 20, 0.08);
    box-shadow: 0 14px 32px rgba(50, 30, 10, 0.18);
}

body[data-style="paper"] .float-photo figcaption {
    background: #fff;
    padding: 8px 8px 12px;
    border: 1px solid rgba(60, 40, 20, 0.08);
    border-top: none;
    font-family: "Courier New", monospace;
    font-size: 11.5px;
    color: var(--ink-dim);
    text-align: center;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

body[data-style="paper"] .float-photo--right {
    float: right;
    margin-left: 28px;
    margin-right: -10px;
}

body[data-style="paper"] .float-photo--left {
    float: left;
    margin-right: 28px;
    margin-left: -10px;
}

body[data-style="paper"] .scrap {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 28px 24px;
    margin: 36px 0 10px;
}

body[data-style="paper"] .scrap__photo {
    margin: 0;
    background: #fff;
    padding: 10px 10px 0;
    border: 1px solid rgba(60, 40, 20, 0.08);
    box-shadow: 0 16px 36px rgba(50, 30, 10, 0.18);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    cursor: zoom-in;
}

body[data-style="paper"] .scrap__photo img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

body[data-style="paper"] .scrap__photo figcaption {
    background: #fff;
    padding: 10px 4px 14px;
    font-family: "Courier New", monospace;
    font-size: 11.5px;
    color: var(--ink-dim);
    letter-spacing: 0.4px;
    text-align: center;
}

body[data-style="paper"] .scrap__photo:nth-child(1) { grid-column: 1 / span 6;  transform: rotate(-2.4deg); }
body[data-style="paper"] .scrap__photo:nth-child(2) { grid-column: 7 / span 6;  margin-top: 30px;  transform: rotate(1.8deg); }
body[data-style="paper"] .scrap__photo:nth-child(3) { grid-column: 1 / span 4;  margin-top: 20px;  transform: rotate(-1.1deg); }
body[data-style="paper"] .scrap__photo:nth-child(4) { grid-column: 5 / span 4;  margin-top: -10px; transform: rotate(2.6deg); }
body[data-style="paper"] .scrap__photo:nth-child(5) { grid-column: 9 / span 4;  margin-top: 40px;  transform: rotate(-1.7deg); }

body[data-style="paper"] .scrap__photo:hover {
    transform: rotate(0) scale(1.02);
    box-shadow: 0 22px 50px rgba(50, 30, 10, 0.28);
}

body[data-style="paper"] .entry--letter p { font-size: 18.5px; color: var(--ink); }

body[data-style="paper"] .letter__close { margin-top: 28px; font-style: italic; }

body[data-style="paper"] .letter__highlight {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 1px;
}

body[data-style="paper"] .letter__sign {
    color: var(--ink-dim);
    font-style: italic;
    text-align: right;
    margin-top: 26px;
    font-size: 16px;
}

body[data-style="paper"] .where { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }

body[data-style="paper"] .where li {
    display: grid;
    grid-template-columns: 130px auto 1fr;
    gap: 16px;
    align-items: baseline;
    padding: 18px 0;
    border-bottom: 1px solid var(--rule);
}

body[data-style="paper"] .where__where {
    font-family: "Courier New", monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--ink-dim);
}

body[data-style="paper"] .where__note { color: var(--ink-dim); font-style: italic; font-size: 15px; }

body[data-style="paper"] .rule {
    border: 0;
    height: 1px;
    background: var(--rule);
    margin: 50px auto;
    width: 80px;
    position: relative;
}

body[data-style="paper"] .rule::after {
    content: "✦";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--paper);
    color: var(--accent);
    padding: 0 8px;
    font-size: 14px;
}

body[data-style="paper"] .colophon {
    margin-top: 70px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
    text-align: center;
    font-size: 14.5px;
    color: var(--ink-soft);
    font-style: italic;
    line-height: 1.6;
}

body[data-style="paper"] .colophon__dim {
    color: var(--ink-dim);
    font-size: 12.5px;
    font-style: normal;
    font-family: "Courier New", monospace;
    letter-spacing: 0.4px;
}

body[data-style="paper"] .colophon__author {
    margin: 14px 0 0;
    font-style: normal;
    font-family: "Courier New", monospace;
    font-size: 11.5px;
    letter-spacing: 1px;
    text-transform: lowercase;
    color: var(--ink-dim);
}

body[data-style="modern"] {
    background: var(--m-bg);
    color: var(--m-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.74;
    -webkit-font-smoothing: antialiased;
    padding: 0 0 90px;
}

body[data-style="modern"] a {
    color: var(--m-text);
    text-decoration: none;
}

body[data-style="modern"] .hero {
    position: relative;
    min-height: 92vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    padding: 0 clamp(20px, 6vw, 80px) clamp(40px, 7vh, 80px);
}

body[data-style="modern"] .hero__media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

body[data-style="modern"] .hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
    filter: saturate(1.02) contrast(1.02);
}

body[data-style="modern"] .hero__veil {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(16,14,13,0.45) 0%, rgba(16,14,13,0) 28%, rgba(16,14,13,0.12) 55%, rgba(16,14,13,0.86) 100%);
}

body[data-style="modern"] .hero__inner {
    position: relative;
    z-index: 2;
    max-width: 760px;
}

body[data-style="modern"] .hero__kicker {
    margin: 0 0 14px;
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--m-soft);
}

body[data-style="modern"] .hero__name {
    margin: 0;
    font-family: "Georgia", "Times New Roman", serif;
    font-weight: 500;
    font-size: clamp(72px, 17vw, 188px);
    line-height: 0.9;
    letter-spacing: -0.04em;
}

body[data-style="modern"] .hero__line {
    margin: 20px 0 0;
    max-width: 30ch;
    font-size: clamp(16px, 2vw, 19px);
    color: var(--m-soft);
    line-height: 1.5;
}

body[data-style="modern"] .hero__links {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

body[data-style="modern"] .hero__links a {
    padding: 12px 26px;
    border-radius: 999px;
    font-size: 14px;
    letter-spacing: 0.4px;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

body[data-style="modern"] .hero__links a:first-child {
    background: var(--m-text);
    color: var(--m-bg);
}

body[data-style="modern"] .hero__links a:last-child {
    border: 1px solid rgba(239, 232, 222, 0.5);
    color: var(--m-text);
}

body[data-style="modern"] .hero__links a:hover { transform: translateY(-2px); }
body[data-style="modern"] .hero__links a:last-child:hover { background: rgba(239, 232, 222, 0.1); }

body[data-style="modern"] .hero__scroll {
    position: absolute;
    z-index: 2;
    right: clamp(20px, 6vw, 80px);
    bottom: clamp(40px, 7vh, 80px);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--m-dim);
    writing-mode: vertical-rl;
}

@media (max-width: 620px) {
    body[data-style="modern"] .hero__scroll { display: none; }
}

body[data-style="modern"] .page {
    max-width: 1020px;
    margin: 0 auto;
    padding: 70px clamp(20px, 6vw, 56px) 0;
}

body[data-style="modern"] .topbar {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--m-dim);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--m-line);
    margin-bottom: 64px;
}

body[data-style="modern"] .topbar__dot { opacity: 0.4; }

body[data-style="modern"] .entry {
    max-width: 720px;
    margin: 0 auto 72px;
    position: relative;
}

body[data-style="modern"] .entry__no {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--m-accent);
    text-transform: uppercase;
    margin-bottom: 10px;
}

body[data-style="modern"] .entry__title {
    font-family: "Georgia", "Times New Roman", serif;
    font-weight: 500;
    font-size: clamp(30px, 5vw, 46px);
    margin: 0 0 28px;
    letter-spacing: -0.02em;
    line-height: 1.08;
}

body[data-style="modern"] .entry p { margin: 0 0 20px; color: var(--m-soft); }

body[data-style="modern"] .entry em { color: var(--m-text); font-style: italic; }

body[data-style="modern"] .entry__lede {
    color: var(--m-text);
    font-size: 19px;
    max-width: 58ch;
}

body[data-style="modern"] .dropcap::first-letter {
    font-family: "Georgia", serif;
    font-size: 3.8em;
    line-height: 0.8;
    float: left;
    padding: 8px 14px 0 0;
    color: var(--m-accent);
}

body[data-style="modern"] .showcase {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 18px;
    margin: 40px 0 6px;
    width: min(940px, 100%);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

body[data-style="modern"] .showcase__item {
    margin: 0;
    position: relative;
}

body[data-style="modern"] .showcase__frame {
    overflow: hidden;
    border-radius: 4px;
    background: var(--m-bg2);
    cursor: zoom-in;
}

body[data-style="modern"] .showcase__frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

body[data-style="modern"] .showcase__item:hover .showcase__frame img { transform: scale(1.05); }

body[data-style="modern"] .showcase__item figcaption {
    margin-top: 11px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11.5px;
    letter-spacing: 0.5px;
    color: var(--m-dim);
}

body[data-style="modern"] .showcase__item:nth-child(1) { grid-column: span 4; }
body[data-style="modern"] .showcase__item:nth-child(1) .showcase__frame { aspect-ratio: 16 / 11; }
body[data-style="modern"] .showcase__item:nth-child(2) { grid-column: span 2; }
body[data-style="modern"] .showcase__item:nth-child(2) .showcase__frame { aspect-ratio: 3 / 4; }
body[data-style="modern"] .showcase__item:nth-child(3) { grid-column: span 2; }
body[data-style="modern"] .showcase__item:nth-child(3) .showcase__frame { aspect-ratio: 3 / 4; }
body[data-style="modern"] .showcase__item:nth-child(4) { grid-column: span 2; }
body[data-style="modern"] .showcase__item:nth-child(4) .showcase__frame { aspect-ratio: 3 / 4; }
body[data-style="modern"] .showcase__item:nth-child(5) { grid-column: span 2; }
body[data-style="modern"] .showcase__item:nth-child(5) .showcase__frame { aspect-ratio: 3 / 4; }

@media (max-width: 1020px) {
    body[data-style="modern"] .showcase {
        width: 100%;
        left: 0;
        transform: none;
    }
}

@media (max-width: 640px) {
    body[data-style="modern"] .showcase { grid-template-columns: repeat(2, 1fr); }
    body[data-style="modern"] .showcase__item:nth-child(1) { grid-column: span 2; }
}

body[data-style="modern"] .entry--letter {
    background: var(--m-bg2);
    border: 1px solid var(--m-line);
    border-radius: 10px;
    padding: clamp(28px, 5vw, 52px);
    max-width: 760px;
}

body[data-style="modern"] .entry--letter p { font-size: 18px; color: var(--m-soft); }

body[data-style="modern"] .letter__close { margin-top: 28px; color: var(--m-text); }

body[data-style="modern"] .letter__highlight {
    color: var(--m-accent);
    border-bottom: 1px solid var(--m-accent);
    padding-bottom: 1px;
}

body[data-style="modern"] .letter__sign {
    color: var(--m-dim);
    text-align: right;
    margin-top: 26px;
    font-size: 15px;
}

body[data-style="modern"] .where { list-style: none; margin: 0; padding: 0; }

body[data-style="modern"] .where li {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 20px 4px;
    border-top: 1px solid var(--m-line);
    transition: padding-left 0.25s ease;
}

body[data-style="modern"] .where li:last-child { border-bottom: 1px solid var(--m-line); }
body[data-style="modern"] .where li:hover { padding-left: 14px; }

body[data-style="modern"] .where__where {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--m-dim);
}

body[data-style="modern"] .where a {
    color: var(--m-text);
    font-size: 18px;
    font-family: "Georgia", serif;
}

body[data-style="modern"] .where a:hover { color: var(--m-accent); }

body[data-style="modern"] .where__note { color: var(--m-dim); font-size: 14px; }

body[data-style="modern"] .rule {
    border: 0;
    height: 1px;
    background: var(--m-line);
    margin: 64px auto;
    width: 100%;
    max-width: 720px;
}

body[data-style="modern"] .colophon {
    max-width: 720px;
    margin: 80px auto 0;
    padding-top: 28px;
    border-top: 1px solid var(--m-line);
    text-align: center;
    font-size: 14px;
    color: var(--m-dim);
    line-height: 1.7;
}

body[data-style="modern"] .colophon__dim {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    letter-spacing: 0.4px;
    color: var(--m-dim);
}

body[data-style="modern"] .colophon__author {
    margin: 14px 0 0;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 11.5px;
    letter-spacing: 1px;
    text-transform: lowercase;
    color: var(--m-dim);
}

body[data-style="modern"] .colophon__author a {
    color: var(--m-soft);
    border-bottom: 1px solid var(--m-line);
    padding-bottom: 1px;
    transition: color 0.2s ease;
}

body[data-style="modern"] .colophon__author a:hover { color: var(--m-accent); }

@media (max-width: 560px) {
    body[data-style="paper"] .float-photo--right,
    body[data-style="paper"] .float-photo--left {
        float: none;
        margin: 10px auto 22px;
    }

    body[data-style="paper"] .where li,
    body[data-style="modern"] .where li {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 700px) {
    body[data-style="paper"] .scrap { gap: 36px 18px; }
    body[data-style="paper"] .scrap__photo:nth-child(n) {
        grid-column: 1 / -1;
        margin-top: 0;
        max-width: 320px;
        justify-self: center;
    }
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 8, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    cursor: zoom-out;
}

.lightbox.is-open { display: flex; }

.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 4px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

body[data-style="paper"] .lightbox img {
    background: #fff;
    padding: 12px 12px 0;
    border-radius: 0;
}

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