:root {
    --text-color: #2c2c2c;
    --primary-color: #4c436f;
    --primary-hover: #3a3457;
    --background-color: #f4f3f7;
    --surface-color: #faf9fc;
    --border-color: #d4d0e0;
    --muted-color: #7e769b;
    --accent-color: #6b5b8a;
    --sun-color: #f2d77d;
    --leaf-color: #849276;
    --sea-color: #8690a8;
    --content-width: 1440px;
    --reading-width: 720px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #dedbe5;
        --primary-color: #b5add2;
        --primary-hover: #d1cae7;
        --background-color: #18161f;
        --surface-color: #211e29;
        --border-color: #413c50;
        --muted-color: #aaa3bd;
        --accent-color: #a99fc8;
        --sun-color: #e7cf7e;
        --leaf-color: #9eaa91;
        --sea-color: #99a3ba;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
}

body {
    margin: 0 !important;
    padding: 0 !important;
    background: var(--background-color) !important;
    color: var(--text-color);
    font-family: "Source Serif 4", "Songti SC", "STSong", Georgia, serif;
    line-height: 1.7;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
}

body.home-page {
    overflow-x: clip;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.site-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 32px;
    width: min(100%, var(--content-width));
    margin: 0 auto !important;
    padding: 32px 48px !important;
}

.site-brand {
    justify-self: start;
    color: var(--text-color);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 29px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1;
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 32px;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 17px;
}

.site-nav-link {
    position: relative;
    padding: 8px 0 16px;
    color: var(--text-color);
    text-decoration: none;
}

.site-nav-link::after {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 0;
    height: 1px;
    background: var(--primary-color);
    content: "";
    transform: translateX(-50%);
    transition: width 200ms ease-out;
}

.site-nav-link:hover::after,
.site-nav-link[aria-current="page"]::after {
    width: 40px;
}

.site-nav-link[aria-current="page"]::before {
    position: absolute;
    left: 50%;
    bottom: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-color);
    content: "";
    transform: translateX(-50%);
}

.site-actions {
    display: flex;
    justify-self: end;
    align-items: center;
    gap: 16px;
}

.site-icon-link,
.site-icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    text-decoration: none;
}

.site-icon-link svg,
.site-icon-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.language-switch {
    color: var(--text-color);
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
}

.language-switch span {
    color: var(--muted-color);
}

.mobile-menu {
    display: none;
}

.site-header a:hover,
.site-header button:hover,
.site-footer a:hover {
    color: var(--primary-color);
}

.site-header a:focus-visible,
.site-header button:focus-visible,
.site-footer a:focus-visible,
.page-link:focus-visible,
.article-row a:focus-visible,
.voice-row a:focus-visible,
.featured-writing a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

.site-main {
    width: min(100%, var(--content-width));
    margin: 0 auto;
    padding: 32px 48px 96px;
}

.home-page .site-main {
    padding-bottom: 0;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(320px, 0.78fr) minmax(480px, 1.22fr);
    align-items: center;
    gap: 64px;
    min-height: 400px;
    margin-top: var(--layout-hero-block-y, 0px);
    padding: 32px 64px 64px;
}

.home-intro h1 {
    margin: 0;
    color: var(--text-color);
    font-family: "Playfair Display", "Songti SC", Georgia, serif;
    font-size: clamp(42px, 4.4vw, 68px);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.08;
}

.intro-heading-gap {
    height: calc(24px + var(--layout-intro-heading-gap-y, 0px));
}

.home-intro p {
    max-width: 520px;
    margin: 0 0 16px;
    color: var(--text-color);
    font-size: clamp(17px, 1.4vw, 21px);
    line-height: 1.65;
}

.home-intro p:last-child {
    margin-bottom: 0;
}

.scene {
    display: block;
    width: 100%;
    height: auto;
}

.hero-scene {
    transform: translate(
        var(--layout-hero-scene-position-x, 0px),
        var(--layout-hero-scene-position-y, 0px)
    );
}

.home-worlds {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 64px;
    align-items: start;
    padding: 0 16px;
}

.writing-voice-gap {
    display: none;
}

.layout-gap {
    width: 100%;
    min-height: 0;
}

.middle-top-gap {
    height: calc(64px + var(--layout-middle-top-gap-y, 0px));
}

.writing-rows-gap {
    height: var(--layout-writing-rows-gap-y, 0px);
}

.writing-cta-gap {
    height: calc(24px + var(--layout-writing-cta-gap-y, 0px));
}

.voice-heading-rows-gap {
    height: var(--layout-voice-heading-rows-gap-y, 0px);
}

.voice-cta-gap {
    height: calc(24px + var(--layout-voice-cta-gap-y, 0px));
}

.footer-gap {
    height: calc(32px + var(--layout-footer-gap-y, 0px));
}

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

.world-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.world-heading h2 {
    flex: 0 0 auto;
    margin: 0;
    color: var(--text-color);
    font-family: "Playfair Display", "Songti SC", Georgia, serif;
    font-size: clamp(30px, 3vw, 42px);
    font-weight: 500;
    letter-spacing: -0.02em;
}

.world-heading-line {
    position: relative;
    flex: 1;
    border-top: 1px solid var(--border-color);
}

.world-heading-line::before {
    position: absolute;
    top: -3px;
    left: 0;
    width: 5px;
    height: 5px;
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    background: var(--background-color);
    content: "";
}

.writing-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.95fr) minmax(280px, 1.05fr);
    gap: 16px;
    align-items: start;
}

.writing-scene {
    align-self: start;
    margin-top: calc(-48px + var(--layout-writing-scene-y, 0px));
    transform: translateX(var(--layout-writing-scene-x, 0px));
}

.writing-copy {
    margin-top: var(--layout-writing-copy-y, 0px);
    transform: translateX(var(--layout-writing-copy-x, 0px));
}

.featured-writing {
    padding-bottom: 24px;
}

.eyebrow {
    color: var(--primary-color);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.featured-writing h3 {
    margin: 8px 0 8px;
    font-family: "Playfair Display", "Songti SC", Georgia, serif;
    font-size: clamp(24px, 2.4vw, 34px);
    font-weight: 500;
    line-height: 1.2;
}

.featured-writing h3 a,
.read-more,
.article-row a,
.voice-row a {
    text-decoration: none;
}

.featured-writing p {
    display: -webkit-box;
    margin: 0 0 16px;
    overflow: hidden;
    color: var(--muted-color);
    font-size: 15px;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.read-more {
    color: var(--primary-color);
    font-size: 14px;
}

.article-rows,
.voice-rows,
.archive-list {
    border-top: 1px solid var(--border-color);
}

.article-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
    align-items: baseline;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.article-row time,
.article-row .article-row-date {
    color: var(--muted-color);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article-row a {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.article-row p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--muted-color);
    font-size: 12px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.voice-home-scene {
    width: min(100%, 620px);
    margin: calc(16px + var(--layout-voice-scene-y, 0px)) auto 0;
    transform: translateX(var(--layout-voice-scene-x, 0px));
}

.voice-row {
    display: grid;
    grid-template-columns: 40px minmax(100px, 0.7fr) minmax(160px, 1fr) 48px;
    gap: 16px;
    align-items: center;
    min-height: 64px;
    border-bottom: 1px solid var(--border-color);
}

.play-link {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--primary-color);
    text-decoration: none;
}

.play-link::before {
    width: 0;
    height: 0;
    margin-left: 2px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid currentColor;
    content: "";
}

.mini-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    overflow: hidden;
}

.mini-waveform i {
    display: block;
    width: 2px;
    height: calc(var(--wave, 4) * 1px);
    border-radius: 2px;
    background: var(--primary-color);
    opacity: 0.78;
}

.voice-row-title {
    min-width: 0;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.4;
}

.voice-duration {
    color: var(--muted-color);
    font-size: 12px;
    text-align: right;
}

.section-more {
    display: inline-block;
    margin-top: 0;
    color: var(--primary-color);
    font-size: 14px;
    text-decoration: none;
}

.archive-shell {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 64px 24px 96px;
}

.archive-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
    gap: 64px;
    align-items: end;
    margin-bottom: 64px;
}

.archive-header h1,
.voice-detail h1,
.about-shell h1 {
    margin: 0 0 16px;
    font-family: "Playfair Display", "Songti SC", Georgia, serif;
    font-size: clamp(42px, 5vw, 72px);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.08;
}

.archive-header p,
.archive-intro p {
    margin: 0 0 8px;
    color: var(--muted-color);
    font-size: 17px;
    line-height: 1.65;
}

.archive-count {
    justify-self: end;
    color: var(--primary-color);
    font-size: 14px;
}

.archive-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    gap: 24px;
    align-items: baseline;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.archive-item:first-child {
    border-top: 1px solid var(--border-color);
}

.archive-item-meta {
    color: var(--muted-color);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.archive-item a {
    color: var(--text-color);
    font-family: "Playfair Display", "Songti SC", Georgia, serif;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.35;
    text-decoration: none;
}

.archive-item p {
    display: -webkit-box;
    margin: 8px 0 0;
    overflow: hidden;
    color: var(--muted-color);
    font-size: 14px;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.archive-item-duration {
    color: var(--muted-color);
    font-size: 12px;
    text-align: right;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
}

.page-link {
    display: grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--muted-color);
    cursor: pointer;
}

.page-link[aria-current="page"] {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 6px;
}

.voice-detail {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 64px 24px 96px;
}

.back-link {
    display: inline-block;
    margin-bottom: 32px;
    color: var(--primary-color);
    font-size: 14px;
    text-decoration: none;
}

.voice-detail-meta {
    margin-bottom: 16px;
    color: var(--muted-color);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.voice-detail-language {
    margin: 0 0 32px;
    color: var(--muted-color);
    font-size: 14px;
}

.youtube-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.youtube-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.voice-project-note {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
    gap: 64px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.voice-project-note p {
    margin: 0 0 8px;
}

.youtube-link {
    justify-self: end;
    color: var(--primary-color);
    text-decoration: none;
}

.note-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 64px;
}

.note-navigation a {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
}

.note-navigation a:last-child {
    text-align: right;
}

.note-navigation span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted-color);
    font-size: 12px;
}

.about-shell,
.article-shell {
    width: min(100%, var(--reading-width));
    margin: 0 auto !important;
    padding: 64px 24px 96px;
}

.about-shell p {
    margin: 0 0 24px;
    font-size: 18px;
    line-height: 1.8;
}

.site-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 32px;
    width: min(calc(100% - 96px), calc(var(--content-width) - 96px));
    margin: 0 auto !important;
    padding: 32px 0 48px !important;
    border-top: 1px solid var(--border-color);
    color: var(--muted-color);
    font-size: 13px;
}

.site-footer p {
    margin: 0;
}

.footer-copyright {
    grid-row: 1;
    grid-column: 1;
}

.footer-message {
    display: flex;
    align-items: center;
    gap: 16px;
    grid-row: 1;
    grid-column: 2;
    color: var(--text-color);
}

.footer-planet {
    display: block;
    width: 48px;
    height: auto;
}

.footer-links {
    display: flex !important;
    justify-self: end;
    gap: 24px !important;
    grid-row: 1;
    grid-column: 3;
    font-size: 13px !important;
}

.footer-links a {
    color: var(--text-color) !important;
    text-decoration: none !important;
}

.search-dialog {
    width: min(calc(100% - 32px), 720px);
    padding: 0;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-color);
}

.search-dialog::backdrop {
    background: rgba(44, 44, 44, 0.2);
    backdrop-filter: blur(4px);
}

.search-panel {
    padding: 32px;
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 16px 0;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    outline: 0;
    background: transparent;
    color: var(--text-color);
    font-family: "Playfair Display", "Songti SC", Georgia, serif;
    font-size: 28px;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-close {
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 24px;
}

.search-status {
    min-height: 24px;
    margin: 16px 0;
    color: var(--muted-color);
    font-size: 13px;
}

.search-results {
    display: flex;
    flex-direction: column;
    max-height: 50vh;
    overflow: auto;
}

.search-result {
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    text-decoration: none;
}

.search-result span {
    display: block;
    color: var(--muted-color);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.search-result strong {
    display: block;
    margin-top: 4px;
    font-weight: 500;
}

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

@media (max-width: 1024px) {
    .site-header,
    .site-main {
        padding-right: 32px !important;
        padding-left: 32px !important;
    }

    .home-hero {
        grid-template-columns: minmax(280px, 0.8fr) minmax(400px, 1.2fr);
        gap: 32px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .home-worlds {
        gap: 48px;
        padding-right: 0;
        padding-left: 0;
    }

    .writing-layout {
        grid-template-columns: 180px minmax(0, 1fr);
        gap: 16px;
    }

    .article-row {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .article-row p {
        display: none;
    }
}

@media (max-width: 800px) {
    .site-header {
        grid-template-columns: 1fr auto;
        padding-top: 24px !important;
        padding-bottom: 24px !important;
    }

    .site-nav,
    .desktop-only {
        display: none;
    }

    .site-actions {
        grid-column: 2;
    }

    .mobile-menu {
        position: relative;
        display: block;
    }

    .mobile-menu summary {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
        list-style: none;
    }

    .mobile-menu summary::-webkit-details-marker {
        display: none;
    }

    .mobile-menu summary::before,
    .mobile-menu summary::after {
        position: absolute;
        width: 20px;
        border-top: 1px solid currentColor;
        content: "";
    }

    .mobile-menu summary::before {
        transform: translateY(-4px);
    }

    .mobile-menu summary::after {
        transform: translateY(4px);
    }

    .mobile-menu[open] summary::before {
        transform: rotate(45deg);
    }

    .mobile-menu[open] summary::after {
        transform: rotate(-45deg);
    }

    .mobile-menu-panel {
        position: absolute;
        z-index: 10;
        top: 48px;
        right: 0;
        display: flex;
        flex-direction: column;
        width: 220px;
        padding: 16px 24px;
        border: 1px solid var(--border-color);
        background: var(--background-color);
    }

    .mobile-menu-panel a {
        padding: 12px 0;
        text-decoration: none;
    }

    .home-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        padding-top: 48px;
    }

    .hero-scene {
        width: min(100%, 680px);
        margin: -16px auto 0;
    }

    .home-worlds {
        grid-template-columns: 1fr;
        gap: 0;
        padding-top: 0;
    }

    .writing-voice-gap {
        display: block;
        height: calc(96px + var(--layout-writing-voice-gap-y, 0px));
    }

    .archive-header,
    .voice-project-note {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .archive-count,
    .youtube-link {
        justify-self: start;
    }

    .site-footer {
        grid-template-columns: 1fr;
        gap: 16px;
        width: calc(100% - 64px);
    }

    .footer-message,
    .footer-links {
        justify-self: start;
    }

    .footer-message {
        order: 1;
        grid-row: auto;
        grid-column: 1;
    }

    .footer-links {
        order: 2;
        grid-row: auto;
        grid-column: 1;
    }

    .footer-copyright {
        order: 3;
        grid-row: auto;
        grid-column: 1;
    }
}

@media (max-width: 560px) {
    .site-header,
    .site-main {
        padding-right: 16px !important;
        padding-left: 16px !important;
    }

    .site-brand {
        font-size: 24px;
    }

    .site-actions {
        gap: 8px;
    }

    .language-switch {
        font-size: 13px;
    }

    .home-hero {
        gap: 24px;
        padding: 32px 0 0;
    }

    .home-intro h1 {
        font-size: 42px;
    }

    .home-intro p {
        font-size: 17px;
    }

    .home-worlds {
        gap: 0;
    }

    .writing-layout {
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 8px;
    }

    .writing-scene {
        margin-top: calc(16px + var(--layout-writing-scene-y, 0px));
    }

    .featured-writing h3 {
        font-size: 24px;
    }

    .article-row {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 8px;
        padding: 16px 0;
    }

    .voice-row {
        grid-template-columns: 34px minmax(72px, 0.42fr) minmax(0, 1fr) 40px;
        gap: 8px;
    }

    .voice-row-title {
        font-size: 13px;
    }

    .archive-shell,
    .voice-detail,
    .about-shell,
    .article-shell {
        padding: 48px 16px 80px;
    }

    .archive-item {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        gap: 8px;
        padding: 16px 0;
    }

    .archive-item a {
        font-size: 18px;
    }

    .note-navigation {
        grid-template-columns: 1fr;
    }

    .note-navigation a:last-child {
        text-align: left;
    }

    .site-footer {
        width: calc(100% - 32px);
    }

    .search-panel {
        padding: 24px;
    }

    .search-input {
        font-size: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
