:root {
  --bg: #f7ede8;
  --bg-glow: #fff7f3;
  --ink: #3a2822;
  --muted: #7a5f54;
  --accent: #8a6250;
  --line: rgba(138, 98, 80, .28);
  --field: rgba(255, 255, 255, .6);
  --on-accent: #fff8f4;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1210; --bg-glow: #2c1f1b; --ink: #f3e4dc; --muted: #bf9f90;
    --accent: #d9a58c; --line: rgba(217, 165, 140, .3);
    --field: rgba(255, 255, 255, .06); --on-accent: #1a1210;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1210; --bg-glow: #2c1f1b; --ink: #f3e4dc; --muted: #bf9f90;
  --accent: #d9a58c; --line: rgba(217, 165, 140, .3);
  --field: rgba(255, 255, 255, .06); --on-accent: #1a1210;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 38%, var(--bg-glow), var(--bg) 70%);
  transition: background .5s, color .5s;
}

/* Shutter flash: the one orchestrated moment on load */
body::after {
  content: "";
  position: fixed; inset: 0;
  background: #fff;
  pointer-events: none;
  animation: flash 1.1s ease-out .15s both;
}
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* Slowly turning aperture ring */
.iris {
  position: fixed; left: 50%; top: 50%;
  width: min(125vmin, 1100px); aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, transparent 0 14deg, var(--line) 14deg 14.4deg);
  -webkit-mask: radial-gradient(circle, transparent 52%, #000 53%, #000 69%, transparent 70%);
          mask: radial-gradient(circle, transparent 52%, #000 53%, #000 69%, transparent 70%);
  animation: spin 160s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { rotate: 360deg; } }

header {
  position: relative; z-index: 1;
  display: flex; justify-content: flex-end; align-items: center; gap: .75rem;
  padding: clamp(.6rem, 2vh, 1.2rem) clamp(1rem, 4vw, 2.5rem);
}

.lang { display: flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.lang a {
  padding: .35rem .85rem; font-size: .85rem; text-decoration: none; color: var(--muted);
  transition: background .25s, color .25s;
}
.lang a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.lang a:not([aria-current]):hover { color: var(--ink); }

#theme {
  width: 2.2rem; height: 2.2rem; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: none;
  color: var(--accent); cursor: pointer; transition: transform .4s, border-color .25s;
}
#theme:hover { transform: rotate(40deg); border-color: var(--accent); }
#theme svg { width: 1.1rem; height: 1.1rem; }
#theme .moon { display: none; }
:root[data-mode="dark"] #theme .sun { display: none; }
:root[data-mode="dark"] #theme .moon { display: block; }

main {
  position: relative; z-index: 1;
  min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(.5rem, 2.2vh, 1.4rem);
  padding: 0 1.25rem;
  text-align: center;
}

.logo {
  height: clamp(110px, 30vh, 300px);
  aspect-ratio: 1181 / 981;
  background: var(--accent);
  -webkit-mask: url("logo.webp") center / contain no-repeat;
          mask: url("logo.webp") center / contain no-repeat;
  transition: background .5s;
}

h1 {
  margin: 0; max-width: 18ch;
  font: 500 clamp(1.6rem, 4.6vh + 1.2vw, 3.2rem) / 1.08 var(--serif);
  letter-spacing: -.01em; text-wrap: balance;
}
.lead {
  margin: 0; max-width: 46ch;
  font-size: clamp(.9rem, 1.9vh + .3vw, 1.1rem); line-height: 1.5; color: var(--muted);
  text-wrap: balance;
}

/* Countdown inside viewfinder corners, echoing the logo */
.countdown {
  --c: linear-gradient(var(--accent), var(--accent));
  position: relative; margin: clamp(.2rem, 1vh, .6rem) 0;
  padding: clamp(.6rem, 2vh, 1.2rem) clamp(1rem, 4vw, 2.2rem);
  display: flex; gap: clamp(.9rem, 4vw, 2.6rem);
  background:
    var(--c) top left / 22px 2px no-repeat, var(--c) top left / 2px 22px no-repeat,
    var(--c) top right / 22px 2px no-repeat, var(--c) top right / 2px 22px no-repeat,
    var(--c) bottom left / 22px 2px no-repeat, var(--c) bottom left / 2px 22px no-repeat,
    var(--c) bottom right / 22px 2px no-repeat, var(--c) bottom right / 2px 22px no-repeat;
}
.unit { display: grid; gap: .1rem; min-width: 2.6ch; }
.num {
  font: 500 clamp(2.1rem, 7vh + 1vw, 4.2rem) / 1 var(--serif);
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.num.tick { animation: tick .45s ease-out; }
@keyframes tick { from { opacity: 0; translate: 0 -.25em; } to { opacity: 1; translate: 0 0; } }
.label { font-size: clamp(.72rem, 1.5vh + .2vw, .85rem); color: var(--muted); letter-spacing: .04em; }

.notify { display: flex; gap: .5rem; width: min(100%, 26rem); }
.notify input {
  flex: 1; min-width: 0; padding: .75rem 1rem;
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 99px;
  transition: border-color .25s;
}
.notify input::placeholder { color: var(--muted); opacity: .8; }
.notify button {
  padding: .75rem 1.3rem; font: inherit; font-size: .95rem; font-weight: 500;
  color: var(--on-accent); background: var(--accent);
  border: 0; border-radius: 99px; cursor: pointer;
  transition: transform .2s, filter .2s;
}
.notify button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.msg { min-height: 1.2em; margin: 0; font-size: .85rem; color: var(--accent); }

footer {
  position: relative; z-index: 1;
  padding: clamp(.5rem, 1.6vh, 1rem) 1rem;
  text-align: center; font-size: .8rem; color: var(--muted);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 420px) {
  .notify button { padding-inline: 1rem; }
  .countdown { gap: .7rem; padding-inline: .9rem; }
}
@media (max-height: 520px) {
  .lead { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}