/* Self-hosted fonts — served from /fonts on the same origin (no third-party
   request to Google, no FOUT, GDPR-friendly). Variable woff2: one file per
   family/style covers the whole weight range. Latin + latin-ext subsets. */
@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 300 500;
    font-display: swap;
    src: url("/fonts/fraunces-normal-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 300 500;
    font-display: swap;
    src: url("/fonts/fraunces-normal-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Fraunces";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/fraunces-italic-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Fraunces";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/fraunces-italic-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url("/fonts/jetbrains-mono-normal-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url("/fonts/jetbrains-mono-normal-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: light;
    --paper: #f4efe4;
    --ink: #181511;
    --muted: #6b6354;   /* 5.18:1 on paper — WCAG AA for normal text */
    --rule: #ddd5c4;
    --accent: #b8381f;  /* 5.05:1 on paper — AA for text, links and graphics */
    --measure: 60rem;
}

* {
    box-sizing: border-box;
}

html {
    /* 18px at the default 16px root, but scales with the user's browser setting */
    font-size: 112.5%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.5rem, 4vw, 3rem);
    display: flex;
    flex-direction: column;
    background-color: var(--paper);
    color: var(--ink);
    font-family: "Fraunces", Georgia, serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Film-grain texture overlay */
.grain {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Top meta bar */
.meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--rule);
    opacity: 0;
    animation: fade 0.9s ease 0.1s forwards;
}

/* Rotated edge label */
.rail {
    position: fixed;
    right: clamp(0.6rem, 2vw, 1.4rem);
    top: 50%;
    transform-origin: right center;
    transform: rotate(90deg) translateX(50%);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0;
    animation: fade 0.9s ease 1.1s forwards;
    z-index: 10;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: var(--measure);
    padding: 1.5rem 0;
}

/* Keycap line above wordmark */
.kbd-line {
    display: flex;
    gap: 0.35rem;
    margin: 0 0 1.1rem;
    opacity: 0;
    animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.35s forwards;
}

kbd {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink);
    background: linear-gradient(#fffdf7, #efe7d6);
    border: 1px solid var(--rule);
    border-bottom-width: 3px;
    border-radius: 6px;
    padding: 0.28rem 0.55rem;
    min-width: 1.9rem;
    text-align: center;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

h1 {
    margin: 0;
    font-weight: 300;
    font-size: clamp(2.8rem, 9vw, 5.5rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    font-optical-sizing: auto;
}

/* Refresh mark — spins once on load, and continuously while hovered */
.glyph {
    display: inline-block;
    font-size: 0.3em;
    color: var(--accent);
    vertical-align: 0.32em;
    margin-left: 0.18em;
    cursor: pointer;
    animation: spin 1.2s ease 0.4s;
}

.glyph:hover {
    animation: spin 0.9s linear infinite;
}

.lead {
    max-width: 28rem;
    margin: 1.8rem 0 2.2rem;
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 300;
    line-height: 1.3;
    opacity: 0;
    animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.7s forwards;
}

.lead em {
    font-style: italic;
    font-weight: 400;
    color: var(--accent);
}

.contact {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 3.5rem;
    opacity: 0;
    animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.9s forwards;
}

.contact li {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.contact .label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.contact a {
    font-size: 1.15rem;
    color: var(--ink);
    text-decoration: none;
    width: fit-content;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0% 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.32s ease, color 0.32s ease;
    padding-bottom: 2px;
}

.contact a:hover,
.contact a:focus-visible {
    color: var(--accent);
    background-size: 100% 1px;
}

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

footer {
    display: flex;
    gap: 0.6rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.9rem;
    border-top: 1px solid var(--rule);
    opacity: 0;
    animation: fade 0.9s ease 1.1s forwards;
}

footer .dot {
    color: var(--accent);
}

@keyframes fade {
    to { opacity: 1; }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(1.4rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

/* Fully honour reduced-motion: cancel the entrance reveals and both glyph
   spins (load and hover). If the user has asked for less motion, the brand
   mark holds still — it still reads as the refresh symbol without spinning. */
@media (prefers-reduced-motion: reduce) {
    .meta,
    .kbd-line,
    .lead,
    .contact,
    footer {
        animation: none;
        opacity: 1;
        transform: none;
    }

    /* .rail keeps its rotate(90deg) layout transform — only stop the fade */
    .rail {
        animation: none;
        opacity: 1;
    }

    .glyph,
    .glyph:hover {
        animation: none;
    }
}

@media (max-width: 34rem) {
    .rail { display: none; }
    .contact { flex-direction: column; gap: 1.2rem; }
}
