/* Dominium: ink, parchment, a thread of gold, and the red of the banner on the one button.
   From the game's own menu (basicrp/ui/rp): browns #120e0a / #2a2015, golds #b9985a / #e5cc8b,
   parchment #c7b58b / #e5d9bf, sharp corners, a thin gold frame with a dark gap. Quiet but alive: the crest is forged out of the
   dark and breathes, a few embers rise, the rest fades in once. The page moves a whole section at a
   time (scroll snap). Only opacity and transforms are animated, so the opening stays smooth. */
:root {
  --night: #0a0807;
  --ink: #efe6d2;
  --text: #bfb296;
  --muted: #7f735f;
  --gold: #bf9c5f;
  --gold-hi: #e6cf96;
  --line: #efe6d21f;
  --red: #a31d22;
  --red-hi: #c1282d;
  --caps: 'Cinzel', Georgia, serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--night); scroll-behavior: smooth; scroll-snap-type: y mandatory; }
/* nothing may widen the page: on a phone it would sit crooked */
body { margin: 0; overflow-x: clip; background: transparent; color: var(--ink); font: 20px/1.6 var(--serif); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
svg { display: block; }
::selection { background: #a31d2288; color: #fff; }

/* the air: a warm light behind the crest, dark everywhere else, film grain */
.air { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 45% 38% at 50% 38%, #2b1f12 0%, transparent 70%), radial-gradient(ellipse 80% 30% at 50% 115%, #2a1209 0%, transparent 70%), var(--night); }
.air::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 85% 75% at 50% 42%, transparent 45%, #000000c8 100%); }
.embers { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
main { position: relative; z-index: 1; }
.grain-box { position: fixed; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.grain { position: absolute; inset: -50%; opacity: .06; mix-blend-mode: overlay; animation: grain 1s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 33% { transform: translate(-5%, 4%); } 66% { transform: translate(4%, -6%); } 100% { transform: translate(-3%, 5%); } }

/* ---- top: server state and Discord ---- */
.top { position: absolute; top: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: max(18px, env(safe-area-inset-top)) clamp(14px, 3vw, 40px) 18px; opacity: 0; transition: opacity 1.6s ease 2.8s; }
.ready .top { opacity: 1; }
.state { display: inline-flex; align-items: center; gap: 9px; font: 500 10.5px var(--caps); letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.state i { width: 6px; height: 6px; border-radius: 50%; background: #5d5446; }
.state.on i { background: #8fcb6a; box-shadow: 0 0 8px #8fcb6a; }
.state.off i { background: var(--red-hi); }
.discord { display: grid; place-items: center; width: 44px; height: 44px; color: var(--text); transition: color .3s; }
.discord svg { width: 24px; height: 24px; }
.discord:hover { color: #fff; }

/* ---- the crest and the one button ---- */
.hero { position: relative; overflow: hidden; min-height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.6vh; padding: 76px 20px 110px; }
/* Everything waits for .ready (app.js, once the crest is decoded), so nothing starts half-loaded. */
.crest-wrap { position: relative; width: min(54vh, 84vw); aspect-ratio: 1; opacity: 0; transform: translateY(14px) scale(1.05); transition: opacity 1.8s ease, transform 2.6s var(--ease); will-change: opacity, transform; }
.ready .crest-wrap { opacity: 1; transform: none; }
/* a warm light behind the crest, breathing */
.crest-glow { position: absolute; inset: -24%; border-radius: 50%; background: radial-gradient(circle, #ffb35a33 0%, #c1282d1f 28%, #c1282d0a 45%, transparent 64%); opacity: 0; transition: opacity 2.4s ease .4s; }
.ready .crest-glow { opacity: 1; animation: glow 6s ease-in-out 3s infinite; }
@keyframes glow { 50% { opacity: .55; transform: scale(.95); } }
.crest-float { position: relative; width: 100%; height: 100%; will-change: transform; }
.ready .crest-float { animation: float 8s ease-in-out 2.6s infinite; }
@keyframes float { 50% { transform: translateY(-9px); } }
.crest { width: 100%; height: 100%; filter: drop-shadow(0 40px 70px #000); }
/* forged: a white-hot glow over the metal that cools away */
.crest-heat { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  -webkit-mask: url(assets/logo.webp) center / contain no-repeat; mask: url(assets/logo.webp) center / contain no-repeat;
  background: radial-gradient(circle at 50% 45%, #fff3d0 0%, #ffb35a 45%, #c1282d 100%); }
.ready .crest-heat { animation: heat 2.8s ease-out .2s both; }
@keyframes heat { 0% { opacity: 0; } 22% { opacity: .9; } 100% { opacity: 0; } }
/* a light across the metal, now and then (app.js) */
.crest-shine { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay;
  -webkit-mask: url(assets/logo.webp) center / contain no-repeat; mask: url(assets/logo.webp) center / contain no-repeat;
  background: linear-gradient(110deg, transparent 40%, #fff6d6 48%, #fff 50%, #fff6d6 52%, transparent 60%) no-repeat; background-size: 260% 100%; background-position: 150% 0; }
.crest-shine.sweep { animation: shine 2.2s var(--ease); }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -60% 0; } }

/* the one button: the red of the banner in the frame of the game's menu (gold thread, dark gap, gold thread) */
.play { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 250px; height: 64px; padding: 0 48px; overflow: hidden; color: #fff7ea; text-decoration: none; font: 700 14px/1 var(--caps); letter-spacing: .36em; text-transform: uppercase; text-shadow: 0 1px 0 #4a0a0d, 0 0 18px #ffb35a55;
  background: radial-gradient(ellipse 70% 90% at 50% 0%, #e2443f 0%, transparent 70%), linear-gradient(180deg, #c42a2f 0%, #a31d22 50%, #7a1216 100%);
  box-shadow: inset 0 1px 0 #ffb0a066, inset 0 -3px 0 #4a0a0d, inset 0 0 0 1px #e6cf9680, 0 0 0 1px #1a0405, 0 0 0 5px #0a0807, 0 0 0 6px #bf9c5f80, 0 20px 50px #8a0f1470, 0 0 70px #c1282d33;
  margin-top: 1.4vh; opacity: 0; translate: 0 16px; transition: opacity 1.4s ease 2.1s, translate 1.6s var(--ease) 2.1s, transform .45s var(--ease), box-shadow .45s var(--ease), filter .3s; }
.ready .play { opacity: 1; translate: none; }
/* the line under the crest: it opens from the centre, between two gold threads */
.claim { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 0; font: 700 clamp(14px, 1.45vw, 19px)/1.4 var(--caps); letter-spacing: .3em; text-transform: uppercase; color: var(--ink); text-align: center; text-shadow: 0 2px 20px #000; }
.claim::before, .claim::after { content: ''; flex: none; width: clamp(30px, 6vw, 90px); height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); transform: scaleX(0); transition: transform 1.6s var(--ease) 1.5s; }
.claim::before { transform-origin: right; }
.claim::after { background: linear-gradient(270deg, transparent, var(--gold)); transform-origin: left; }
.claim span { opacity: 0; letter-spacing: .5em; transition: opacity 1.4s ease 1.2s, letter-spacing 2.2s var(--ease) 1.2s; }
.ready .claim::before, .ready .claim::after { transform: none; }
.ready .claim span { opacity: 1; letter-spacing: .3em; }
.play span { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; padding-left: .36em; }
.play span::before, .play span::after { content: ''; width: 6px; height: 6px; background: #e6cf96; transform: rotate(45deg); box-shadow: 0 0 8px #ffcf7a; }
.play::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 36%, #ffffff40 50%, transparent 64%); transform: translateX(-130%); animation: sheen 6s var(--ease) 3.4s infinite; }
@keyframes sheen { 0%, 70% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.play:hover { transform: translateY(-3px); filter: brightness(1.12); box-shadow: inset 0 1px 0 #ffb0a088, inset 0 -3px 0 #4a0a0d, inset 0 0 0 1px #f3e2b3, 0 0 0 1px #1a0405, 0 0 0 5px #0a0807, 0 0 0 6px #e6cf96, 0 26px 60px #a3141a80, 0 0 90px #e2443f44; }
.play:active { transform: translateY(0); }
.cue { position: absolute; left: 50%; bottom: 28px; width: 1px; height: 48px; background: linear-gradient(var(--gold), transparent); opacity: 0; transition: opacity 1.6s ease 3s; }
.ready .cue { opacity: 1; }
.play:focus-visible, .discord:focus-visible, .cue:focus-visible, .block a:focus-visible { outline: 1px solid var(--ink); outline-offset: 5px; }

/* ---- the sections: each fills the screen; the page stops on one, never halfway ---- */
.block { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 9vh; min-height: 100svh; padding: 13vh clamp(20px, 6vw, 90px); overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always; }
.block::before { content: ''; position: absolute; top: 0; left: 8%; right: 8%; height: 1px; background: linear-gradient(90deg, transparent, #bf9c5f40 30%, #bf9c5f40 70%, transparent); }
.block > * { position: relative; width: 100%; max-width: 1180px; margin: 0 auto; }
/* the crest again, huge and faint, half out of the page */
.block > .mark { position: absolute; top: 50%; width: min(95vh, 900px); max-width: none; margin: 0; opacity: .07; filter: grayscale(.4) sepia(.4); pointer-events: none; transform: translateY(-50%); }
.mark-left { left: max(-26vw, -460px); }
.mark-right { right: max(-26vw, -460px); }

.title { display: flex; flex-direction: column; gap: 22px; margin: 0; font: 700 clamp(40px, 4.6vw, 72px)/1.05 var(--caps); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); text-shadow: 0 6px 40px #000; }
.title::after { content: ''; width: 90px; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); }
.title-center { align-items: center; margin: 0 auto; text-align: center; }
.title-center::after { width: 140px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

#progetto .grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(30px, 5vw, 80px); align-items: start; }
.body p { margin: 0 0 1em; color: var(--text); font-size: 21px; }
.body p:last-child { margin-bottom: 0; }
.body .lead { font: 500 clamp(28px, 2.5vw, 38px)/1.28 var(--serif); color: var(--ink); }
.block a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: #efe6d266; }
.block a:hover { text-decoration-color: var(--ink); }

/* what you do here, in a band between two gold threads */
.trades { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 28px; list-style: none; padding: 26px 4px; border-top: 1px solid #bf9c5f40; border-bottom: 1px solid #bf9c5f40; }
.trades li { display: flex; align-items: center; gap: 28px; font: 500 clamp(12px, 1.1vw, 14px) var(--caps); letter-spacing: .32em; text-transform: uppercase; color: var(--gold-hi); }
.trades li + li::before { content: ''; width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); opacity: .7; }

/* the four steps, each in the frame of the game's menu */
.steps { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.steps li { position: relative; display: flex; flex-direction: column; padding: 34px 28px 32px; background: linear-gradient(180deg, #15110dcc, #0c0a08cc); box-shadow: inset 0 0 0 1px #bf9c5f4d, inset 0 0 0 5px #0a080780, inset 0 0 0 6px #bf9c5f1f, 0 24px 50px #000a; transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.steps li:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px #e6cf9688, inset 0 0 0 5px #0a080780, inset 0 0 0 6px #bf9c5f40, 0 30px 60px #000c; }
.n { font: 700 clamp(34px, 3vw, 46px)/1 var(--caps); color: var(--gold); text-shadow: 0 0 24px #bf9c5f40; }
.steps h3 { margin: 20px 0 10px; padding-top: 18px; border-top: 1px solid #bf9c5f33; font: 700 17px/1.3 var(--caps); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.steps p { margin: 0; color: var(--text); font-size: 19px; line-height: 1.5; }

/* a section fades in once, when it is reached */
.reveal { transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); }
.js .reveal:not(.seen) { opacity: 0; transform: translateY(18px); }

.foot { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); padding: 0 20px; text-align: center; font: 13px/1.5 var(--serif); color: var(--muted); }

/* ---- phones ---- */
@media (max-width: 1080px) and (min-width: 761px) {
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .hero { gap: 4vh; padding-bottom: 96px; }
  .crest-wrap { width: min(84vw, 50vh); }
  .play { width: min(100% - 12px, 320px); min-width: 0; }
  .claim { gap: 12px; letter-spacing: .2em; }
  .claim::before, .claim::after { width: 22px; }
  .ready .claim span { letter-spacing: .2em; }
  .block { gap: 34px; padding: 70px 20px 80px; }
  .block > .mark { width: 120vw; }
  .mark-left { left: -55vw; } .mark-right { right: -55vw; }
  .title { font-size: 34px; gap: 16px; }
  #progetto .grid { grid-template-columns: 1fr; gap: 22px; }
  .body .lead { font-size: 24px; }
  .body p { font-size: 18px; }
  .trades { justify-content: center; gap: 10px 16px; padding: 18px 0; }
  .trades li { gap: 16px; font-size: 10.5px; letter-spacing: .22em; }
  .steps { grid-template-columns: 1fr 1fr; gap: 12px; }
  .steps li { padding: 20px 16px; }
  .n { font-size: 28px; }
  .steps h3 { margin: 12px 0 6px; padding-top: 12px; font-size: 13px; }
  .steps p { font-size: 16px; line-height: 1.4; }
  .foot { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .crest-wrap, .play, .top, .cue, .claim span { opacity: 1; transform: none; translate: none; }
  .claim::before, .claim::after { transform: none; }
  .js .reveal:not(.seen) { opacity: 1; transform: none; }
}
