/* ==========================================================================
   EXALTED — Birthday hub
   Design tokens lifted from exalted.com (warm cream ground, hairline greige,
   near-black warm ink, gold used once). Display face is Marcellus, the serif
   exalted.com declares; body face leads with Gilam so that if the licensed
   webfont is ever added to this project it takes over with no other change.
   ========================================================================== */

@font-face {
  font-family: 'Marcellus';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/marcellus-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: 'Marcellus';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/marcellus-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;
}

:root {
  --bg:            #faf8f4;
  --bg-deep:       #f2efe8;
  --surface:       #ffffff;
  --surface-hover: #f7f5f0;
  --line:          #e6e3dd;
  --line-strong:   #d3cfc6;
  --ink:           #22201d;
  --ink-muted:     #6f6a61;
  --ink-faint:     #9d968a;
  --gold:          #d6b34a;

  --sans: 'Gilam', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
          'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --serif: 'Marcellus', Optima, 'Times New Roman', serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Soft warm bloom behind the mark, so the flat cream has depth. */
  background-image:
    radial-gradient(78rem 42rem at 50% -14%, #ffffff 0%, rgba(255,255,255,0) 62%),
    radial-gradient(52rem 30rem at 50% 118%, var(--bg-deep) 0%, rgba(242,239,232,0) 70%);
  background-repeat: no-repeat;
}

/* Print-like grain. Kept very low so it reads as paper, not noise. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  padding: 0.7rem 1.25rem;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: 0 0 3px 3px;
}
.skip:focus-visible { transform: translate(-50%, 0); }

/* --------------------------------------------------------------- shell -- */

.shell {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 78rem;
  margin-inline: auto;
  padding: clamp(2.75rem, 8vh, 5.5rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* `safe` so that on a short viewport the block pins to the top and stays
     scrollable, instead of overflowing past the top edge unreachably. */
  justify-content: safe center;
  text-align: center;
}

/* ------------------------------------------------------------ masthead -- */

.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mark {
  width: clamp(8.5rem, 17vw, 12rem);
  height: auto;
  fill: var(--ink);
  overflow: visible;
}

/* --------------------------------------------------------------- intro -- */

.intro {
  margin-top: clamp(2.5rem, 7vh, 4.25rem);
  max-width: 40rem;
}

/* Eyebrow flanked by two hairlines, the one gold accent on the page. */
.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin: 0 0 1.35rem;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.eyebrow::before,
.eyebrow::after {
  content: "";
  width: clamp(1.75rem, 7vw, 3.25rem);
  height: 1px;
  background: linear-gradient(90deg, rgba(214,179,74,0), var(--gold));
}
.eyebrow::after { transform: scaleX(-1); }
.eyebrow span { text-indent: 0.34em; }

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.125rem, 6.2vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* -------------------------------------------------------------- picker -- */

.picker {
  width: 100%;
  margin-top: clamp(2.75rem, 7vh, 4.5rem);
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.125rem);
  grid-template-columns: repeat(5, 1fr);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.45s var(--ease),
              background-color 0.45s var(--ease),
              transform 0.45s var(--ease),
              box-shadow 0.45s var(--ease);
}

.card:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: 0 14px 34px -20px rgba(34, 32, 29, 0.4);
}

/* Hairline that wipes in across the top edge on hover — the one flourish. */
.card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.55s var(--ease);
  z-index: 3;
}
.card:hover::before,
.card:focus-within::before { transform: scaleX(1); }

.card__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: clamp(1.5rem, 2.6vw, 2rem) clamp(1.25rem, 2.2vw, 1.6rem) 1.35rem;
  text-decoration: none;
  color: inherit;
  text-align: left;
}
/* Stretched-link: the whole card is the primary target, but the terms link
   below sits on a higher layer and stays independently clickable. */
.card__main::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Inline SVG rather than emoji flags: Windows ships no regional-indicator
   glyphs, so 🇨🇿 renders there as the bare letters "CZ". */
.card__flag {
  display: block;
  width: 2rem;
  height: auto;
  margin-bottom: 0.55rem;
  border-radius: 2px;
  transition: transform 0.45s var(--ease);
}
.card:hover .card__flag { transform: translateY(-2px); }

.card__lang {
  font-size: clamp(1.0625rem, 1.9vw, 1.25rem);
  font-weight: 300;
  letter-spacing: 0.005em;
}

.card__region {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.45s var(--ease);
}
.card:hover .card__region { color: var(--ink-muted); }

/* Arrow drawn in CSS so there is no icon font or extra request.
   content-box is deliberate: padding-top supplies the gap above the rule
   without eating into the 1px line that border-box would collapse to 0. */
.card__go {
  box-sizing: content-box;
  margin-top: auto;
  padding-top: 1.5rem;
  position: relative;
  width: 1.5rem;
  height: 1px;
  background: var(--ink);
  background-clip: content-box;
  opacity: 0.35;
  transition: width 0.45s var(--ease), opacity 0.45s var(--ease);
}
.card__go::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  width: 7px;
  height: 7px;
  border-top: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
  transform: rotate(45deg);
}
.card:hover .card__go { width: 2.25rem; opacity: 1; }

/* Stretched, not shrink-wrapped: the rule then reads as a divider spanning the
   card rather than an underline hanging off the link text. */
.card__terms {
  position: relative;
  z-index: 2;
  align-self: stretch;
  text-align: left;
  margin: 0 clamp(1.25rem, 2.2vw, 1.6rem) 1.15rem;
  padding-top: 1.05rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  text-decoration: none;
  border-top: 1px solid transparent;
  transition: color 0.35s var(--ease);
}
.card__terms::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}
.card__terms:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* Browser-language match, flagged by main.js. */
.card[data-suggested] { border-color: var(--line-strong); }
.card[data-suggested] .card__lang::after {
  content: "";
  display: inline-block;
  vertical-align: 0.35em;
  margin-left: 0.5rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

/* ---------------------------------------------------------------- foot -- */

.foot {
  margin-top: clamp(3rem, 8vh, 5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.foot__link {
  color: inherit;
  text-decoration: none;
  transition: color 0.35s var(--ease);
}
.foot__link:hover { color: var(--ink); }
.foot__sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* -------------------------------------------------------------- focus --- */

a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}
.card__main:focus-visible { outline-offset: -4px; }

/* ---------------------------------------------------------- responsive -- */

/* Five cards never divide evenly below a 5-up row, so the sub-grids are built
   on a doubled column count: each card spans 2, and the short final row is
   offset to sit centred instead of orphaned against the left edge. */
@media (max-width: 68rem) {
  .grid { grid-template-columns: repeat(6, 1fr); }
  .card { grid-column: span 2; }
  .card:nth-child(4) { grid-column: 2 / span 2; }
  .card:nth-child(5) { grid-column: 4 / span 2; }
}

@media (max-width: 44rem) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .card { grid-column: span 2; }
  .card:nth-child(4) { grid-column: span 2; }
  .card:nth-child(5) { grid-column: 2 / span 2; }
}

@media (max-width: 26rem) {
  .grid { grid-template-columns: 1fr; }
  .card,
  .card:nth-child(4),
  .card:nth-child(5) { grid-column: auto; }
  .card__go { padding-top: 1rem; }
}

/* ---------------------------------------------------------- animation --- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes wing-l {
  from { opacity: 0; transform: translateX(-26px) scaleX(0.9); }
  to   { opacity: 1; transform: none; }
}
@keyframes wing-r {
  from { opacity: 0; transform: translateX(26px) scaleX(0.9); }
  to   { opacity: 1; transform: none; }
}
@keyframes chevron {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* fill-mode is `backwards`, never `forwards`: a filled-forwards animation keeps
   its final transform applied at animation priority, which outranks normal
   declarations and would silently dead-lock the cards' :hover lift. Every
   `to` state here equals the element's base state, so dropping the forwards
   fill costs nothing visually and hands control back to the cascade. */
@media (prefers-reduced-motion: no-preference) {
  .mark__wing,
  .mark__chevron { transform-box: fill-box; transform-origin: center; }
  .mark__wing--l { animation: wing-l 1.1s var(--ease) 0.1s backwards; }
  .mark__wing--r { animation: wing-r 1.1s var(--ease) 0.1s backwards; }
  .mark__chevron { animation: chevron 0.9s var(--ease) 0.34s backwards; }

  .eyebrow   { animation: rise 0.9s var(--ease) 0.58s backwards; }
  .title     { animation: rise 0.9s var(--ease) 0.66s backwards; }
  .foot      { animation: rise 0.9s var(--ease) 1.2s backwards; }

  .card { animation: rise 0.85s var(--ease) backwards; }
  .card:nth-child(1) { animation-delay: 0.84s; }
  .card:nth-child(2) { animation-delay: 0.90s; }
  .card:nth-child(3) { animation-delay: 0.96s; }
  .card:nth-child(4) { animation-delay: 1.02s; }
  .card:nth-child(5) { animation-delay: 1.08s; }
}
