:root {
    color-scheme: light dark;
    --bg: light-dark(#F7F7F4, #202722);
    --text: light-dark(#222620, #F0F0E9);
    --muted: light-dark(#656B60, #BDC5B9);
    --accent: light-dark(#63745B, #B7C6A7);
    --border: light-dark(#D8D8D0, #333C35);
    --card-bg: light-dark(#EFEFEA, #27302A);
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, color 0.2s ease;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 1rem;
    background: var(--text);
    color: var(--bg);
    padding: 0.75rem 1rem;
    z-index: 100;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border-radius: 4px;
}

.skip-link:focus {
    top: 1rem;
}

header {
    max-width: 42rem;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wordmark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.lang-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.5rem;
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
}

.lang-switcher a[aria-current="page"],
.lang-switcher a:hover {
    color: var(--text);
    text-decoration-color: var(--accent);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0 0.9rem;
    min-height: 44px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.theme-toggle[hidden],
.pause-btn[hidden] {
    display: none;
}

main {
    max-width: 42rem;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 1.5rem 5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
}

main:focus {
    outline: none;
}

section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

h1, h2 {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    line-height: 1.2;
}

h2 {
    font-size: 1.1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

p {
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hero-intro {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rotator-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.rotating-container {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--accent);
    height: 1.8rem;
    overflow: hidden;
    position: relative;
}

.rotating-text {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.fade-out {
    opacity: 0;
    transform: translateY(-8px);
}

@media (max-width: 36rem) {
    .rotating-container {
        height: 3.6rem;
        display: flex;
        align-items: center;
    }

    .rotating-text {
        white-space: normal;
        text-overflow: clip;
        line-height: 1.5;
    }
}

.pause-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    min-width: 44px;
    min-height: 44px;
}

.pause-btn:hover {
    color: var(--text);
}

.pause-btn .icon-play,
.pause-btn[data-paused="true"] .icon-pause {
    display: none;
}

.pause-btn[data-paused="true"] .icon-play {
    display: inline;
}

.hero-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.link-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.link-list a {
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    width: fit-content;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
    transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.link-list a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.error-page {
    flex: 1;
    justify-content: center;
    align-items: flex-start;
    min-height: 45vh;
}

.error-code {
    font-family: var(--font-mono);
    font-size: clamp(4rem, 12vw, 7rem);
    line-height: 1;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.08em;
}

.error-page h1 {
    margin-top: 0.5rem;
}

.error-page > p:not(.error-code) {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.home-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 0.5rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 6px;
}

.home-link:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

footer {
    max-width: 42rem;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--muted);
    font-family: var(--font-mono);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1.5rem;
    flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
    .rotating-text,
    body,
    .theme-toggle,
    .link-list a {
        transition: none !important;
    }

    html {
        scroll-behavior: auto;
    }
}
