@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700;800;900&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500&family=Noto+Serif+JP:wght@300;400;500;600;700;900&display=swap');

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

html {
    scroll-behavior: smooth;
}

html, body {
    background-color: #000005;
    color: #e6e6dc;
    font-family: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
    font-size: 18px;
    line-height: 1.75;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(220, 220, 235, 0.18);
    color: #ffffff;
}

#stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    display: block;
}

main {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* ===== PAGE: HOME ===== */

.home main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 6rem 2rem 4rem;
    text-align: center;
    opacity: 0;
    animation: fadeIn 2.4s ease-out 0.3s forwards;
}

.title {
    font-family: 'Cinzel', 'Cormorant Garamond', serif;
    font-weight: 900;
    font-size: clamp(3.4rem, 11vw, 8.4rem);
    letter-spacing: 0.10em;
    line-height: 1;
    color: #f6f6ed;
    text-shadow: 0 0 60px rgba(190, 200, 230, 0.12);
    animation: titleBreathe 11s ease-in-out infinite;
}

@keyframes titleBreathe {
    0%, 100% {
        color: #f6f6ed;
        text-shadow: 0 0 60px rgba(190, 200, 230, 0.10);
    }
    50% {
        color: #ffffff;
        text-shadow: 0 0 90px rgba(210, 220, 250, 0.22),
                     0 0 140px rgba(180, 195, 240, 0.10);
    }
}

@media (prefers-reduced-motion: reduce) {
    .title {
        animation: none;
    }
}

.katakana {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2.2rem);
    letter-spacing: 0.42em;
    margin-top: 2.2rem;
    color: #c7c7be;
    padding-left: 0.42em; /* visual balance for letter-spacing */
}

.works {
    position: relative;
    padding: 8rem 2rem 14rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7rem;
    opacity: 0;
    animation: fadeIn 2.4s ease-out 1.2s forwards;
}

.works-heading {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.6em;
    color: #7a7a72;
    padding-left: 0.6em;
    margin-bottom: 2rem;
}

.work {
    display: block;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.work:hover {
    transform: translateY(-4px);
}

.work .name {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4.5vw, 3.4rem);
    letter-spacing: 0.22em;
    color: #ededdf;
    padding-left: 0.22em;
    transition: color 0.6s ease, text-shadow 0.6s ease;
}

.work:hover .name {
    color: #ffffff;
    text-shadow: 0 0 36px rgba(255, 255, 255, 0.22);
}

.work .gloss {
    margin-top: 0.9rem;
    font-style: italic;
    color: #9c9c93;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    transition: color 0.6s ease;
}

.work:hover .gloss {
    color: #d0d0c4;
}

.work .divider {
    margin: 1.6rem auto 0;
    width: 28px;
    height: 1px;
    background: rgba(220, 220, 200, 0.25);
}

footer.site {
    padding: 4rem 2rem;
    text-align: center;
    color: #5a5a55;
    font-size: 0.82rem;
    letter-spacing: 0.28em;
    font-family: 'Cinzel', serif;
}

/* ===== PAGE: APP ===== */

nav.top {
    position: relative;
    z-index: 5;
    padding: 2.5rem 2rem 0;
    text-align: center;
}

nav.top a {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    letter-spacing: 0.42em;
    color: #b2b2a8;
    font-size: 0.78rem;
    padding-left: 0.42em;
    transition: color 0.5s ease;
}

nav.top a:hover {
    color: #ffffff;
}

nav.top .sep {
    display: inline-block;
    margin: 0 0.6em;
    color: #4a4a45;
}

.app-page main {
    padding-bottom: 12rem;
}

.app-hero {
    padding: 8rem 2rem 6rem;
    text-align: center;
    opacity: 0;
    animation: fadeIn 1.8s ease-out 0.2s forwards;
}

.app-hero h1 {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: clamp(3rem, 8.5vw, 6.4rem);
    letter-spacing: 0.14em;
    line-height: 1;
    color: #f6f6ed;
    padding-left: 0.14em;
    text-shadow: 0 0 50px rgba(190, 200, 230, 0.12);
}

.app-hero .lede {
    margin: 2.6rem auto 0;
    font-style: italic;
    color: #b8b8ae;
    font-size: 1.18rem;
    max-width: 36rem;
    line-height: 1.65;
}

.app-hero .download {
    display: inline-block;
    margin-top: 4rem;
    padding: 1.1rem 2.8rem;
    border: 1px solid rgba(230, 230, 220, 0.32);
    color: #e6e6dc;
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.42em;
    padding-left: calc(2.8rem + 0.42em);
    transition: all 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
    background: rgba(255, 255, 255, 0.005);
}

.app-hero .download:hover {
    border-color: rgba(255, 255, 255, 0.85);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 40px rgba(220, 230, 255, 0.08);
}

.screenshot {
    margin: 4rem auto 0;
    padding: 0 2rem;
    max-width: 1080px;
    opacity: 0;
    animation: fadeIn 2s ease-out 0.6s forwards;
}

.screenshot img {
    margin: 0 auto;
    box-shadow: 0 0 120px rgba(140, 150, 200, 0.12),
                0 0 40px rgba(140, 150, 200, 0.08);
    border-radius: 3px;
}

/* ===== MARKDOWN ARTICLE ===== */

article.guide {
    margin: 8rem auto 0;
    max-width: 42rem;
    padding: 0 2rem;
    opacity: 0;
    animation: fadeIn 2s ease-out 0.9s forwards;
}

article.guide > *:first-child {
    margin-top: 0;
}

article.guide h1 {
    display: none; /* the page hero already shows the title */
}

article.guide h2 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.2vw, 2.1rem);
    letter-spacing: 0.14em;
    padding-left: 0.14em;
    margin: 5rem 0 1.4rem;
    color: #f0f0e2;
    text-align: center;
}

article.guide h2::after {
    content: "";
    display: block;
    width: 32px;
    height: 1px;
    margin: 1.4rem auto 0;
    background: rgba(220, 220, 200, 0.22);
}

article.guide h3 {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 1.1rem;
    letter-spacing: 0.22em;
    padding-left: 0.22em;
    margin: 3.4rem 0 1rem;
    color: #e2e2d2;
}

article.guide h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: 1.18rem;
    letter-spacing: 0.02em;
    margin: 2.2rem 0 0.6rem;
    color: #d6d6c8;
}

article.guide p {
    margin: 1.1rem 0;
    color: #d2d2c8;
}

article.guide a {
    color: #f0f0e6;
    border-bottom: 1px solid rgba(240, 240, 230, 0.28);
    transition: border-color 0.4s ease, color 0.4s ease;
}

article.guide a:hover {
    color: #ffffff;
    border-bottom-color: #ffffff;
}

article.guide strong {
    color: #f6f6ed;
    font-weight: 600;
}

article.guide em {
    font-style: italic;
    color: #d8d8cc;
}

article.guide ul,
article.guide ol {
    margin: 1.1rem 0 1.1rem 1.6rem;
    color: #d2d2c8;
}

article.guide li {
    margin: 0.4rem 0;
}

article.guide li::marker {
    color: #888880;
}

article.guide blockquote {
    margin: 1.6rem 0;
    padding: 0.4rem 0 0.4rem 1.4rem;
    border-left: 1px solid rgba(220, 220, 200, 0.28);
    font-style: italic;
    color: #b8b8ac;
}

article.guide blockquote strong {
    color: #d0d0c0;
    font-style: normal;
    letter-spacing: 0.05em;
}

article.guide hr {
    border: none;
    background: none;
    height: 1.4em;
    margin: 4.5rem 0;
    text-align: center;
    overflow: visible;
    position: relative;
}

article.guide hr::after {
    content: "✦";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.3rem;
    color: rgba(220, 220, 200, 0.42);
    letter-spacing: 0;
}

article.guide code {
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    font-size: 0.86em;
    color: #ececdc;
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 7px;
    border-radius: 2px;
    letter-spacing: 0;
}

article.guide pre {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem 1.4rem;
    overflow-x: auto;
    border-left: 1px solid rgba(220, 220, 200, 0.18);
    margin: 1.6rem 0;
    font-size: 0.92rem;
    line-height: 1.6;
}

article.guide pre code {
    background: none;
    padding: 0;
    color: #d8d8c8;
}

article.guide table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.96rem;
}

article.guide thead {
    border-bottom: 1px solid rgba(220, 220, 200, 0.22);
}

article.guide th {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 0.74rem;
    letter-spacing: 0.22em;
    padding-left: 0.22em;
    padding: 0.9rem 0.8rem;
    text-align: left;
    color: #e8e8d8;
    text-transform: uppercase;
}

article.guide td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid rgba(220, 220, 200, 0.08);
    color: #d0d0c4;
    vertical-align: top;
}

article.guide tr:last-child td {
    border-bottom: none;
}

article.guide img {
    margin: 2rem auto;
    border-radius: 2px;
}

/* ===== ANIMATION ===== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */

/* ===== HEADING ANCHORS ===== */

article.guide h2 .anchor,
article.guide h3 .anchor {
    display: inline-block;
    margin-left: 0.5em;
    color: rgba(220, 220, 200, 0.4);
    border: none;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.65em;
    letter-spacing: 0;
    text-decoration: none;
    vertical-align: middle;
    opacity: 0;
    transition: opacity 0.5s ease, color 0.4s ease;
}

article.guide h2:hover .anchor,
article.guide h3:hover .anchor,
article.guide .anchor:focus-visible {
    opacity: 1;
}

article.guide .anchor:hover {
    color: #ffffff;
}

article.guide h2[id],
article.guide h3[id] {
    scroll-margin-top: 4rem;
}

/* ===== DOWNLOAD META ===== */

.app-hero .meta {
    margin: 1.2rem auto 0;
    font-family: 'Cinzel', serif;
    font-weight: 400;
    font-size: 0.68rem;
    letter-spacing: 0.42em;
    color: #6a6a64;
    padding-left: 0.42em;
}

/* ===== BACK TO TOP ===== */

#back-to-top {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 10;
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    padding: 0.9rem 1.4rem;
    padding-left: calc(1.4rem + 0.4em);
    color: #b8b8ae;
    background: rgba(8, 8, 14, 0.55);
    border: 1px solid rgba(220, 220, 200, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease, color 0.4s ease, border-color 0.4s ease;
}

#back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#back-to-top:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 640px) {
    #back-to-top {
        right: 1rem;
        bottom: 1rem;
        font-size: 0.62rem;
        padding: 0.7rem 1rem;
        padding-left: calc(1rem + 0.4em);
    }
}

/* ===== PRINT ===== */

@media print {
    html, body {
        background: #ffffff !important;
        color: #111 !important;
        font-size: 12pt;
    }

    #stars,
    nav.top,
    .app-hero .download,
    .app-hero .meta,
    .screenshot,
    #back-to-top,
    article.guide .anchor {
        display: none !important;
    }

    main {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .app-hero {
        padding: 0 0 1.5rem;
        text-align: left;
        animation: none !important;
        opacity: 1 !important;
    }

    .app-hero h1 {
        color: #000 !important;
        text-shadow: none !important;
        font-size: 28pt;
        letter-spacing: 0.08em;
    }

    .app-hero .lede {
        color: #333 !important;
        max-width: none;
        font-size: 12pt;
    }

    article.guide {
        margin: 1rem 0 0;
        padding: 0;
        max-width: 100%;
        animation: none !important;
        opacity: 1 !important;
    }

    article.guide h2,
    article.guide h3,
    article.guide h4 {
        color: #000 !important;
        text-align: left !important;
        page-break-after: avoid;
    }

    article.guide h2::after {
        background: #888 !important;
        margin-left: 0;
    }

    article.guide p,
    article.guide li,
    article.guide td {
        color: #222 !important;
    }

    article.guide a {
        color: #000 !important;
        border-bottom: 1px solid #999 !important;
    }

    article.guide blockquote {
        border-left-color: #888 !important;
        color: #444 !important;
    }

    article.guide hr {
        background: #888 !important;
    }

    article.guide pre,
    article.guide code {
        background: #f4f4f4 !important;
        color: #222 !important;
    }

    article.guide th {
        color: #000 !important;
    }

    article.guide table {
        page-break-inside: avoid;
    }
}

/* ===== SCROLL REVEAL ===== */

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ===== IMAGE LIGHTBOX ===== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 5, 0.84);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    cursor: zoom-out;
    padding: 4rem 2rem;
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 120px rgba(140, 150, 200, 0.18);
    border-radius: 3px;
    transform: scale(0.96);
    transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.lightbox.is-open img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 1.6rem;
    right: 2rem;
    color: rgba(230, 230, 220, 0.7);
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    letter-spacing: 0.42em;
    padding-left: 0.42em;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.4s ease;
}

.lightbox-close:hover {
    color: #ffffff;
}

.screenshot img {
    cursor: zoom-in;
    transition: box-shadow 0.6s ease;
}

.screenshot img:hover {
    box-shadow: 0 0 140px rgba(180, 190, 230, 0.20),
                0 0 60px rgba(180, 190, 230, 0.12);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
    html, body {
        font-size: 17px;
    }

    .hero {
        padding: 4rem 1.4rem 3rem;
    }

    .katakana {
        letter-spacing: 0.34em;
        padding-left: 0.34em;
    }

    .works {
        padding: 5rem 1.4rem 8rem;
        gap: 5rem;
    }

    nav.top {
        padding-top: 1.6rem;
    }

    .app-hero {
        padding: 5rem 1.4rem 4rem;
    }

    .app-hero .download {
        padding: 1rem 2rem;
        padding-left: calc(2rem + 0.42em);
        font-size: 0.72rem;
    }

    article.guide {
        margin-top: 5rem;
        padding: 0 1.4rem;
    }

    article.guide h2 {
        margin: 3.5rem 0 1rem;
    }

    article.guide table {
        font-size: 0.86rem;
    }
}
