/* ============================================================
   LOVEYOURSELF — PROTOKOLL
   Szigorúan monokróm. Csak #000 és #fff, szürke kizárólag
   a fehér áttetszőségeként. Semmi szín, sehol.
   ============================================================ */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; background: none; border: none; }
button { cursor: pointer; }
a { color: inherit; }

/* ---------- változók ---------- */
:root {
  --ink: #ffffff;
  --void: #000000;
  --ink-90: rgba(255,255,255,.90);
  --ink-70: rgba(255,255,255,.70);
  --ink-45: rgba(255,255,255,.45);
  --ink-25: rgba(255,255,255,.25);
  --ink-12: rgba(255,255,255,.12);
  --ink-06: rgba(255,255,255,.06);

  --f-display: 'Pirata One', 'UnifrakturMaguntia', serif;
  --f-mono: 'JetBrains Mono', 'Courier New', ui-monospace, monospace;

  --gap: clamp(1rem, 4vw, 2.5rem);
  --plate-max: 46rem;
}

/* ---------- betűtípusok ---------- */
@font-face {
  font-family: 'Pirata One'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/pirataone-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Pirata One'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/pirataone-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/jetbrainsmono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/jetbrainsmono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- alap ---------- */
html, body { height: 100%; }
body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: clamp(13px, 1.7vw, 15px);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--void); }

/* görgetősáv */
* { scrollbar-width: thin; scrollbar-color: var(--ink-25) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--ink-25); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- textúra: szemcse + scanline + vignetta ---------- */
.grain, .scan, .vig { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.grain {
  opacity: .16; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.55'/></svg>");
  animation: grainshift 640ms steps(3) infinite;
}
@keyframes grainshift {
  0%   { transform: translate(0,0); }
  33%  { transform: translate(-3px,2px); }
  66%  { transform: translate(2px,-3px); }
  100% { transform: translate(0,0); }
}
.scan {
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
  opacity: .5;
}
.vig { box-shadow: inset 0 0 min(28vw, 220px) min(6vw, 60px) #000; }

/* ---------- keret / HUD ---------- */
.hud {
  position: fixed; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem var(--gap);
  font-size: .62rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-45);
  pointer-events: none;
}
.hud--top { top: 0; border-bottom: 1px solid var(--ink-06); }
.hud--bottom { bottom: 0; border-top: 1px solid var(--ink-06); }
.hud span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud .live::after {
  content: '●'; margin-left: .5em; animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .15 } 50% { opacity: .9 } }

/* ---------- képernyők ---------- */
.screen {
  min-height: 100svh;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 4.5rem var(--gap) 4.5rem;
  position: relative; z-index: 10;
}
.screen.is-active { display: flex; animation: bleed .9s ease both; }
@keyframes bleed {
  from { opacity: 0; filter: blur(6px); transform: translateY(8px); }
  to   { opacity: 1; filter: blur(0);   transform: none; }
}

/* ---------- tipográfia ---------- */
.display {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: .95;
  letter-spacing: .01em;
  text-transform: lowercase;
}
h1.display { font-size: clamp(2.6rem, 12vw, 6.5rem); }
h2.display { font-size: clamp(1.7rem, 7vw, 3.2rem); }

.sys {
  font-size: .66rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--ink-45);
}
.sys--warn { color: var(--ink); }
.lead { max-width: 34rem; color: var(--ink-70); text-wrap: pretty; }
.center { text-align: center; }
.mt-1 { margin-top: .6rem } .mt-2 { margin-top: 1.2rem } .mt-3 { margin-top: 2rem } .mt-4 { margin-top: 3rem }

hr.rule {
  width: 100%; max-width: var(--plate-max); height: 1px;
  background: var(--ink-12); border: 0; margin: 1.6rem 0;
}

/* ---------- holló-intró ---------- */
#raven-stage, #raven-closed {
  width: min(62vw, 300px);
  display: grid; place-items: center;
  margin-bottom: .6rem;
}
#raven-stage .raven-fly, #raven-closed .raven-fly {
  width: 100%; display: grid; place-items: center;
}
#raven-stage svg, #raven-closed svg {
  width: 100%; height: auto; max-height: 56svh; overflow: visible;
}
/* a vektorizált eredeti rajz */
.raven-fly.is-traced svg { width: 100%; height: auto; max-height: 56svh; }
.raven-fly.is-traced path { fill: currentColor; }

/* a tartalék rajz: az indák magukat rajzolják ki, a tinta befröccsen */
.filigree path { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.2s ease-out both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.plumage path { opacity: 0; animation: splat .55s ease-out both; }
.raven-fly { animation: fly 2.9s cubic-bezier(.16,.84,.3,1) both; transform-origin: 50% 60%; }
@keyframes fly {
  0%   { transform: translate(-140%, -55%) rotate(-16deg) scale(.55); opacity: 0; }
  40%  { opacity: 1; }
  72%  { transform: translate(6%, 4%) rotate(3deg) scale(1.04); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.ink-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 2.6s ease-out .35s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.splat { opacity: 0; animation: splat .5s ease-out both; }
@keyframes splat { from { opacity: 0; transform: scale(.2) } to { opacity: 1; transform: none } }

/* ---------- űrlap ---------- */
.form { width: min(100%, 30rem); }
.field {
  display: flex; align-items: baseline; gap: .7rem;
  border-bottom: 1px solid var(--ink-25);
  padding: .55rem .2rem;
  transition: border-color .3s;
}
.field:focus-within { border-color: var(--ink); }
.field::before { content: '>'; color: var(--ink-45); }
.field input {
  flex: 1; min-width: 0;
  font-family: var(--f-mono); font-size: 1rem;
  letter-spacing: .18em; text-transform: lowercase;
  caret-color: var(--ink); outline: none;
}
.field input::placeholder { color: var(--ink-25); letter-spacing: .18em; }

.btn {
  display: inline-block; margin-top: 1.4rem;
  border: 1px solid var(--ink-45);
  padding: .55rem 1.6rem;
  font-size: .66rem; letter-spacing: .3em; text-transform: uppercase;
  transition: background .25s, color .25s, border-color .25s;
}
.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--void); border-color: var(--ink); outline: none; }
.btn:disabled { opacity: .3; pointer-events: none; }
.btn--ghost { border-color: var(--ink-12); color: var(--ink-45); }
.btn--ghost:hover { border-color: var(--ink); color: var(--void); }

.msg { min-height: 1.6em; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-45); }
.msg.is-bad { color: var(--ink); animation: shake .45s; }
@keyframes shake {
  0%,100% { transform: none } 20% { transform: translateX(-6px) } 40% { transform: translateX(5px) }
  60% { transform: translateX(-3px) } 80% { transform: translateX(2px) }
}

/* ---------- "lemez": invertált papírlap ---------- */
.plate {
  width: min(100%, var(--plate-max));
  background: #fff; color: #000;
  padding: clamp(1.2rem, 4.5vw, 2.6rem);
  margin: 1.4rem 0;
  box-shadow: 0 0 0 1px #fff, 0 26px 60px rgba(0,0,0,.9);
  position: relative;
  filter: contrast(1.06);
}
.plate::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix type='saturate' values='0'/></filter><rect width='120' height='120' filter='url(%23p)' opacity='.35'/></svg>");
  mix-blend-mode: multiply; opacity: .35;
}
.plate .plate-head {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: .6rem; letter-spacing: .26em; text-transform: uppercase;
  border-bottom: 1px solid #000; padding-bottom: .6rem; margin-bottom: 1.2rem;
}
.plate h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.6rem,6vw,2.4rem); line-height: 1; margin-bottom: .8rem; }
.plate p { margin-bottom: .9rem; }
.plate p:last-child { margin-bottom: 0; }
.plate strong { font-weight: 700; }
.plate .cipher {
  font-size: clamp(.72rem, 2.6vw, .92rem);
  letter-spacing: .32em; word-spacing: .5em; line-height: 2.1;
  word-break: break-word; text-transform: uppercase;
  border-block: 1px solid #000; padding: 1rem 0; margin: 1.2rem 0;
}
.plate .coords {
  display: flex; flex-wrap: wrap; gap: .5rem .9rem;
  font-size: .95rem; letter-spacing: .18em; margin: 1rem 0;
}
.plate .coords span { border: 1px solid #000; padding: .1rem .6rem; }
.plate .stamp {
  position: absolute; right: clamp(.8rem,3vw,1.6rem); bottom: clamp(.8rem,3vw,1.2rem);
  font-size: .58rem; letter-spacing: .3em; text-transform: uppercase;
  border: 1px solid #000; padding: .2rem .6rem; transform: rotate(-6deg); opacity: .55;
}
.plate figure { margin: 1.2rem 0; }
.plate figcaption { font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; margin-top: .5rem; opacity: .6; }
.plate .zoomable { cursor: zoom-in; border: 1px solid #000; width: 100%; }
.plate ol, .plate ul { margin: 0 0 .9rem 1.3rem; }
.plate li { margin-bottom: .35rem; }
.plate .redact { background: #000; color: #000; user-select: none; }

/* ---------- morze ----------
   Egy sorban, betűnként csoportosítva. A betűk közti köz és a
   szóelválasztó jel egyértelmű, különben nem lehet kiolvasni.  */
.morse {
  --morse-size: 1.15rem;
  font-size: var(--morse-size);
  line-height: 1.6;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: .4rem 0 .8rem;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}
.morse .mch {
  display: inline-block;
  margin-right: .78em;
  letter-spacing: .06em;
}
.morse .mch:last-child { margin-right: 0; }
.morse .mch i { font-style: normal; }
.morse .msep {
  display: inline-block;
  margin-right: .78em;
  font-weight: 400;
  opacity: .3;
}
/* ha nem fér ki: távirati szalag, bal széltől, elhalványuló szélekkel */
.morse.is-tape {
  text-align: left;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 2.5rem, #000 calc(100% - 2.5rem), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 2.5rem, #000 calc(100% - 2.5rem), transparent 100%);
  padding-inline: 1.6rem;
}
.morse::-webkit-scrollbar { height: 3px; }
.morse i.on { animation: flare .16s; }
@keyframes flare { from { text-shadow: 0 0 16px #fff, 0 0 4px #fff } to { text-shadow: none } }

/* ---------- countdown ---------- */
.count { display: flex; gap: clamp(.8rem, 4vw, 2.4rem); justify-content: center; }
.count div { text-align: center; }
.count b {
  display: block; font-family: var(--f-display); font-weight: 400;
  font-size: clamp(2.4rem, 11vw, 5rem); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.count small { font-size: .58rem; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-45); }

/* ---------- haladássáv ---------- */
.chain { display: flex; align-items: center; gap: .5rem; font-size: .6rem; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-25); }
.chain i { width: 26px; height: 1px; background: var(--ink-12); font-style: normal; }
.chain b { font-weight: 400; }
.chain .done { color: var(--ink); }

/* ---------- lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(0,0,0,.96); padding: 1rem;
  align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox.is-open { display: flex; }
#lightbox img { max-width: 100%; max-height: 92svh; object-fit: contain; background: #fff; }

/* ---------- egyéb ---------- */
.tiny { font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-25); }
.tiny a { text-decoration: none; border-bottom: 1px solid var(--ink-12); }
.tiny a:hover { color: var(--ink); border-color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: center; }
.mono-box {
  border: 1px solid var(--ink-25); padding: .8rem 1rem; margin-top: 1rem;
  font-size: .8rem; letter-spacing: .12em; word-break: break-all; color: var(--ink-70);
  max-width: min(100%, var(--plate-max));
}
.hide { display: none !important; }
.blink::after { content: '_'; animation: blink 1.05s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }

/* ---------- lore-oldalak ---------- */
.doc { max-width: 40rem; margin: 0 auto; padding: 5rem var(--gap); }
.doc h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(2rem,9vw,3.6rem); line-height: 1; margin-bottom: .4rem; }
.doc p { margin-bottom: 1rem; color: var(--ink-70); }
.doc .back { display: inline-block; margin-top: 2rem; }

/* ---------- mozgáscsökkentés ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .grain { animation: none; }
}
