/* Kristian Hla Bu — landing page
   Ink-and-gilt hymnal on a night ground; the sol-fa modulator is the spine. */

:root {
    --night: #080b14;
    --night-2: #0d1524;
    --night-3: #131d31;
    --line: rgba(232, 236, 246, 0.11);
    --cream: #e8ecf6;
    --dim: #8b95ad;
    --gilt: #d9a441;          /* gilt as a fill (button, knob) */
    --accent: #d9a441;        /* gilt as text on the page ground */
    --blue: #5c86ff;
    --btn-ink: #1a1204;
    --nav-bg: rgba(8, 11, 20, 0.72);
    --track: rgba(232, 236, 246, 0.14);
    --knob: #e8ecf6;
    --mod-off: rgba(139, 149, 173, 0.4);
    --shadow: rgba(0, 0, 0, 0.85);

/* Matches the app: DM Serif Display for display type, a Google Sans stand-in
   for everything else. Google Sans itself is not licensed for web serving, so
   the stack asks for it first (installed on many Android devices) and falls
   back to Figtree, the closest free geometric humanist. */
    --display: "DM Serif Display", "Iowan Old Style", Georgia, serif;
    --body: "Google Sans", "Product Sans", "Figtree", ui-sans-serif, system-ui, -apple-system, sans-serif;

    --gap: clamp(52px, 6vw, 84px);
}

/* Light: the same ink-and-gilt, printed on paper instead of sung in the dark. */
:root[data-theme="light"] {
    --night: #f7f5f0;
    --night-2: #efece3;
    --night-3: #e7e3d8;
    --line: rgba(16, 19, 28, 0.14);
    --cream: #14181f;
    --dim: #5d6470;
    --accent: #8a5d0c;
    --blue: #2f56cf;
    --nav-bg: rgba(247, 245, 240, 0.78);
    --track: rgba(16, 19, 28, 0.14);
    --knob: #14181f;
    --mod-off: rgba(93, 100, 112, 0.45);
    --shadow: rgba(16, 19, 28, 0.32);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --night: #f7f5f0;
        --night-2: #efece3;
        --night-3: #e7e3d8;
        --line: rgba(16, 19, 28, 0.14);
        --cream: #14181f;
        --dim: #5d6470;
        --accent: #8a5d0c;
        --blue: #2f56cf;
        --nav-bg: rgba(247, 245, 240, 0.78);
        --track: rgba(16, 19, 28, 0.14);
        --knob: #14181f;
        --mod-off: rgba(93, 100, 112, 0.45);
        --shadow: rgba(16, 19, 28, 0.32);
    }
}

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

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

html, body { overflow-x: clip; }

body {
    margin: 0;
    background: var(--night);
    color: var(--cream);
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img { max-width: 100%; }

.wrap {
    width: min(1180px, 100% - 48px);
    margin-inline: auto;
}

.skip {
    position: absolute;
    left: -9999px;
    top: 12px;
    z-index: 100;
    background: var(--gilt);
    color: var(--btn-ink);
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
}

.skip:focus { left: 24px; }

/* ---------- type ---------- */

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 400;
    margin: 0;
    letter-spacing: -0.018em;
    line-height: 1.04;
    color: var(--cream);
}

h1 {
    font-size: clamp(2.7rem, 6.6vw, 5.1rem);
    margin-bottom: 26px;
}

h1 em {
    font-style: italic;
    color: var(--accent);
}

h2 { font-size: clamp(2rem, 4.1vw, 3.1rem); }

h3 {
    font-size: 1.16rem;
    letter-spacing: -0.008em;
    margin-bottom: 8px;
}

.eyebrow {
    font-weight: 600;
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 20px;
}

.lede {
    font-size: 1.06rem;
    color: var(--dim);
    max-width: 46ch;
    margin: 22px 0 0;
}

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

.nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 66px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-name {
    font-family: var(--display);
    font-size: 1.14rem;
    letter-spacing: -0.01em;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: none;
    color: var(--dim);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.theme-toggle .icon-sun { display: none; }

:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
    :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
}

/* ---------- buttons ---------- */

.btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
    background: var(--gilt);
    color: var(--btn-ink);
}

.btn-primary:hover {
    background: #eebb5b;
    transform: translateY(-2px);
}

.btn-secondary {
    border-color: var(--line);
    color: var(--cream);
}

.btn-secondary:hover {
    border-color: var(--cream);
    transform: translateY(-2px);
}

.btn-small {
    padding: 9px 20px;
    font-size: 0.86rem;
    border-color: var(--line);
}

.btn-small:hover { border-color: var(--accent); color: var(--accent); }

.cta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 34px;
}

/* ---------- modulator rail ---------- */

.modulator {
    position: fixed;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    display: none;
    flex-direction: column;
    gap: 14px;
    font-family: var(--display);
    font-size: 0.95rem;
    padding-left: 14px;
    border-left: 1px solid var(--line);
}

.mod-step {
    color: var(--mod-off);
    transition: color 0.4s ease, transform 0.4s ease;
}

.mod-step.is-lit {
    color: var(--accent);
    transform: translateX(4px);
}

@media (min-width: 1340px) {
    .modulator { display: flex; }
}

/* ---------- hero ---------- */

.hero {
    position: relative;
    padding: clamp(36px, 4.5vw, 62px) 0 clamp(44px, 5vw, 72px);
    overflow: hidden;
}

/* A stave: five hairlines, four spaces. The 45px height is 4 gaps of 11px plus
   the final 1px rule - at 44px the fifth line falls outside the box. */
.hero::before {
    content: "";
    position: absolute;
    inset: auto 0 26% 0;
    height: 45px;
    background: repeating-linear-gradient(
        to bottom,
        var(--line) 0 1px,
        transparent 1px 11px
    );
    -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.06fr 0.94fr;
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}

.hero-device {
    position: relative;
    margin: 0;
    justify-self: center;
    text-align: center;
    padding-top: 18px;
}

.device {
    position: relative;
    width: min(252px, 66vw);
    padding: 9px;
    border-radius: 34px;
    background: linear-gradient(160deg, #23304c, #0b1120 55%);
    box-shadow: 0 40px 70px -28px var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.device img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 26px;
}

.device-back {
    position: absolute;
    top: 0;
    right: 58%;
    width: min(174px, 46vw);
    rotate: -7deg;
    opacity: 0.85;
    z-index: 0;
}

.device-back img { border-radius: 20px; }

.device-front {
    z-index: 1;
    margin-inline: auto;
}

.hero-device figcaption {
    position: relative;
    z-index: 1;
    margin-top: 16px;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    color: var(--dim);
}

.hero-device figcaption em {
    font-family: var(--display);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--cream);
}

/* ---------- sections ---------- */

.section { padding: var(--gap) 0; }

/* ---------- voices ---------- */

.section-voices { background: var(--night-2); }

.voices-inner {
    display: grid;
    grid-template-columns: 1fr 0.85fr;
    gap: clamp(32px, 5vw, 76px);
    align-items: center;
}

.specs {
    margin: 32px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 18px 28px;
}

.specs div { border-top: 1px solid var(--line); padding-top: 14px; }

.specs dt {
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.specs dd {
    margin: 6px 0 0;
    font-size: 0.95rem;
    color: var(--dim);
}

.mixer {
    position: relative;
    padding: 30px 28px 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, var(--night-3), var(--night-2));
    overflow: hidden;
}

.fader {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.fader-name {
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--dim);
}

.fader-track {
    position: relative;
    height: 3px;
    border-radius: 3px;
    background: var(--track);
}

.fader-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--level);
    border-radius: 3px;
    background: var(--blue);
    animation: fader-rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.fader-fill::after {
    content: "";
    position: absolute;
    right: -7px;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--knob);
    transform: translateY(-50%);
    box-shadow: 0 2px 10px var(--shadow);
}

.fader:nth-child(2) .fader-fill { animation-delay: 0.08s; }
.fader:nth-child(3) .fader-fill { animation-delay: 0.16s; }
.fader:nth-child(4) .fader-fill { animation-delay: 0.24s; }

@keyframes fader-rise {
    from { width: 8%; }
    to { width: var(--level); }
}

/* ---------- closer ---------- */

.closer {
    padding: clamp(44px, 5vw, 68px) 0;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(217, 164, 65, 0.16), transparent 62%),
        var(--night);
    border-top: 1px solid var(--line);
}

.closer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
}

.closer .cta-row { margin-top: 0; }

.publisher {
    flex-basis: 100%;
    margin: 22px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    color: var(--dim);
}

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

.footer {
    border-top: 1px solid var(--line);
    padding: 26px 0;
    font-size: 0.84rem;
    color: var(--dim);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-solfa {
    font-family: var(--display);
    letter-spacing: 0.5em;
    color: var(--mod-off);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .hero-inner,
    .voices-inner {
        grid-template-columns: 1fr;
    }

    .hero-inner { gap: 34px; }
    .hero::before { display: none; }
    .lede { max-width: 100%; }
    .device-back { display: none; }
    .hero-device { padding-top: 0; }
}

@media (max-width: 560px) {
    body { font-size: 16px; }
    .wrap { width: min(1180px, 100% - 36px); }
    .cta-row { flex-direction: column; align-items: stretch; }
    .btn { text-align: center; }
}

/* ---------- a11y ---------- */

a:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ---------- content pages (/pages/{slug}) ---------- */

.page {
    padding: calc(var(--gap) + 42px) 0 var(--gap);
}

.page-inner {
    max-width: 68ch;
}

.page-title {
    font-size: clamp(2.1rem, 5vw, 3.1rem);
    color: var(--cream);
    margin-bottom: 28px;
}

/* The RichEditor emits h2/h3, p, ul/ol, blockquote, a, strong, em - nothing
   else needs styling here. */
.prose {
    color: var(--cream);
    line-height: 1.68;
}

.prose h2,
.prose h3 {
    color: var(--accent);
    margin: 2em 0 0.6em;
    line-height: 1.16;
}

.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.2rem; }
.prose h2:first-child,
.prose h3:first-child { margin-top: 0; }

.prose p,
.prose ul,
.prose ol,
.prose blockquote { margin: 0 0 1.1em; }

.prose ul,
.prose ol { padding-left: 1.3em; }

.prose li { margin-bottom: 0.4em; }

.prose a {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose blockquote {
    border-left: 2px solid var(--line);
    padding-left: 18px;
    color: var(--dim);
}

.prose img { border-radius: 10px; }

.page-updated {
    margin: var(--gap) 0 0;
    font-size: 0.84rem;
    color: var(--dim);
}

.footer-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

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