/* ==========================================================
   Lófarmi Hírmondó — fekete-fehér, lapozható esküvői újság
   ========================================================== */
:root {
  --paper: #f3f2ee;
  --paper-back: #e9e8e3;
  --ink: #141414;
  --rule: #141414;
  --muted: #555;
  --desk: #24101f;
  --serif: "Old Standard TT", "Times New Roman", Georgia, serif;
  --mast: "UnifrakturMaguntia", "Old Standard TT", serif;
  --ui: "Hanken Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 30%, #43203b, var(--desk) 70%);
  color: var(--ink);
  font-family: var(--serif);
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-x: clip;
}
html { overflow-x: hidden; overflow-x: clip; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- vezérlősáv ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .4rem clamp(1rem, 3vw, 2rem);
  color: #eee;
  font: 500 .9rem/1 var(--ui);
}
.bar a { color: #eee; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; }
.bar a:hover { text-decoration: underline; }

.stage {
  flex: 1;
  width: 100%;
  overflow: hidden;
  overflow: clip;
  display: grid;
  place-items: center;
  padding: 0 .5rem .75rem;
}

/* ---------- könyv ----------
   Egyoldalas (mobil) és kétoldalas (széles kijelző) mód.
   A JS a .pg szekciókat lapokra (.leaf) rendezi: elöl páratlan, hátul páros oldal. */
.book {
  /* a lap kitölti a képernyőt: a teljes magasságot a vezérlők levonásával */
  --ph: calc(100svh - 8.25rem);
  --pw: min(calc(100vw - 1.25rem), calc(var(--ph) / 1.05));
  position: relative;
  width: var(--pw);
  height: var(--ph);
  perspective: 2600px;
  touch-action: pan-y;
  transition: transform .7s cubic-bezier(.3, .1, .2, 1);
}
.book.spread {
  --pw: min(calc((100vw - 2.5rem) / 2), calc(var(--ph) / 1.15));
  width: calc(var(--pw) * 2);
}
/* az első és utolsó oldal középre kerül, mint egy becsukott könyvnél */
.book.spread.at-start { transform: translateX(-25%); }
.book.spread.at-end { transform: translateX(25%); }
.book.no-anim, .book.no-anim .leaf { transition: none !important; }

.pg { display: none; } /* JS-ből kerülnek a lapokra */

.leaf {
  position: absolute; inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.3, .1, .2, 1), visibility 0s linear .9s;
}
.spread .leaf { left: 50%; width: 50%; }
.leaf.turned { transform: rotateY(-180deg); }
.single .leaf.turned { visibility: hidden; }
.leaf.turning { visibility: visible; transition: transform .9s cubic-bezier(.3, .1, .2, 1); }

.face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--paper);
  box-shadow: 0 1px 0 #fff inset, 0 24px 50px -18px rgb(0 0 0 / .7);
  overflow: hidden;
  container-type: inline-size;
}
.face .pg { display: block; height: 100%; }
.face::before { /* papírszemcse */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.face::after { /* gerinc árnyék */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, rgb(0 0 0 / .16), transparent);
}
.back { transform: rotateY(180deg); }
.back::after { left: auto; right: 0; background: linear-gradient(-90deg, rgb(0 0 0 / .16), transparent); }
.back.blank { background: var(--paper-back); }
.spread .face { cursor: pointer; }
.spread .face a, .spread .face button { cursor: pointer; }

/* oldaltartalom – minden a lapszélességhez skálázódik (cqi) */
.page {
  position: relative;
  height: 100%;
  overflow: hidden;
  overflow-wrap: break-word;
  padding: 5cqi 5.5cqi 4cqi 6.5cqi;
  font-size: max(11.5px, 2.45cqi);
  line-height: 1.45;
  scrollbar-width: thin;
}
.page p { margin: 0 0 .7em; hyphens: auto; }
.folio {
  display: flex; justify-content: space-between;
  font-size: .78em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .35em;
  margin-bottom: 1em;
  font-style: italic;
}

/* ---------- címlap ---------- */
.mast {
  font-family: var(--mast);
  font-weight: 400;
  font-size: min(3.9em, 9.6cqi);
  line-height: 1;
  text-align: center;
  margin: 0;
  padding-bottom: .12em;
  border-bottom: 4px double var(--rule);
}
.meta {
  display: flex; justify-content: space-between; gap: .5em;
  font-size: .78em;
  border-bottom: 1px solid var(--rule);
  padding: .4em 0;
  margin-bottom: 1.1em;
}
.extra {
  text-align: center;
  font-size: .8em;
  letter-spacing: .3em;
  margin: 0 0 .2em;
}
.headline {
  font-family: var(--serif);
  font-weight: 700;
  font-size: min(4.1em, 7.2cqi);
  line-height: .95;
  overflow-wrap: normal;
  text-align: center;
  margin: 0 0 .25em;
  text-transform: uppercase;
  letter-spacing: -.01em;
}
.deck {
  text-align: center;
  font-style: italic;
  font-size: 1.15em;
  max-width: 34em;
  margin: 0 auto 1em;
  line-height: 1.3;
}

h2.h {
  font-weight: 700;
  font-size: min(2.6em, 7cqi);
  line-height: 1;
  margin: 0 0 .3em;
}
h3.sub {
  font-weight: 700;
  font-size: 1.15em;
  margin: 1em 0 .3em;
  line-height: 1.2;
}
.byline { font-style: italic; color: var(--muted); margin-bottom: .8em; font-size: .9em; }

.cols { column-count: 2; column-gap: 1.6em; column-rule: 1px solid #bbb; text-align: justify; }
.cols-3 { column-count: 3; column-gap: 1.2em; column-rule: 1px solid #bbb; text-align: justify; }
.cols > *, .cols-3 > * { break-inside: avoid-column; }
.dropcap::first-letter {
  float: left;
  font-size: 3.3em;
  line-height: .82;
  padding: .06em .08em 0 0;
  font-weight: 700;
}

/* fotó (fekete-fehér, rácsos) */
.np-photo {
  position: relative;
  margin: 0 0 .9em;
  background: repeating-radial-gradient(circle at 40% 40%, #bdbdbd 0 1px, #dcdcdc 1px 3px);
  border: 1px solid var(--rule);
  aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  overflow: hidden;
}
.np-photo.tall { aspect-ratio: 4 / 5; }
.np-photo.cover { aspect-ratio: 3 / 1; }
.np-photo.wide { aspect-ratio: 2.2 / 1; }
.np-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.15) brightness(1.03);
}
.np-photo::after { /* nyomdai raszter */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgb(0 0 0 / .18) .6px, transparent .9px) 0 0 / 3px 3px;
  mix-blend-mode: multiply;
}
.np-photo .hint { font: .8em/1.3 var(--ui); background: var(--paper); padding: .3em .6em; border: 1px solid #999; position: relative; z-index: 1; }
.caption { font-size: .8em; font-style: italic; margin: -.5em 0 1em; color: #333; }

.index {
  border: 1px solid var(--rule);
  padding: .6em .9em;
  margin-top: .6em;
}
.index strong { display: block; text-align: center; margin-bottom: .3em; }
.index ol { list-style: none; margin: 0; padding: 0; column-count: 2; column-gap: 1.5em; }
.index li { display: flex; gap: .3em; font-size: .86em; }
.index li span { flex: 1; border-bottom: 1px dotted #777; transform: translateY(-.3em); }
.index a { color: inherit; text-decoration: none; }
.index a:hover { text-decoration: underline; }

.pull {
  font-size: 1.5em;
  font-style: italic;
  line-height: 1.2;
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  padding: .5em 0;
  margin: .4em 0 .9em;
  text-align: center;
}
.q { font-weight: 700; margin-bottom: .2em !important; }
.todo { background: repeating-linear-gradient(-45deg, #e3e3e0 0 4px, #ecebe7 4px 8px); padding: 0 .2em; }

/* menetrend */
.timetable { width: 100%; border-collapse: collapse; font-size: 1.05em; }
.timetable th, .timetable td { text-align: left; padding: .45em .3em; border-bottom: 1px solid #aaa; vertical-align: top; }
.timetable th { width: 5.2em; font-variant-numeric: tabular-nums; font-weight: 700; }
.timetable td small { display: block; color: var(--muted); font-style: italic; font-size: .82em; }

/* divat színminták */
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5em; margin: .6em 0 1em; }
.swatches div { text-align: center; font-size: .72em; line-height: 1.2; }
.swatches i { display: block; aspect-ratio: 1; border: 1px solid var(--rule); margin-bottom: .3em; }

/* apróhirdetések */
.classifieds { column-count: 3; column-gap: 1em; column-rule: 1px solid #999; }
.ad {
  break-inside: avoid;
  border: 1px solid var(--rule);
  padding: .5em .6em;
  margin-bottom: .8em;
  font-size: .9em;
  line-height: 1.35;
}
.ad b { display: block; font-size: 1.05em; }
.ad.big { border-width: 3px; text-align: center; }
.ad.big b { font-size: 1.5em; }
.ad a { color: inherit; }
.ad.inverse { background: var(--ink); color: var(--paper); }

/* hátsó oldal */
.weather {
  display: grid; grid-template-columns: auto 1fr; gap: 1em; align-items: center;
  border: 2px solid var(--rule); padding: .7em .9em; margin-bottom: 1em;
}
.weather svg { width: 5em; height: 5em; }
.weather strong { font-size: 2em; line-height: 1; display: block; }
.quiz ol { margin: 0; padding-left: 1.3em; }
.quiz li { margin-bottom: .45em; }
.answers { transform: rotate(180deg); font-size: .78em; color: var(--muted); margin-top: .6em; text-align: center; }
.colophon { border-top: 4px double var(--rule); margin-top: 1em; padding-top: .5em; font-size: .78em; text-align: center; }

/* ---------- vezérlők ---------- */
.controls {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 0 1rem .75rem;
  color: #eee;
  font: 500 .9rem/1 var(--ui);
}
.controls button {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid #777;
  background: #180a15;
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
}
.controls button:disabled { opacity: .3; cursor: default; }
.controls button:not(:disabled):hover { background: #fff; color: #000; }
.controls svg { width: 20px; height: 20px; }
.pageno { min-width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; }



@container (max-width: 420px) {
  .cols, .cols-3 { column-count: 1; }
  .classifieds { column-count: 2; }
  .index ol { column-count: 1; }
  .page { padding: 5cqi; }
  .meta { flex-wrap: wrap; justify-content: center; column-gap: 1em; }
}

@media (prefers-reduced-motion: reduce) {
  .leaf, .leaf.turning { transition: none; }
}
