/* ==========================================================================
   style.css — every visual rule for the site lives in this one file.

   How to read it (Python analogy): a CSS rule is like a dict entry
       selector -> { property: value, ... }
   The browser walks the HTML tree and applies every rule whose selector
   matches an element. When two rules set the same property, the more
   specific selector wins; if equally specific, the later one wins.

   Order of this file:
     1. Fonts            (@font-face: which font files to load)
     2. Design tokens    (CSS variables: colors, fonts, sizes — edit here)
     3. Base rules       (page-wide defaults)
     4. Shared pieces    (links, titles, monograms, back-to-main button)
     5. One block per section, in page order
     6. Mobile menu
     7. Mobile layout    (everything inside @media at the bottom)

   About the numbers: the design is 1280 x 800 px. Positions below are
   copied from the PDF, and comments show the arithmetic, so you can
   trace any value back to the InDesign file.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. FONTS
   Both fonts are open source (SIL Open Font License, see assets/fonts/OFL-*.txt),
   so hosting the files ourselves is allowed.
   To swap a font: drop the new .woff2 files in assets/fonts/, change the
   src: lines here, and change the family name in --font-script / --font-mono.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Imperial Script";               /* PLACEHOLDER for Bickham Script Pro 3 */
  src: url("../assets/fonts/ImperialScript-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;   /* show fallback text immediately, swap when the font arrives */
}

/* IBM Plex Mono comes as one file per weight; each @font-face maps one
   file to one numeric weight so that font-weight: 300 picks the Light file. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}


/* --------------------------------------------------------------------------
   2. DESIGN TOKENS — change the look of the whole site from here.
   Variables are read with var(--name). Like module-level constants.
   -------------------------------------------------------------------------- */

:root {
  /* Colors, taken from the PDF */
  --color-beige: #DEDDD7;        /* page background */
  --color-blue: #003F59;         /* all text, ornament */
  --color-terracotta: #AA6159;   /* "page 2" panel, hover / current state */
  --color-wine: #592E2E;         /* "page 1" panel */
  --color-olive: #A39433;        /* "page 4" panel */
  --color-light: #F5F5F5;        /* text on the wine panel */

  /* Fonts. The fallbacks after the comma are used until the file loads. */
  --font-script: "Imperial Script", "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  /* Weights. Names follow the InDesign styles; values are the IBM Plex Mono
     weights that look closest on screen (Xanti runs heavier than Plex:
     Xanti "Thin" looks like Plex ExtraLight, Xanti "Book"/"Regular" like
     Plex Medium). Available files: 200, 300, 400, 500. */
  --weight-thin: 200;
  --weight-light: 300;
  --weight-book: 500;
  --weight-regular: 500;
  --weight-medium: 500;

  /* Plex Mono letters are 0.600em wide, Xanti Typewriter's were 0.654em.
     Adding the difference as letter-spacing keeps every line exactly as
     wide as in the design, so line breaks and centers match the PDF. */
  --mono-tracking: 0.054em;

  /* Font sizes (px at the 1280 px design width) */
  --size-script: 68px;     /* Bickham was 82.8 pt; Imperial looks the same size at 68 */
  --size-nav: 18px;        /* top bar, date, address, "strona główna" */
  --size-text-2: 18px;
  --size-text-3: 14px;
  --size-text-4: 14px;
  --size-text-5: 12.73px;
  --size-monogram: 30px;

  --line-height: 1.2;      /* every text block in the design uses 120 % */

  /* Distance of the top bar and the back-to-main button from the page edges */
  --edge-x: 36px;
  --edge-y: 32px;

  /* Column split used by sections 2–6: 554 px + 726 px of 1280 px */
  --split-columns: 554fr 726fr;

  /* Height of the embedded Google Form box (the form scrolls inside it) */
  --form-height: 520px;

  /* Below this width the phone layout is used. It is repeated in the
     @media line at the bottom (CSS can't use variables in @media). */
}


/* --------------------------------------------------------------------------
   3. BASE RULES
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;   /* width includes padding: easier arithmetic */
}

html {
  scroll-behavior: smooth;  /* nav links glide instead of jumping */
}

body {
  margin: 0;
  background: var(--color-beige);
  color: var(--color-blue);
  font-family: var(--font-mono);
  font-weight: var(--weight-light);
  font-size: var(--size-nav);
  line-height: var(--line-height);
}

/* Tracking is set on every element, not just on body. Reason: a value in
   em is turned into pixels where it is declared, and children inherit the
   pixels. Declared here, each element computes 0.054em of its own size. */
* {
  letter-spacing: var(--mono-tracking);
}

img,
iframe {
  display: block;
  max-width: 100%;
}

h1,
h2,
p {
  margin: 0;
  font-weight: inherit;
}

/* Visible outline for keyboard users (Tab key). Mouse clicks don't show it. */
:focus-visible {
  outline: 2px solid var(--color-terracotta);
  outline-offset: 3px;
}

/* Guests who switch on "reduce motion" in their phone settings get
   instant scrolling and no sliding menu. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .menu-panel {
    transition: none;
  }
}


/* --------------------------------------------------------------------------
   4. SHARED PIECES
   -------------------------------------------------------------------------- */

/* Nav-style links: top bar titles, language link, "strona główna".
   Hover = Medium weight + terracotta (shown on "title 2" in the PDF).
   Plex Mono is monospaced, so getting bolder doesn't make words wider
   and nothing next to them shifts. */
.nav-link {
  color: var(--color-blue);
  text-decoration: none;
  font-weight: var(--weight-light);
}
.nav-link:hover {
  color: var(--color-terracotta);
  font-weight: var(--weight-medium);
}

/* The language you are currently reading: always in the hover style. */
.lang-current {
  color: var(--color-terracotta);
  font-weight: var(--weight-medium);
}

/* Plain text links (address): no underline until hovered. */
.text-link {
  color: var(--color-blue);
  text-decoration: none;
}
.text-link:hover {
  text-decoration: underline;
}

/* Script titles ("page 2", the names). line-height 1 makes the box exactly
   one font-size tall, so its baseline sits 0.775em = 52.7px below its top
   (Imperial's ascent 0.88 minus half of the 0.21 overflow). The section
   paddings below use that number to put each baseline where the PDF has it. */
.script-title {
  font-family: var(--font-script);
  font-size: var(--size-script);
  font-weight: 400;
  line-height: 1;
  letter-spacing: normal;
}

/* Monograms ("Y+x", "X+y"): small fixed corner texts. */
.monogram {
  position: absolute;
  font-size: var(--size-monogram);
  font-weight: var(--weight-book);
}

/* Shared rules for the two-column sections (everything except main). */
.section {
  position: relative;          /* lets corner items position against it */
  min-height: 100vh;           /* each section fills at least one screen */
}
.split {
  display: grid;
  grid-template-columns: var(--split-columns);
}
.panel--terracotta { background: var(--color-terracotta); }
.panel--wine       { background: var(--color-wine); color: var(--color-light); }
.panel--olive      { background: var(--color-olive); }

/* Body text blocks. Widths are the InDesign frame widths, which give the
   same line breaks as the PDF thanks to --mono-tracking. */
.body-text {
  max-width: 100%;
}
.body-text p + p {
  margin-top: 0;               /* paragraphs follow each other with no gap, as in the PDF */
}

/* Back-to-main button: desktop only, bottom corner of the beige half. */
.back-home {
  position: absolute;
  bottom: var(--edge-y);
}
.back-home--right { right: var(--edge-x); }
.back-home--left  { left: var(--edge-x); }


/* --------------------------------------------------------------------------
   5a. MAIN SECTION (PDF page 1)
   -------------------------------------------------------------------------- */

.home {
  display: flex;
  flex-direction: column;      /* top area, then the image band below */
  min-height: 100vh;
}

.home-top {
  position: relative;
  height: 364px;               /* the band starts at y = 364 in the PDF */
  padding: var(--edge-y) var(--edge-x) 0;   /* nav baseline 49.5 - 17.5 = 32 */
}

/* The top bar: 7 cells. The fr widths are the distances between each
   item's left edge in the PDF (title 1 at x 36, title 2 at 221, ...), so the
   items keep the same relative positions at any desktop width. */
.main-nav {
  display: grid;
  grid-template-columns: 185fr 191fr 141fr 240fr 190fr 202fr auto;
  align-items: start;
}
.main-nav__ornament {
  width: 183px;
  margin-top: 5px;             /* ornament top at y = 37, text top at y = 32 */
}
.main-nav__lang {
  justify-self: end;           /* "pl/en" hugs the right edge */
}

/* Date, names, address. Placed exactly; all three baselines line up at
   y = 256 (date's last line and the names). */
.home-date {
  position: absolute;
  top: 195px;                  /* first baseline 212.8 - 17.5 */
  left: var(--edge-x);
}
.home-names {
  position: absolute;
  top: 204px;                  /* baseline 256.3 - 52.7 */
  left: 0;
  right: 0;
  text-align: center;
}
.home-address {
  position: absolute;
  top: 195px;
  right: var(--edge-x);
  text-align: right;
}

/* In InDesign the date is justified across a 78 px frame, which spreads
   the letters apart. CSS can't justify single words, so each line gets the
   letter-spacing that reproduces the same width:
     4 characters across 78 px -> letters 22.0 px apart -> 22.0 - 10.8 = 11.2px extra
     5 characters across 78 px -> letters 16.6 px apart -> 16.6 - 10.8 =  5.8px extra
   If you change a line's character count, switch its class. */
.date-line {
  display: block;
}
.date-line--4chars { letter-spacing: 11.2px; }
.date-line--5chars { letter-spacing: 5.8px; }

.home-band {
  position: relative;
  flex: 1;                     /* takes whatever height is left of the screen */
  min-height: 436px;           /* 800 - 364 in the PDF */
}
.home-band__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;           /* fill the band, cropping the edges if needed */
}
.home-band__lace {
  position: absolute;
  top: -56px;                  /* circle top 308 vs band top 364 */
  left: 17.03%;                /* 218 / 1280 */
  width: 301px;
  mix-blend-mode: lighten;     /* InDesign used "Lighten": dark lace parts vanish over beige */
}


/* --------------------------------------------------------------------------
   5b. SECTION "page 2" (PDF page 2): terracotta text panel + ornament
   -------------------------------------------------------------------------- */

.page-2__text {
  position: relative;
  padding: 90px 0 96px 26px;   /* title baseline 142.6 - 52.7 = 90;
                                  left 26 moves the center to x 290 as in the PDF */
  text-align: center;
}
.page-2__text .body-text {
  width: 360px;
  margin: 91px auto 0;         /* text baseline 266.8 - 17.5 = 249.3; title box ends at 158 */
  font-size: var(--size-text-2);
}
.page-2__monogram-top    { top: 24px;  left: 26px; }
.page-2__monogram-bottom { bottom: 18px; right: 28px; }

/* Embedded Google Form, under text 2. */
.form-frame {
  width: 100%;
  height: var(--form-height);
  margin-top: 32px;
  border: 0;
  background: #ffffff;
}

.page-2__side {
  padding: 424px 0 0 42px;     /* ornament top at y 424; left 42 centers it at x 938 */
}
.page-2__ornament {
  width: 450px;
  margin: 0 auto;
}


/* --------------------------------------------------------------------------
   5c. SECTION "page 1" (PDF page 3): empty beige half + wine panel + lace card
   -------------------------------------------------------------------------- */

.page-1__panel {
  display: flex;
  align-items: center;         /* if the card is shorter than the screen, center it */
}

/* Vertical strip left of the card: rotated title and two monograms. */
.page-1__strip {
  position: relative;
  flex: 1;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-1__title {
  writing-mode: vertical-rl;   /* stack the text vertically... */
  transform: rotate(180deg);   /* ...and turn it so it reads bottom-to-top */
}
.page-1__monogram-top    { top: 24px;    left: 34px; }
.page-1__monogram-bottom { bottom: 29px; left: 34px; }

/* The lace card scales like one picture: everything inside is positioned
   in % of the card, and font sizes use cqw (1cqw = 1 % of the card's
   width), so text stays locked to the lace at any size.
   Width: as tall as the screen allows (card is 553 x 801, so width =
   69.04 % of its height), but never wider than the panel minus a strip. */
.lace-card {
  position: relative;
  flex: none;
  width: min(69.04vh, calc(100% - 150px));
  container-type: inline-size; /* makes cqw units refer to this card */
  color: var(--color-blue);
}
.lace-card__image {
  width: 100%;
  mix-blend-mode: lighten;     /* same blend mode as in InDesign */
}
/* Card coordinates: the PNG is 553 x 801. Positions are measured from the
   PDF and shifted 14 px right, because the PNG has 14 px more margin on the
   left than the image used in the PDF (same lace, same scale). */
.lace-card__heading {
  position: absolute;
  top: 24.5%;                  /* subtitle baseline 207.3 of 801 */
  left: 3.8%;                  /* moves the center to x 287 of 553, as in the PDF */
  right: 0;
  text-align: center;
  font-size: 2.05cqw;          /* 11.32 / 553 */
}
.lace-card__subtitle { font-weight: var(--weight-regular); }
.lace-card__date     { font-weight: var(--weight-thin); }

/* The two columns (left-aligned / right-aligned) are built as rows, so a
   left entry and a right entry on the same line always stay level. */
.lace-card__rows {
  position: absolute;
  top: 36.7%;                  /* first baseline 304.9 of 801 */
  left: 21.2%;                 /* 117 / 553 */
  right: 18.4%;                /* right edge at 451 of 553 */
  font-size: 2.05cqw;
}
.card-row {
  display: flex;
  justify-content: space-between;
  height: 1.2em;               /* one line */
}
.card-gap {
  height: 1.56em;              /* the blank lines in the PDF are about 1.3 lines tall */
}
.card-row strong {
  font-weight: var(--weight-book);
}
.lace-card__ornament {
  position: absolute;
  top: 69.4%;                  /* 556 / 801 */
  left: 35.8%;                 /* 198 / 553 */
  width: 33.3%;                /* 184 / 553 */
}


/* --------------------------------------------------------------------------
   5d. SECTION "page 3" (PDF page 4): text + map
   -------------------------------------------------------------------------- */

.page-3__text {
  padding: 40px 0 96px 58px;   /* title baseline 92.3 - 52.7 = 40; left 58 centers at x 306 */
  text-align: center;
}
.page-3__text .body-text {
  width: 432px;
  margin: 25px auto 0;         /* text baseline 146.9 - 13.7 = 133; title box ends at 108 */
  font-size: var(--size-text-3);
}

.page-3__map {
  padding: 233px 0 96px 75px;  /* map top at y 233; left 75 centers it at x 954 */
}
.map-frame {
  width: 419px;
  height: 390px;
  margin: 0 auto;
  border: 0;
}


/* --------------------------------------------------------------------------
   5e. SECTION "page 4" (PDF page 5): image + olive text panel
   -------------------------------------------------------------------------- */

.page-4__image {
  display: flex;
  align-items: center;         /* image is vertically centered in the PDF (155–645 of 800) */
  justify-content: center;
}
.page-4__image img {
  width: 348px;
  height: 490px;
  object-fit: cover;
}

.page-4__text {
  padding: 97px 0 96px 102px;  /* title baseline 150 - 52.7 = 97; left 102 centers at x 968 */
  text-align: center;
}
.page-4__text .body-text {
  width: 432px;
  margin: 45px auto 0;         /* text baseline 223.9 - 13.7 = 210; title box ends at 165 */
  font-size: var(--size-text-4);
  font-weight: var(--weight-thin);
}


/* --------------------------------------------------------------------------
   5f. SECTION "page 5" (PDF page 6): left-aligned text + image
   -------------------------------------------------------------------------- */

.page-5__text {
  padding: 90px 0 96px 64px;   /* title baseline 142.6 - 52.7 = 90; text starts at x 64 */
}
.page-5__text .script-title,
.page-5__text .body-text {
  width: 444px;
  max-width: 100%;
}
.page-5__text .script-title {
  text-align: center;          /* title is centered over the text block in the PDF */
}
.page-5__text .body-text {
  margin-top: 127px;           /* text baseline 297 - 12.4 = 284.6; title box ends at 158 */
  font-size: var(--size-text-5);
  text-align: left;
}

.page-5__image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 75px;          /* centers the image at x 954 */
}
.page-5__image img {
  width: 419px;
  height: 490px;
  object-fit: cover;
}


/* --------------------------------------------------------------------------
   6. MOBILE MENU (hamburger + side panel)
   Hidden on desktop; the @media block below switches it on.
   -------------------------------------------------------------------------- */

.menu-button {
  display: none;               /* desktop: not shown */
  position: fixed;             /* phone: stays in the top-right corner while scrolling */
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 44px;                 /* 44 px = comfortable finger size */
  height: 44px;
  padding: 12px 10px;
  border: 0;
  background: var(--color-beige);   /* keeps the icon readable over colored panels */
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.menu-button__line {
  display: block;
  height: 2px;
  background: var(--color-blue);
}

.menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(80vw, 320px);
  padding: 72px 32px 32px;
  background: var(--color-beige);
  border-left: 1px solid var(--color-blue);   /* separates the panel from the beige page */
  /* Closed state: pushed off-screen to the right and invisible to
     keyboard and screen readers. main.js adds .is-open to show it. */
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
}
.menu-panel.is-open {
  transform: translateX(0);
  visibility: visible;
}
.menu-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--color-blue);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.menu-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.menu-list li + li {
  margin-top: 20px;
}
.menu-list__lang {
  margin-top: 40px !important; /* extra space before the language switch */
}


/* --------------------------------------------------------------------------
   7. PHONE LAYOUT (screens up to 768 px wide)
   Everything here overrides the desktop rules above.
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {

  :root {
    --size-script: 56px;       /* a little smaller so the names fit a phone */
  }

  .section {
    min-height: 0;             /* phone sections are only as tall as their content */
  }
  .split {
    display: block;            /* columns stack instead of sitting side by side */
  }

  /* Only the text half of each section is shown on phones... */
  .page-2__side,
  .page-1__empty,
  .page-4__image,
  .page-5__image,
  .back-home,
  .main-nav__link-cell {
    display: none;
  }
  /* ...except the map, which goes under text 3. */

  .menu-button {
    display: flex;
  }

  /* Main section: ornament, names, date, address, then the image band. */
  .home-top {
    height: auto;
    padding: 24px 24px 48px;
    text-align: center;
    /* A flex column lets us reorder without touching the HTML:
       in the HTML the date comes before the names (desktop reading
       order left to right); on phones the names go first. */
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .main-nav     { order: 0; }
  .home-names   { order: 1; }
  .home-date    { order: 2; }
  .home-address { order: 3; }
  .main-nav {
    display: block;
  }
  .main-nav__ornament {
    margin: 0 auto;
    width: 150px;
  }
  .home-date,
  .home-names,
  .home-address {
    position: static;          /* back into normal top-to-bottom flow */
    text-align: center;
  }
  .home-names {
    margin: 32px 0 28px;
  }
  .home-date {
    display: inline-block;     /* keeps the 78 px date block intact, centered */
    text-align: left;
  }
  .home-address {
    margin-top: 20px;
  }
  .home {
    min-height: 0;             /* no empty beige area under the band */
  }
  .home-band {
    flex: none;
    min-height: 0;
    height: 60vw;
  }
  .home-band__lace {
    top: -10vw;
    left: 10vw;
    width: 40vw;
  }

  /* Text panels: comfortable side padding, room at the top for the
     hamburger button. */
  .page-2__text,
  .page-3__text,
  .page-4__text,
  .page-5__text {
    padding: 72px 24px 72px;
  }
  .page-2__text .body-text,
  .page-3__text .body-text,
  .page-4__text .body-text,
  .page-5__text .body-text {
    width: auto;
    margin-top: 32px;
  }
  .page-5__text .script-title {
    width: auto;
  }

  /* "page 1": keep the vertical title, narrower strip. */
  .page-1__panel {
    min-height: 0;
  }
  .page-1__strip {
    flex: none;
    width: 72px;
  }
  .page-1__monogram-top,
  .page-1__monogram-bottom {
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
  }
  .lace-card {
    flex: 1;
    width: auto;
  }

  /* Map below text 3, full width. */
  .page-3__map {
    padding: 0 24px 72px;
  }
  .map-frame {
    width: 100%;
    height: 320px;
  }
}
