/* Fonts: Poppins is the official public substitute for Gotham, Caveat is the
   brand's handwritten accent. Both are SIL OFL (see assets/fonts/OFL-*.txt). */
@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("assets/fonts/Poppins-Regular.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("assets/fonts/Poppins-Medium.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("assets/fonts/Poppins-Bold.ttf") format("truetype"); }
@font-face { font-family: "Caveat"; font-weight: 500; font-display: swap; src: url("assets/fonts/Caveat-Medium.ttf") format("truetype"); }

:root {
  --dtk-green: #31B24A;
  --dtk-green-dark: #27902E;
  --dtk-green-darkest: #1F7024;
  --dtk-green-lightest: #5FD367;
  --dtk-black: #191919;
  --dtk-ink: #242933;
  --dtk-gray-bg: #F6F7FA;
  --dtk-gray-text: #404959;
  --dtk-line: #E3E6ED;
  --dtk-yellow: #F4C905;

  --font: "Gotham", "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --radius: 16px;
  --gap: 12px;
  --cols: 3;
  --max: 1040px;
}

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

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

body {
  margin: 0;
  background: var(--dtk-gray-bg);
  color: var(--dtk-ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

img { display: block; max-width: 100%; height: auto; }

[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 32px);
  margin-inline: auto;
  padding-inline: 16px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--dtk-green);
  color: #fff;
  padding-bottom: 72px;
}

/* Brand "circle" element: thick rings as composition, not decoration for its own sake. */
.hero__rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 92% 18%, transparent 0 118px, rgba(255,255,255,.14) 119px 146px, transparent 147px),
    radial-gradient(circle at 78% 112%, transparent 0 160px, rgba(25,25,25,.07) 161px 196px, transparent 197px);
}

/* Falling snow. Layers with unrelated tile sizes so the flakes don't line up
   in a grid; each layer falls exactly one tile per loop, so it never jumps. */
.hero__snow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero__snow::before,
.hero__snow::after {
  content: "";
  position: absolute;
  inset: 0;
}

.hero__snow::before {
  background-image:
    radial-gradient(circle at 23% 31%, rgba(255,255,255,.85) 0 2px, transparent 2.6px),
    radial-gradient(circle at 71% 64%, rgba(255,255,255,.6) 0 1.5px, transparent 2px),
    radial-gradient(circle at 48% 87%, rgba(255,255,255,.7) 0 1.8px, transparent 2.4px),
    radial-gradient(circle at 87% 12%, rgba(255,255,255,.5) 0 1.2px, transparent 1.8px);
  background-size: 137px 151px, 89px 103px, 173px 127px, 61px 79px;
  animation: snow-near 11s linear infinite;
}

.hero__snow::after {
  background-image:
    radial-gradient(circle at 35% 40%, rgba(255,255,255,.75) 0 3px, transparent 3.6px),
    radial-gradient(circle at 78% 72%, rgba(255,255,255,.6) 0 2.6px, transparent 3.2px);
  background-size: 233px 211px, 197px 257px;
  animation: snow-far 16s linear infinite;
}

@keyframes snow-near { to { background-position: 0 151px, 0 206px, 0 127px, 0 158px; } }
@keyframes snow-far  { to { background-position: 60px 211px, 40px 257px; } }

.hero__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}

.hero__logo img { width: 140px; }

.hero__body { position: relative; padding-top: 24px; }

/* Brand block headline, on a green page: green text on a white block. */
.block-headline {
  display: inline;
  margin: 0;
  padding: .2em 12px 2px; /* top room for the accents on Í, Á, Ř */
  background: #fff;
  color: var(--dtk-green);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1.32;
  letter-spacing: -.01em;
  text-transform: uppercase;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.hero__addendum {
  margin: 16px 0 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: clamp(1.6rem, 4.5vw, 2.25rem);
  line-height: 1.1;
}

.hero__intro {
  max-width: 36rem;
  margin: 16px 0 0;
  font-size: 1.0625rem;
}

.hero__status {
  display: inline-block;
  margin: 24px 0 0;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--dtk-black);
  font-weight: 500;
  font-size: .9375rem;
}

/* ---------- Grid of windows ---------- */

main { position: relative; margin-top: -40px; }

.preview-badge {
  margin-bottom: 12px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--dtk-yellow);
  color: var(--dtk-black);
  font-weight: 700;
  font-size: .8125rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.grid-wrap { container-type: inline-size; }

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  /* Square cells: row height = column width. */
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols));
  grid-auto-flow: dense;
  gap: var(--gap);
}

@media (min-width: 640px)  { :root { --cols: 5; --gap: 14px; } }
@media (min-width: 900px)  { :root { --cols: 6; --gap: 16px; } }

.cell { position: relative; container-type: size; }
.cell--wide { grid-column: span 2; }
.cell--big  { grid-column: span 2; grid-row: span 2; }

/* Peel: how far the cover is peeled back from the bottom-right corner, along
   a 45° fold. Registered so it can animate; browsers without @property just
   jump between states. Set on .door so cqmin measures the cell. */
@property --peel {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.door {
  --peel: 0px;
  transition: --peel .6s cubic-bezier(.35,.8,.3,1);
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}

.door:focus-visible { outline: 3px solid var(--dtk-green-darkest); outline-offset: 3px; }

/* What is behind the door once it is open. */
.door__inside {
  position: absolute;
  /* Inset so its corners can't show through the panel's anti-aliased edge. */
  inset: 2px;
  border-radius: calc(var(--radius) - 2px);
  background: var(--dtk-green-darkest);
  color: #fff;
  box-shadow: inset 0 4px 14px rgba(0,0,0,.25);
}

/* Icon sits in the peeled-open corner. */
.door__inside svg {
  position: absolute;
  right: 10cqmin;
  bottom: 10cqmin;
  width: 16cqmin;
  height: auto;
}

/* The door panel itself. */
.door__panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--dtk-line);
  /* Cut away the peeled corner. */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--peel)), calc(100% - var(--peel)) 100%, 0 100%);
  text-align: left;
}

/* The back of the peeled paper: the cut-off corner mirrored across the fold,
   which is the other half of the --peel × --peel corner square. The wrapper
   carries the shadow because clip-path would cut it off. */
.door__flap {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--peel);
  height: var(--peel);
  filter: drop-shadow(-2px -2px 3px rgba(25,25,25,.2));
  pointer-events: none;
}

.door__flap::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  border-top-left-radius: min(var(--radius), 30%);
  /* Darker at the tip, bright along the fold, like curled paper. */
  background: linear-gradient(135deg, #D5DAE2 0%, #F1F3F6 32%, #FFFFFF 50%);
}

.door__num {
  font-weight: 700;
  font-size: 40cqh;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--dtk-black);
}


.door__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dtk-gray-text);
  transition: opacity .3s;
}

.door__meta svg { flex: none; width: 14px; height: 14px; }

/* Locked: future days. */
.cell--locked .door { cursor: not-allowed; }
.cell--locked .door__num { color: #C9CED8; }
.cell--locked .door__meta { color: #9AA1AE; }

/* Available (past or today), not opened yet. */
.cell--ready:not(.cell--open) .door:hover,
.cell--ready:not(.cell--open) .door:focus-visible { --peel: 16cqmin; }
.cell--ready .door__num { color: var(--dtk-green); }

/* Today: the one to open. */
.cell--today .door__panel { background: var(--dtk-green); border-color: var(--dtk-green); color: #fff; }
.cell--today .door__num { color: #fff; }
.cell--today .door__meta { color: #fff; }
.cell--today .door__hand {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
}
.cell--today::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 3px solid var(--dtk-green);
  border-radius: calc(var(--radius) + 6px);
  animation: pulse 2s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%   { opacity: .9; transform: scale(.97); }
  100% { opacity: 0;  transform: scale(1.06); }
}

/* Opened: the cover stays peeled about halfway. 55cqmin keeps the flap clear
   of the day number. */
.cell--open .door { --peel: 55cqmin; }
.cell--open .door:hover,
.cell--open .door:focus-visible { --peel: 59cqmin; }
.cell--open .door__meta { opacity: 0; }
.cell--open::after { display: none; }

.cell--shake .door__panel { animation: shake .4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Locked-day hint. */
.hint {
  position: absolute;
  z-index: 5;
  left: 6px;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  line-height: 1.3;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--dtk-black);
  color: #fff;
  font-size: .8125rem;
  font-weight: 500;
  pointer-events: none;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 56px;
  padding-bottom: 48px;
}

.footer__logo { width: 200px; }

.footer__note {
  max-width: 30rem;
  margin: 0;
  font-size: .8125rem;
  color: var(--dtk-gray-text);
}

.footer__note a { color: var(--dtk-green-darkest); font-weight: 500; }

/* ---------- Modal ---------- */

.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 32px 28px 28px;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--dtk-ink);
  box-shadow: 0 24px 64px rgba(25,25,25,.25);
}

.modal::backdrop { background: rgba(25,25,25,.55); }

.modal[open] { animation: pop .35s cubic-bezier(.3,.7,.3,1.2); }
@keyframes pop {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.modal__close-form { position: absolute; top: 12px; right: 12px; margin: 0; }

.modal__close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9999px;
  background: var(--dtk-gray-bg);
  color: var(--dtk-ink);
  cursor: pointer;
}
.modal__close:hover { background: var(--dtk-line); }

.modal__head { display: flex; align-items: center; gap: 12px; padding-right: 40px; }

.chip {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--dtk-green);
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.chip--tip { background: var(--dtk-black); }

.modal__date {
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--dtk-green);
}

.modal__title {
  margin: 16px 0 0;
  font-weight: 700;
  font-size: 1.625rem;
  line-height: 1.2;
  color: var(--dtk-black);
}

.modal__text { margin: 12px 0 0; color: var(--dtk-gray-text); }

.code {
  display: block;
  margin-top: 24px;
  padding: 16px;
  border: 2px dashed var(--dtk-green);
  border-radius: var(--radius);
  background: #F1FAF3;
}

.code__label, .code__valid {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--dtk-gray-text);
}
.code__label { letter-spacing: .08em; text-transform: uppercase; }
.code__valid { margin-top: 8px; }

.code__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }

.code__value {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: .06em;
  color: var(--dtk-black);
  overflow-wrap: anywhere;
}

.code__copy {
  flex: none;
  padding: 8px 14px;
  border: 2px solid var(--dtk-green);
  border-radius: 9999px;
  background: #fff;
  color: var(--dtk-green-darkest);
  font: 700 .8125rem/1 var(--font);
  cursor: pointer;
}
.code__copy:hover { background: var(--dtk-green); color: #fff; }
.code__copy.is-done { background: var(--dtk-green); color: #fff; }

.modal__expired {
  margin: 24px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--dtk-gray-bg);
  font-weight: 500;
  font-size: .9375rem;
}

.button {
  display: block;
  margin-top: 24px;
  padding: 16px 24px;
  border-radius: 9999px;
  background: var(--dtk-green);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background .15s;
}
.button:hover { background: var(--dtk-green-dark); }
.button:focus-visible { outline: 3px solid var(--dtk-green-darkest); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
