/* St Nicholas's Castle - the website. Built from the game's own colours, letters and painted interface. */

@font-face { font-family: "Cinzel Decorative"; src: url("fonts/CinzelDecorative-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/Cinzel.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("fonts/EBGaramond.ttf") format("truetype"); font-weight: 400 800; font-display: swap; }

:root {
	--oak: #1c120a;
	--wood: #3a2614;
	--wood-2: #523720;
	--parch: #eadfc2;
	--parch-2: #dccca4;
	--ink: #2a1c0e;
	--ink-2: #5a4227;
	--gilt: #d4ab45;
	--gilt-2: #f1d68a;
	--red: #962219;
	--green: #3d6e2c;
	--read: "EB Garamond", Georgia, "Times New Roman", serif;
	--carve: "Cinzel", "EB Garamond", Georgia, serif;
	--sheet: min(1040px, calc(100vw - 32px));
}

* { box-sizing: border-box; }

html { background: var(--oak); scroll-behavior: smooth; }

body {
	margin: 0;
	color: var(--ink);
	font: 400 21px/1.55 var(--read);
	background:
		radial-gradient(1200px 500px at 50% 0, rgba(107, 74, 43, 0.35), transparent 70%),
		repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 7px, rgba(255, 220, 160, 0.03) 7px 8px, transparent 8px 23px),
		var(--oak);
	-webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--red); text-underline-offset: 0.15em; }
a:hover { color: #6e140e; }

:focus-visible { outline: 3px solid var(--gilt-2); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--parch); padding: 8px 14px; z-index: 20; }
.skip:focus { left: 8px; }

/* ------------------------------------------------------------------ the buttons of the game */
.btn {
	display: inline-block;
	min-width: 13.5em;
	padding: 0.5em 1.4em 0.55em;
	font: 600 1.05rem/1.2 var(--carve);
	letter-spacing: 0.02em;
	text-align: center;
	text-decoration: none;
	color: var(--gilt-2);
	text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
	border: 11px solid transparent;
	border-image: url("ui/btn_wood.png") 11 fill / 11px / 0 stretch;
	background: none;
	cursor: pointer;
}
.btn:hover, .btn:focus-visible { border-image-source: url("ui/btn_wood_hover.png"); color: #fff3cf; }
.btn:active { border-image-source: url("ui/btn_wood_pressed.png"); transform: translateY(1px); }
.btn small { display: block; font: 400 0.82rem/1.25 var(--read); letter-spacing: 0; color: #e9d9b0; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }

.btn.go { border-image-source: url("ui/btn_green.png"); color: #fff6d8; font-size: 1.3rem; }
.btn.go:hover, .btn.go:focus-visible { border-image-source: url("ui/btn_green_hover.png"); color: #fff; }
.btn.go:active { border-image-source: url("ui/btn_green_pressed.png"); }

/* ------------------------------------------------------------------ the hero: the title screen of the game */
.hero {
	position: relative;
	min-height: max(100svh, 640px);
	display: flex;
	align-items: center;
	overflow: hidden;
	background: #20160e;
	color: var(--parch);
}
.hero .scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 50%; }
.hero::after {      /* the dusk that the game lays over its title screen, so the lettering reads */
	content: "";
	position: absolute; inset: 0;
	background:
		linear-gradient(90deg, rgba(20, 12, 6, 0.86) 0, rgba(20, 12, 6, 0.55) 34%, rgba(20, 12, 6, 0) 62%),
		linear-gradient(0deg, rgba(20, 12, 6, 0.75) 0, rgba(20, 12, 6, 0) 26%);
	pointer-events: none;
}
.hero .menu { position: relative; z-index: 1; width: var(--sheet); margin: 0 auto; padding: 72px 0 96px; }

.hero h1 {
	margin: 0;
	max-width: 9.5em;
	font: 700 clamp(2.9rem, 7.2vw, 6.4rem)/0.98 "Cinzel Decorative", var(--carve);
	letter-spacing: 0.01em;
	color: var(--gilt-2);
	background: linear-gradient(180deg, #fbe7a8 0, #e9c66c 46%, #b98a2c 100%);
	-webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent;
	filter: drop-shadow(0 4px 0 rgba(35, 20, 8, 0.9)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
}
.hero .tale { margin: 0.9em 0 1.6em; font: 500 clamp(1rem, 1.7vw, 1.45rem)/1.3 var(--carve); letter-spacing: 0.06em; color: #f2e6c6; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
.hero .buttons { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.hero .buttons .btn { width: min(100%, 19rem); min-width: 0; }
.hero .version { margin: 1.4em 0 0; font-size: 0.95rem; color: #e6d7b0; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7); }
.hero .version a { color: var(--gilt-2); }

.still-btn {
	position: absolute; right: 16px; bottom: 16px; z-index: 2;
	font: 500 0.8rem/1 var(--read); color: #eadfc2; background: rgba(20, 12, 6, 0.6);
	border: 1px solid rgba(241, 214, 138, 0.5); border-radius: 4px; padding: 7px 10px; cursor: pointer;
}
.still-btn:hover { background: rgba(20, 12, 6, 0.85); }

/* ------------------------------------------------------------------ parchment on oak */
main { padding: 56px 0 24px; }

.sheet {
	width: var(--sheet);
	margin: 0 auto 56px;
	padding: 30px clamp(18px, 4vw, 56px) 34px;
	border: 30px solid transparent;
	border-image: url("ui/panel_parch.png") 30 fill / 30px / 0 round;
	filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45));
}
.sheet > :first-child { margin-top: 0; }
.sheet > :last-child { margin-bottom: 0; }
.sheet p, .sheet li { max-width: 66ch; }

.ribbon {
	display: inline-block;
	margin: -52px 0 22px -18px;
	padding: 2px 30px 5px 26px;
	font: 600 clamp(1.25rem, 2.4vw, 1.7rem)/1.3 var(--carve);
	letter-spacing: 0.03em;
	color: #fff1cf;
	text-shadow: 0 2px 0 rgba(60, 8, 4, 0.8);
	border: 8px solid transparent;
	border-image: url("ui/ribbon.png") 8 fill / 8px / 0 stretch;
}

.rule { height: 16px; margin: 26px 0; border: 0; background: url("ui/rule_ink.png") center / 256px 16px no-repeat; opacity: 0.8; }

.lead { font-size: 1.16em; line-height: 1.5; }

/* the letter: a seal where a signature would be */
.letter { position: relative; padding-bottom: 64px; }
.letter .seal { position: absolute; right: clamp(8px, 4vw, 48px); bottom: 2px; width: 84px; height: 84px; image-rendering: auto; filter: drop-shadow(0 4px 4px rgba(60, 20, 10, 0.45)); }
.letter .signed { margin-top: 1.4em; font-style: italic; color: var(--ink-2); }

/* pictures in dark frames */
.pictures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 34px; margin: 6px 0 0; padding: 0; list-style: none; }
.pictures li { max-width: none; margin: 0; }
.pictures button {
	display: block; width: 100%; padding: 0; cursor: zoom-in; background: #1a110a;
	border: 16px solid transparent;
	border-image: url("ui/panel_dark.png") 16 fill / 16px / 0 round;
}
.pictures img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.pictures p { margin: 10px 4px 0; font-size: 0.95em; line-height: 1.4; color: var(--ink-2); font-style: italic; }

/* three ways to play */
.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto 1fr auto auto; column-gap: 28px; margin-top: 8px; }
.way { display: grid; grid-row: span 4; grid-template-rows: subgrid; align-content: start; }
.way h3 { margin: 0 0 6px; align-self: end; font: 600 1.25rem/1.25 var(--carve); color: var(--red); }
.way ol { margin: 0 0 14px; padding-left: 1.25em; }
.way li { margin: 0 0 0.35em; padding-left: 0.2em; }
.way li::marker { font: 600 0.9em var(--carve); color: var(--ink-2); }
.way .btn { min-width: 0; width: 100%; }
.way .note { margin: 12px 0 0; font-size: 0.9em; line-height: 1.4; color: var(--ink-2); }

.beside { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.beside > div > :first-child { margin-top: 0; }
.beside figure { margin: 6px 0 0; }
.beside figure button {
	display: block; width: 100%; padding: 0; cursor: zoom-in; background: #1a110a;
	border: 16px solid transparent;
	border-image: url("ui/panel_dark.png") 16 fill / 16px / 0 round;
}
.beside figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.beside figcaption { margin: 10px 4px 0; font-size: 0.95em; line-height: 1.4; color: var(--ink-2); font-style: italic; }

figure.wide { float: right; width: min(44%, 420px); margin: 4px 0 18px 34px; }
figure.wide button {
	display: block; width: 100%; padding: 0; cursor: zoom-in; background: #1a110a;
	border: 16px solid transparent;
	border-image: url("ui/panel_dark.png") 16 fill / 16px / 0 round;
}
figure.wide img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
figure.wide figcaption { margin: 10px 4px 0; font-size: 0.95em; line-height: 1.4; color: var(--ink-2); font-style: italic; }
.sheet::after { content: ""; display: block; clear: both; }

.plain { margin: 0; padding-left: 1.15em; }
.plain li { margin-bottom: 0.45em; }

.new ul { margin: 0.3em 0 0; padding-left: 1.15em; }

/* the small print, on the oak itself */
footer { width: var(--sheet); margin: 0 auto; padding: 8px 0 44px; color: #cdbb93; font-size: 0.92rem; line-height: 1.5; }
footer a { color: var(--gilt-2); }
footer p { margin: 0 0 0.4em; }

/* a picture opened large */
.light { position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; padding: 3vmin; background: rgba(12, 7, 3, 0.92); }
.light.open { display: flex; }
.light img { max-width: 100%; max-height: 86vh; border: 16px solid transparent; border-image: url("ui/panel_dark.png") 16 fill / 16px / 0 round; }
.light p { position: absolute; left: 0; right: 0; bottom: 2vmin; margin: 0; text-align: center; color: var(--parch); font-style: italic; padding: 0 16px; }
.light button { position: absolute; top: 14px; right: 14px; width: 46px; height: 46px; border: 0; background: url("ui/btn_x.png") center / contain no-repeat; cursor: pointer; }
.light button:hover { background-image: url("ui/btn_x_hover.png"); }

/* pages of plain reading (how to play, privacy, licences) */
.page-head { width: var(--sheet); margin: 0 auto; padding: 34px 0 0; }
.page-head a { color: var(--gilt-2); font: 500 1rem var(--carve); text-decoration: none; }
.page-head a:hover { text-decoration: underline; }
.reading h2 { margin: 1.5em 0 0.4em; font: 600 1.3rem/1.3 var(--carve); color: var(--red); }
.reading h3 { margin: 1.2em 0 0.3em; font: 600 1.08rem/1.3 var(--carve); color: var(--ink); }
.reading pre { white-space: pre-wrap; font: 400 0.92em/1.5 var(--read); margin: 0; }
.reading ul { padding-left: 1.15em; }
.reading li { margin-bottom: 0.3em; }

@media (max-width: 880px) {
	body { font-size: 19px; }
	.ways { grid-template-columns: 1fr; grid-template-rows: none; row-gap: 30px; }
	.way { display: block; }
	.way .btn { margin-top: 4px; }
	.pictures { grid-template-columns: 1fr; }
	.beside { grid-template-columns: 1fr; }
	figure.wide { float: none; width: 100%; margin: 0 0 18px; }
	.hero { align-items: flex-end; }
	.hero::after { background: linear-gradient(0deg, rgba(20, 12, 6, 0.92) 0, rgba(20, 12, 6, 0.7) 45%, rgba(20, 12, 6, 0.15) 80%); }
	.hero .menu { padding: 120px 0 64px; }
	.hero .buttons { align-items: stretch; }
	.btn { min-width: 0; }
	.ribbon { margin-left: -8px; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.btn:active { transform: none; }
}
