/*
 * keystro.ke
 * Copyright (C) 2026 Mike O'Riley
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 */

/**
 * ============================================================================
 * Options Terminal - sound and motion settings
 * ============================================================================
 *
 * Presentation for options-terminal.html. Same CRT-monitor bezel as
 * lesson-hall.html/records-room.html, duplicated here rather than shared per
 * this project's established per-page convention. Uses the main menu's
 * violet tile accent, the same way Records Room uses gold and Lesson Hall
 * uses cyan.
 * ============================================================================
 */

:root {
    --ground: #070914;
    --ground-deep: #04050c;
    --bezel: #14131c;
    --bezel-hi: #24222e;

    --ink: #f3f7ff;
    --ink-dim: #8b93c2;

    --violet: #8274ff;
    --violet-rgb: 130, 116, 255;

    --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: radial-gradient(circle at 50% 20%, #14131c, var(--ground-deep) 70%);
    color: var(--ink);
    font-family: var(--mono);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(6px, 2vmin, 24px);
}

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

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    background: var(--ground);
    color: var(--ink);
    border: 2px solid var(--violet);
    border-radius: 4px;
    font-family: var(--mono);
    font-weight: 700;
    text-decoration: none;
    transition: top 150ms ease;
}

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

/* ================= CRT MONITOR BEZEL ================= */

.monitor {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 2400px;
    max-height: 1400px;
    background: linear-gradient(155deg, var(--bezel-hi), var(--bezel) 40%, #0c0b12);
    border-radius: clamp(10px, 2.4vmin, 28px);
    padding: clamp(8px, 1.6vmin, 22px);
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.05),
        inset 0 -6px 14px rgba(0, 0, 0, 0.5);
}

.monitor::after {
    content: "keystro.ke 9000";
    position: absolute;
    left: 50%;
    bottom: clamp(2px, 0.8vmin, 8px);
    transform: translateX(-50%);
    font-size: clamp(0.45rem, 1.1vmin, 0.6rem);
    letter-spacing: 0.3em;
    color: rgba(243, 247, 255, 0.18);
}

.screen {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: clamp(6px, 1.4vmin, 10px);
    background: var(--ground);
    box-shadow:
        inset 0 0 0 2px rgba(0, 0, 0, 0.6),
        inset 0 0 60px rgba(0, 0, 0, 0.7),
        inset 0 0 120px rgba(var(--violet-rgb), 0.06);
}

.crt-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 0px,
            rgba(0, 0, 0, 0.16) 1px,
            rgba(0, 0, 0, 0) 2px
        ),
        radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
    mix-blend-mode: multiply;
    animation: crt-flicker 6.5s steps(60, end) infinite;
}

@keyframes crt-flicker {
    0%, 96%, 100% { opacity: 0.92; }
    97% { opacity: 0.98; }
    98% { opacity: 0.86; }
}

.screen-content {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(8px, 1.6vmin, 20px) clamp(10px, 2vmin, 26px);
}

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

/* ================= HUD STRIP ================= */

.hud {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2.4vmin, 30px);
    flex-wrap: wrap;
    padding-bottom: clamp(8px, 1.8vmin, 18px);
    border-bottom: 2px solid rgba(var(--violet-rgb), 0.22);
    font-size: clamp(0.7rem, 2vmin, 1.05rem);
}

.brand-mark {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.brand-mark:hover,
.brand-mark:focus-visible {
    color: var(--violet);
    text-decoration: underline;
}

.options-label {
    color: var(--ink-dim);
    letter-spacing: 0.12em;
    margin-left: auto;
}

/* ================= BANNER ================= */

.options-banner {
    text-align: center;
    padding: clamp(10px, 3vmin, 24px) 0 clamp(4px, 1.2vmin, 10px);
}

.options-kicker {
    margin: 0 0 0.4em;
    font-size: clamp(0.62rem, 1.5vmin, 0.85rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.options-title {
    margin: 0;
    font-size: clamp(1.3rem, 4.4vmin, 2.6rem);
    font-weight: 800;
    color: var(--ink);
    text-shadow: 0 0 18px rgba(var(--violet-rgb), 0.35);
}

/* ================= SCROLLABLE CONTENT ================= */

.options-viewport {
    flex: 1;
    min-height: 0;
    display: flex;
}

.options-lane {
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 3.6vmin, 40px);
    padding: 0 clamp(4px, 1vmin, 12px) clamp(16px, 3vmin, 32px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--violet-rgb), 0.4) transparent;
}

/* ================= SETTINGS PANEL ================= */

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.8vmin, 16px);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(12px, 2.4vmin, 24px);
    padding: clamp(14px, 2.4vmin, 20px) clamp(16px, 2.8vmin, 24px);
    border: 1px solid rgba(var(--violet-rgb), 0.28);
    border-radius: 14px;
    background: rgba(var(--violet-rgb), 0.05);
}

.setting-copy {
    min-width: 0;
}

.setting-name {
    margin: 0 0 0.3em;
    font-size: clamp(0.9rem, 2vmin, 1.05rem);
    font-weight: 700;
    color: var(--ink);
}

.setting-description {
    margin: 0;
    font-size: clamp(0.7rem, 1.5vmin, 0.85rem);
    color: var(--ink-dim);
    line-height: 1.4;
}

.setting-toggle {
    appearance: none;
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 36px;
    background: rgba(243, 247, 255, 0.04);
    border: 1px dashed rgba(243, 247, 255, 0.22);
    color: var(--ink-dim);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 6px 14px;
    cursor: pointer;
}

.setting-toggle:hover,
.setting-toggle:focus-visible {
    border-color: rgba(var(--violet-rgb), 0.6);
}

.setting-toggle[aria-checked="true"] {
    border: 1px solid rgba(var(--violet-rgb), 0.85);
    background: rgba(var(--violet-rgb), 0.2);
    color: var(--violet);
    box-shadow: 0 0 0.9rem rgba(var(--violet-rgb), 0.3);
}

.settings-note {
    margin: 0;
    font-size: clamp(0.66rem, 1.4vmin, 0.78rem);
    color: var(--ink-dim);
    text-align: center;
}

/* ================= FOOTER ================= */

.screen-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: clamp(6px, 1.6vmin, 14px);
    padding-top: clamp(4px, 1.2vmin, 10px);
    font-size: clamp(0.6rem, 1.3vmin, 0.85rem);
    color: var(--ink-dim);
}

.screen-footer a {
    color: var(--ink-dim);
    text-decoration: none;
}

.screen-footer a:hover,
.screen-footer a:focus-visible {
    color: var(--violet);
}

/* Manual override for the Options Terminal "Reduce motion" toggle
   (src/settings.js sets data-motion="reduce" on <html>) - a blanket
   animation/transition kill switch, unlike the hand-tuned
   prefers-reduced-motion block above which only targets this page's own
   specific animated elements. Lets someone reduce motion on this site
   without changing their OS-wide setting. */
:root[data-motion="reduce"] *,
:root[data-motion="reduce"] *::before,
:root[data-motion="reduce"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}
