/* oneirosoft // site.css
   Day and night are the same page with different tokens. html[data-theme]
   is set before first paint by the script in the layout's head. */

@font-face {
	font-family: "04b03";
	src: url("/assets/fonts/04b_03.ttf") format("truetype");
	font-display: swap;
}

:root {
	/* brand palettes (CLAUDE.md) */
	--sky: #00E0ED;
	--mint: #8CF7C7;
	--green: #1AD18F;
	--lemon: #E0F58C;
	--lavender: #C7BDF7;
	--pink: #FF9EC7;
	--river: #0A3DF2;
	--night-ink: #0D0A29;
	--night-violet: #574D99;
	--night-navy: #050F61;
	--night-red: #FF404D;
	--seafoam: #59FFD9;

	--pixel: "04b03", ui-monospace, Consolas, monospace;
	--prose: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
	--gutter: 16px;
}

/* Day: white code water on the river, pastel windows (code water style C). */
:root,
:root[data-theme="day"] {
	--bg: var(--river);
	--water: #ffffff;
	--water-reveal: var(--lemon);
	--water-opacity: 0.5;
	--panel: #F2FFF9;
	--panel-alt: #FFFFFF;
	--bar: var(--lavender);
	--line: #050F61;
	--text: #050F61;
	--dim: #574D99;
	--accent: #E2337A;
	--link: var(--river);
	--glow-a: var(--pink);
	--glow-b: var(--sky);
	--shadow: #050F61;
	--select: var(--lemon);
	--door: var(--mint);
	--door-locked: #D9D4F2;
}

/* Night: seafoam code water in the dark, navy windows (code water style D). */
:root[data-theme="night"] {
	--bg: var(--night-ink);
	--water: var(--seafoam);
	--water-reveal: var(--pink);
	--water-opacity: 0.32;
	--panel: rgba(5, 15, 97, 0.92);
	--panel-alt: #0D0A29;
	--bar: var(--night-violet);
	--line: #8F86D9;
	--text: #DDF9EE;
	--dim: #A79FE0;
	--accent: var(--night-red);
	--link: var(--mint);
	--glow-a: var(--night-red);
	--glow-b: var(--sky);
	--shadow: #000000;
	--select: var(--night-violet);
	--door: #1B1660;
	--door-locked: #120F3A;
}

* { box-sizing: border-box; }

html {
	background: var(--bg);
	color: var(--text);
	transition: background-color 0.8s;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	font-family: var(--pixel);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: none;
	overflow-x: hidden;
}

::selection { background: var(--select); color: var(--text); }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }

button {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}

.water {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	opacity: var(--water-opacity);
	pointer-events: none;
	image-rendering: pixelated;
	transition: opacity 1.2s;
	z-index: 0;
}

.skip {
	position: absolute;
	left: -9999px;
}
.skip:focus { left: var(--gutter); top: var(--gutter); z-index: 10; background: var(--panel); padding: 4px 8px; }

/* ---- header bar ---- */

.bar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: stretch;
	gap: 0;
	border-bottom: 2px solid var(--line);
	background: var(--bar);
	color: var(--text);
	min-height: 36px;
}

.brand {
	display: flex;
	align-items: center;
	padding: 0 14px;
	border-right: 2px solid var(--line);
	color: var(--text);
	text-decoration: none;
	letter-spacing: 1px;
	white-space: nowrap;
}

.ticker {
	flex: 1;
	overflow: hidden;
	display: flex;
	align-items: center;
	min-width: 0;
	mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}

.ticker-track {
	display: flex;
	flex-shrink: 0;
	white-space: nowrap;
	animation: ticker 60s linear infinite;
}

/* Hold still while someone is reading it. */
.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker-track span { padding: 0 22px; }
.ticker-track span::before { content: "// "; color: var(--dim); }

@keyframes ticker { to { transform: translateX(-50%); } }

.nav {
	display: flex;
	align-items: stretch;
}

.nav a, .nav button {
	display: flex;
	align-items: center;
	padding: 0 12px;
	border-left: 2px solid var(--line);
	color: var(--text);
	text-decoration: none;
	white-space: nowrap;
}

.nav a:hover, .nav button:hover,
.nav a[aria-current="page"] { background: var(--panel); color: var(--accent); }

/* ---- page ---- */

.shell {
	position: relative;
	z-index: 1;
	width: min(1040px, 100% - 2 * var(--gutter));
	margin: 40px auto 64px;
}

.title {
	margin: 0 0 6px;
	font-size: 48px;
	line-height: 1.1;
	font-weight: normal;
	letter-spacing: 2px;
	color: var(--text);
	text-shadow: 3px 3px 0 var(--bg);
}

.subtitle {
	margin: 0 0 32px;
	color: var(--text);
}

.subtitle::before { content: "> "; color: var(--accent); }

.title-plate {
	display: inline-block;
	padding: 14px 18px 12px;
	background: var(--panel);
	border: 2px solid var(--line);
	box-shadow: 6px 6px 0 var(--shadow);
	margin-bottom: 32px;
}
.title-plate .subtitle { margin: 0; }

/* A window: a hard-edged pane with a title bar, like an old desktop. */
.window {
	background: var(--panel);
	border: 2px solid var(--line);
	box-shadow: 6px 6px 0 var(--shadow);
	margin-bottom: 28px;
}

.window-bar {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 3px 8px;
	background: var(--bar);
	border-bottom: 2px solid var(--line);
	color: var(--text);
}

.window-bar .controls { letter-spacing: 6px; color: var(--dim); }
.window-body { padding: 16px 18px; }
.window-body > :first-child { margin-top: 0; }
.window-body > :last-child { margin-bottom: 0; }

.prose {
	font-family: var(--prose);
	font-size: 15px;
	line-height: 1.65;
}

.line { margin: 0 0 4px; }
.line::before { content: "> "; color: var(--accent); }
.speaker { color: var(--accent); }
.dim { color: var(--dim); }

/* ---- glitch ---- */

[data-glitch] { position: relative; }

[data-glitch].glitching::before,
[data-glitch].glitching::after {
	content: attr(data-glitch);
	position: absolute;
	inset: 0;
	pointer-events: none;
	padding: inherit;
	display: inherit;
	align-items: inherit;
}

[data-glitch].glitching::before {
	color: var(--glow-a);
	transform: translate(-3px, 1px);
	clip-path: inset(10% 0 52% 0);
	mix-blend-mode: normal;
}

[data-glitch].glitching::after {
	color: var(--glow-b);
	transform: translate(3px, -1px);
	clip-path: inset(58% 0 6% 0);
}

[data-glitch].glitching { animation: shiver 0.09s steps(2) infinite; }

@keyframes shiver {
	50% { transform: translateX(2px); }
}

/* ---- the void's doors ---- */

.doors {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 28px;
	margin-bottom: 40px;
}

.door {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	aspect-ratio: 3 / 5;
	padding: 14px;
	background: var(--door);
	border: 2px solid var(--line);
	box-shadow: 6px 6px 0 var(--shadow);
	color: var(--text);
	text-decoration: none;
	transition: transform 0.15s, box-shadow 0.15s;
}

/* The knob. */
.door::after {
	content: "";
	position: absolute;
	right: 14px;
	top: 55%;
	width: 10px;
	height: 10px;
	background: var(--text);
}

.door-number { font-size: 56px; line-height: 1; }
.door-name { font-size: 16px; letter-spacing: 1px; }
.door-status { color: var(--dim); }

a.door:hover {
	color: var(--text);
	transform: translate(-3px, -3px);
	box-shadow: 9px 9px 0 var(--shadow);
}
a.door:hover .door-status { color: var(--accent); }

.door.locked {
	background: var(--door-locked);
	color: var(--dim);
	border-style: dashed;
	box-shadow: none;
}
.door.locked::after { background: var(--dim); }

/* ---- dream log ---- */

.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { border-bottom: 2px dashed var(--line); }
.log-list li:last-child { border-bottom: 0; }
.log-list a {
	display: grid;
	grid-template-columns: 160px 1fr;
	gap: 18px;
	align-items: center;
	padding: 12px 0;
	text-decoration: none;
	color: var(--text);
}
.log-list a:hover .log-title { color: var(--accent); }
.log-list img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--line); display: block; }
.log-title { font-size: 24px; }

.screen {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
	border: 2px solid var(--line);
	overflow: hidden;
}

.screen img, .screen iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border: 0;
}

.screen-notice {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	padding: 10px 16px;
	background: rgba(5, 15, 97, 0.88);
	color: #fff;
	border: 2px solid #fff;
	text-align: center;
	white-space: nowrap;
}

.frames {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 14px;
}
.frames figure { margin: 0; }
.frames img { width: 100%; display: block; border: 2px solid var(--line); }
.frames figcaption { color: var(--dim); margin-top: 4px; }

.split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 28px;
}

.tag {
	display: inline-block;
	padding: 0 6px;
	border: 2px solid var(--accent);
	color: var(--accent);
}

/* ---- the soft gate (bottom of the void) ---- */

.soft-gate {
	display: inline-block;
	margin-top: 12px;
	padding: 8px 12px;
	background: var(--panel);
	border: 2px dashed var(--line);
	max-width: 100%;
}

.soft-gate label { margin-right: 6px; }
.soft-gate label::first-letter { color: var(--accent); }

.soft-gate input {
	font: inherit;
	color: var(--text);
	background: transparent;
	border: 0;
	border-bottom: 2px solid var(--line);
	width: 28ch;
	max-width: 100%;
	padding: 0 2px;
	caret-color: var(--accent);
}

.soft-gate input:focus { outline: none; border-bottom-color: var(--accent); }
.soft-gate-reply { margin: 4px 0 0; min-height: 1.5em; }
.soft-gate-note { margin: 2px 0 0; font-size: 16px; opacity: 0.75; }

/* ---- the dream lab (private) ---- */

.dream {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	z-index: 0;
	pointer-events: none;
}

.dream[hidden], .water[hidden] { display: none; }

/* The leak: code water only in a strip down the right edge, flooding the
   whole screen for a moment now and then. */
.leaking .water {
	z-index: 0;
	opacity: 0.9;
	clip-path: inset(0 0 0 calc(100% - 96px));
	transition: clip-path 0.5s steps(6), opacity 0.5s;
}

.leaking.flooding .water {
	clip-path: inset(0 0 0 0);
	opacity: 0.75;
}

.lab-choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 14px; }
.choice.picked { background: var(--bar); color: var(--accent); }

/* ---- the listening room (private) ---- */

.whispers { width: 100%; border-collapse: collapse; }
.whispers th, .whispers td { text-align: left; padding: 6px 8px; border-bottom: 2px dashed var(--line); vertical-align: top; }
.whispers td.text { font-family: var(--prose); font-size: 15px; word-break: break-word; }
.whispers td.when { white-space: nowrap; color: var(--dim); }

/* ---- hidden rooms: their own colors, whatever the time ---- */

.room-video video {
	display: block;
	width: 100%;
	max-height: 70vh;
	background: #000;
	border: 2px solid var(--line);
}

.room-square video { aspect-ratio: 1; object-fit: contain; }
.room-video .window-body { position: relative; }

.room-sound {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

.page-room-purple-alien {
	--bg: #14031F;
	--water: #C45CFF;
	--water-reveal: #7DFF6A;
	--water-opacity: 0.4;
	--panel: rgba(38, 6, 56, 0.94);
	--bar: #5B1A80;
	--line: #D58CFF;
	--text: #F6E8FF;
	--dim: #C9A3E6;
	--accent: #7DFF6A;
	--link: #7DFF6A;
	--glow-a: #7DFF6A;
	--glow-b: #FF4FD8;
	--shadow: #000;
	--select: #5B1A80;
}

.page-room-katty {
	--bg: #1F120A;
	--water: #FFC46B;
	--water-reveal: #FF5A5A;
	--water-opacity: 0.3;
	--panel: rgba(48, 28, 16, 0.94);
	--bar: #7A3A22;
	--line: #E8A26A;
	--text: #FFEBD1;
	--dim: #D9AE86;
	--accent: #FF6F61;
	--link: #FFC46B;
	--glow-a: #FF5A5A;
	--glow-b: #FFC46B;
	--shadow: #000;
	--select: #7A3A22;
}

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

.foot {
	position: relative;
	z-index: 1;
	padding: 18px var(--gutter) 28px;
	border-top: 2px solid var(--line);
	background: var(--bar);
	color: var(--text);
	text-align: center;
}
.foot p { margin: 0 0 4px; }
.foot .small { color: var(--dim); }

/* ---- the gate ---- */

.page-gate { display: grid; place-items: center; min-height: 100vh; }
/* The gate starts in the dark; after you choose, the horizon fades in slowly. */
.page-gate .water { display: none; }
.page-gate .dream { opacity: 0; transition: opacity 7s ease-in; }
.page-gate.waking .dream { opacity: 1; }
.page-gate .gate {
	text-shadow: 2px 2px 0 var(--bg);
	padding: 18px 22px;
	border: 2px solid transparent;
	transition: background-color 3s, border-color 3s, box-shadow 3s;
}
/* Once the dream shows through, the text gets a window to stand in. */
.page-gate.waking .gate {
	background: var(--panel);
	border-color: var(--line);
	box-shadow: 6px 6px 0 var(--shadow);
}

.gate {
	position: relative;
	z-index: 1;
	width: min(640px, 100% - 2 * var(--gutter));
	min-height: 300px;
	font-size: 24px;
}

.gate .dim { font-size: 16px; }

.gate .line { min-height: 1.5em; }
.gate .cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.gate-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: 22px;
	opacity: 0;
	transition: opacity 0.6s;
	pointer-events: none;
}
.gate-choices.shown { opacity: 1; pointer-events: auto; }

.choice {
	padding: 8px 14px;
	background: var(--panel);
	border: 2px solid var(--line);
	box-shadow: 4px 4px 0 var(--shadow);
	color: var(--text);
}
.choice:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow); color: var(--accent); }
a.choice { display: inline-block; text-decoration: none; }

.gate-skip { position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: 1; color: var(--dim); }

/* ---- small screens ---- */

@media (max-width: 720px) {
	.bar { flex-wrap: wrap; }
	.brand { border-right: 0; padding: 6px 14px; }
	.ticker { order: 3; flex-basis: 100%; border-top: 2px solid var(--line); min-height: 30px; }
	.nav { flex-basis: 100%; border-top: 2px solid var(--line); min-height: 30px; }
	.nav a, .nav button { flex: 1 1 auto; justify-content: center; padding: 0 6px; }
	.nav > :first-child { border-left: 0; }
	.door { aspect-ratio: 4 / 5; }
	.title { font-size: 32px; }
	.doors { grid-template-columns: repeat(2, 1fr); gap: 16px; }
	.door-number { font-size: 40px; }
	.split { grid-template-columns: 1fr; }
	.log-list a { grid-template-columns: 96px 1fr; gap: 12px; }
	.log-list img { width: 96px; }
	.log-title { font-size: 18px; }
	.shell { margin-top: 24px; }
}

/* Reduced motion: the ticker still scrolls, just slowly (it's the site's
   news line), and stops on hover. */
@media (prefers-reduced-motion: reduce) {
	:root:not([data-motion="on"]) .ticker-track { animation-duration: 150s; }
	:root:not([data-motion="on"]) * { transition: none !important; }
}
