/* Matteo & Gala — dreamy wedding surface / weirdcore underlayer */

:root {
  --cream: #fdf8ff;
  --cream-deep: #f3eaf8;
  --ivory: #fffefe;
  --blush: #f8e8f0;
  --lavender: #e8dff5;
  --sage: #9aab9a;
  --sage-deep: #6b7a6e;
  --gold: #d4b896;
  --gold-light: #ecd9c0;
  --gold-deep: #b89462;
  --text: #4a4248;
  --text-muted: #7a7178;
  --shadow: rgba(74, 66, 72, 0.08);
  --shadow-deep: rgba(74, 66, 72, 0.16);
  --radius: 14px;
  --radius-lg: 22px;
  --select-red: #e02020;
  --select-blue: #2060e0;
  --weird-green: #39ff14;
  --weird-pink: #ff4fd8;
  --weird-cyan: #00e5ff;
  font-family: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  overflow-x: hidden;
}

/* —— Dreamy background —— */
.bg {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg__gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(255, 200, 230, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 45% at 0% 60%, rgba(200, 220, 255, 0.28), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 80%, rgba(255, 230, 200, 0.22), transparent 45%),
    linear-gradient(180deg, #fffafd 0%, var(--cream) 45%, var(--cream-deep) 100%);
  transition: filter 0.4s ease;
}

.bg__floral {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='40' cy='40' r='3' fill='%23d4b896'/%3E%3C/svg%3E");
  background-size: 60px 60px;
}

.bg__rainbow {
  position: absolute;
  top: -15%;
  left: -25%;
  width: 150%;
  height: 60%;
  opacity: 0.22;
  background: radial-gradient(
    ellipse 75% 50% at 50% 100%,
    transparent 50%,
    rgba(255, 120, 180, 0.25) 54%,
    rgba(255, 220, 120, 0.2) 58%,
    rgba(180, 255, 180, 0.18) 62%,
    rgba(120, 200, 255, 0.22) 66%,
    rgba(200, 140, 255, 0.2) 70%,
    transparent 74%
  );
  filter: blur(2px);
  transition: opacity 0.35s ease;
}

.bg__sparkles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 85% 15%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 70% 70%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(2px 2px at 25% 80%, rgba(255, 220, 255, 0.8), transparent),
    radial-gradient(1px 1px at 50% 45%, rgba(255, 255, 255, 0.7), transparent);
  animation: sparkle-drift 8s ease-in-out infinite alternate;
}

@keyframes sparkle-drift {
  from { opacity: 0.5; transform: translateY(0); }
  to { opacity: 0.9; transform: translateY(-8px); }
}

/* —— Weird underlayer (revealed on interaction) —— */
.weird-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.weird-layer__grain {
  position: absolute;
  inset: -30%;
  opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  animation: grain-shift 0.3s steps(3) infinite;
  transition: opacity 0.3s ease;
}

.weird-layer__scanlines {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  transition: opacity 0.3s ease;
}

.weird-layer__jpeg {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: repeating-linear-gradient(-8deg, rgba(255,255,255,0.04) 0 1px, rgba(0,0,0,0.03) 1px 2px, transparent 2px 4px);
  mix-blend-mode: overlay;
  transition: opacity 0.3s ease;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-1.5%, 0.8%); }
  66% { transform: translate(1%, -1%); }
  100% { transform: translate(0, 0); }
}

body.weird-awake .weird-layer {
  opacity: 1;
}

body.weird-awake .weird-layer__grain {
  opacity: 0.28;
}

body.weird-awake .weird-layer__scanlines {
  opacity: 0.55;
}

body.weird-awake .weird-layer__jpeg {
  opacity: 0.45;
}

body.weird-awake .bg__gradient {
  filter: saturate(1.45) contrast(1.08) hue-rotate(-8deg);
}

body.weird-awake .bg__rainbow {
  opacity: 0.55;
}

body.weird-awake .collage {
  opacity: 1;
  transition: opacity 0.12s ease-out;
}

.collage {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.collage__whisper {
  position: absolute;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.65rem, 2vw, 0.9rem);
  color: rgba(30, 30, 40, 0.55);
  white-space: nowrap;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.collage__whisper--1 { top: 10%; left: 5%; transform: rotate(-7deg); color: #c00; font-weight: 700; }
.collage__whisper--2 { top: 16%; right: 8%; transform: rotate(4deg); }
.collage__whisper--3 { bottom: 22%; left: 7%; transform: rotate(-3deg); font-style: italic; }
.collage__whisper--4 { bottom: 12%; right: 6%; transform: rotate(2deg); color: var(--weird-pink); }
.collage__whisper--5 { top: 42%; left: 3%; transform: rotate(-12deg); font-size: 0.6rem; color: var(--weird-cyan); }
.collage__whisper--6 { top: 35%; right: 4%; transform: rotate(8deg); font-family: "Comic Sans MS", cursive; }

.collage__warn {
  position: absolute;
  top: 6%;
  right: 5%;
  font-family: Arial, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(200, 30, 30, 0.8);
}

/* —— Click sparkles —— */
.sparkle-burst {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  font-size: 1.2rem;
  color: var(--weird-pink);
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.8);
  animation: burst-pop 0.9s ease-out forwards;
  transform: translate(-50%, -50%);
}

@keyframes burst-pop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.4); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1.4) rotate(25deg); }
}

/* —— Layout —— */
.page {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container--wide {
  width: min(100% - 2rem, 820px);
  margin: 0 auto;
}

/* —— Typography —— */
.eyebrow {
  margin: 0 0 0.75rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sage-deep);
  transition: color 0.25s ease, letter-spacing 0.25s ease;
}

body.weird-awake .eyebrow {
  color: #c00;
  letter-spacing: 0.35em;
  font-family: Arial, sans-serif;
}

.title {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--text);
}

.title--couple { font-style: italic; }

.title--ampersand {
  display: block;
  font-size: 0.55em;
  color: var(--gold-deep);
  font-style: normal;
  margin: 0.15em 0;
}

.title--glitchable {
  position: relative;
  cursor: default;
}

.title--glitchable:hover,
.title--glitchable:focus-within {
  animation: title-glitch 0.45s steps(2) 2;
}

.title--glitchable:hover .title--couple,
.title--glitchable:focus-within .title--couple {
  font-family: Impact, "Arial Black", sans-serif;
  font-style: normal;
  color: #ffb32c;
  text-shadow:
    2px 2px 0 #e85d04,
    4px 4px 0 #5c3310,
    0 0 20px rgba(255, 180, 50, 0.5);
}

@keyframes title-glitch {
  0%, 100% { transform: translate(0); filter: none; }
  25% { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
  50% { transform: translate(2px, -1px); filter: saturate(2); }
  75% { transform: translate(-1px, -1px); filter: contrast(1.3); }
}

.subtitle {
  margin: 1.25rem auto 0;
  max-width: 28rem;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  font-weight: 400;
  transition: color 0.3s ease;
}

body.weird-awake .subtitle {
  font-family: Arial, sans-serif;
  color: rgba(40, 40, 50, 0.75);
}

/* —— Couple photo carousel —— */
.photo-carousel-wrap {
  width: min(100%, 320px);
  margin: 1.35rem auto 0;
}

.photo-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1)),
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.85), rgba(232, 223, 245, 0.45));
  border: 1px solid rgba(220, 190, 230, 0.38);
  box-shadow: 0 8px 32px var(--shadow);
  cursor: pointer;
}

.photo-carousel__track {
  position: relative;
  width: 100%;
  height: 100%;
}

.photo-carousel__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.45s ease, transform 0.7s ease;
  pointer-events: none;
}

.photo-carousel__slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.photo-carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-carousel__hint {
  margin: 0.55rem 0 0;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.photo-carousel__hint code {
  font-size: 0.68rem;
  color: var(--gold-deep);
}

.photo-carousel__dots {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  display: flex;
  gap: 0.35rem;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}

.photo-carousel__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 1px rgba(74, 66, 72, 0.1);
  transition: width 0.2s ease, background 0.2s ease;
}

.photo-carousel__dot.is-active {
  width: 16px;
  background: rgba(255, 255, 255, 0.95);
}

.photo-carousel__zones {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 3;
}

.photo-carousel__zone {
  flex: 1;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.5rem 1.25rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--sage-deep);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(200, 180, 220, 0.35);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
}

body.weird-awake .date-badge {
  outline: 2px dashed var(--select-red);
  outline-offset: 3px;
  font-family: "Comic Sans MS", cursive;
}

.date-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

/* —— Integrated date / countdown / times —— */
.when-card {
  width: min(100%, 300px);
  margin: 0.5rem auto 0;
  padding: 0.7rem 0.9rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(200, 180, 220, 0.35);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 16px var(--shadow);
}

.when-card__date {
  margin: 0 0 0.45rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--sage-deep);
}

.when-card__countdown {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem;
  margin-bottom: 0.5rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

.when-card__unit {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1rem;
}

.when-card__value {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.when-card__label {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.when-card__sep {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--gold-light);
  opacity: 0.85;
}

.when-card__done {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--gold-deep);
}

.when-card__countdown--done {
  opacity: 0.4;
}

.when-card__times {
  margin: 0;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(200, 180, 220, 0.3);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.1rem 0.2rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.when-card__tz-label {
  color: var(--text-muted);
}

.when-card__tz-time {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.when-card__tz-dot {
  opacity: 0.45;
}

/* —— Hero —— */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.hero__divider {
  width: 60px;
  height: 1px;
  margin: 2rem auto;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}

/* —— Glitchable elements —— */
.glitchable {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.glitchable__face {
  position: relative;
  z-index: 2;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.glitchable__weird {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.45)),
    var(--weird-img, none) center / cover no-repeat;
  transition: opacity 0.12s ease-out;
}

.glitchable__weird-text {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.75rem, 2.5vw, 0.95rem);
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow:
    2px 2px 0 #000,
    -1px 0 var(--weird-cyan),
    1px 0 var(--weird-pink);
  letter-spacing: 0.04em;
  line-height: 1.4;
  animation: text-flicker 0.15s steps(2) infinite;
}

@keyframes text-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.glitchable.is-revealed {
  outline: 3px solid var(--select-red);
  outline-offset: 0;
  animation: card-shake 0.35s ease;
}

.glitchable.is-revealed .glitchable__face {
  opacity: 0.15;
  filter: saturate(2.2) contrast(1.2) blur(1px);
}

.glitchable.is-revealed .glitchable__weird {
  opacity: 1;
}

.glitchable.is-revealed::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 2px,
    rgba(255, 255, 255, 0.04) 2px 4px
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

@keyframes card-shake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 1px) rotate(-0.5deg); }
  40% { transform: translate(2px, -1px) rotate(0.5deg); }
  60% { transform: translate(-1px, 2px); }
  80% { transform: translate(1px, -2px); }
}

.btn.glitchable,
.back-link.glitchable {
  position: relative;
}

.btn.glitchable.is-revealed,
.back-link.glitchable.is-revealed {
  filter: saturate(1.8) contrast(1.1);
  font-family: "Comic Sans MS", "Comic Sans", cursive;
}

.btn.glitchable.is-revealed::after,
.back-link.glitchable.is-revealed::after {
  content: attr(data-weird);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 var(--weird-cyan), 1px 0 var(--weird-pink);
  background: rgba(20, 10, 30, 0.75);
  border-radius: inherit;
  animation: text-flicker 0.15s steps(2) infinite;
}

.back-link.glitchable.is-revealed::after {
  font-size: 0.68rem;
}

/* —— Action cards —— */
.actions {
  display: grid;
  gap: 1rem;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

@media (min-width: 540px) {
  .actions {
    grid-template-columns: 1fr 1fr;
    width: min(100%, 620px);
  }
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(220, 190, 230, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 28px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:nth-child(even).is-revealed {
  outline-color: var(--select-blue);
}

.action-card:hover:not(.is-revealed) {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px var(--shadow-deep);
}

.action-card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--gold-deep);
  background: linear-gradient(135deg, rgba(255, 200, 230, 0.3), rgba(200, 220, 255, 0.25));
  border-radius: 50%;
}

.action-card__title {
  margin: 0 0 0.5rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.action-card__desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* —— Footer —— */
.footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  opacity: 0.85;
  transition: all 0.3s ease;
}

body.weird-awake .footer {
  font-family: "Comic Sans MS", cursive;
  color: var(--weird-pink);
  letter-spacing: 0.12em;
}

/* —— Page header —— */
.page-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.page-header .title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--sage-deep);
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--gold-deep);
}

.back-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* —— Forms —— */
.message-form,
.tarot-panel {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(220, 190, 230, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 28px var(--shadow);
  backdrop-filter: blur(4px);
  transition: outline 0.25s ease, filter 0.25s ease;
}

.message-form:hover,
.tarot-panel:hover,
.message-form:focus-within,
.tarot-panel:focus-within {
  outline: 2px dashed rgba(196, 163, 90, 0.25);
}

.message-form.is-revealed,
.tarot-panel.is-revealed {
  outline: 3px solid var(--select-blue);
  filter: saturate(1.2);
}

.message-form__title,
.tarot-panel__title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
  font-weight: 400;
  text-align: center;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--cream);
  border: 1px solid rgba(180, 160, 200, 0.35);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, filter 0.2s ease;
}

.form-group input:hover,
.form-group textarea:hover {
  filter: saturate(1.15);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 184, 150, 0.2);
  animation: input-glitch 0.3s steps(2);
}

@keyframes input-glitch {
  0%, 100% { transform: translate(0); }
  50% { transform: translate(1px, 0); filter: hue-rotate(20deg); }
}

.form-group textarea { min-height: 110px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.5rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ivory);
  background: linear-gradient(135deg, #c8b8d8 0%, #9aab9a 100%);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(154, 171, 154, 0.4);
  filter: saturate(1.2);
}

.btn.is-revealed,
.btn:hover {
  outline: 2px solid var(--select-red);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.form-status {
  margin: 0.75rem 0 0;
  min-height: 1.25rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.82rem;
  text-align: center;
  color: var(--sage-deep);
}

.form-status--error { color: #a04040; }

.label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

.field-hint {
  margin: 0.4rem 0 0;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-input {
  width: 100%;
  padding: 0.65rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  background: var(--cream);
  border: 1px dashed rgba(180, 160, 200, 0.5);
  border-radius: var(--radius);
  cursor: pointer;
}

.file-input::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sage-deep);
  background: var(--ivory);
  border: 1px solid rgba(138, 154, 123, 0.35);
  border-radius: 6px;
  cursor: pointer;
}

.form-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 540px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}

/* —— Image previews —— */
.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.image-preview__item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(196, 163, 90, 0.25);
  box-shadow: 0 2px 8px var(--shadow);
}

.image-preview__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--ivory);
  background: rgba(61, 56, 50, 0.65);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.image-preview--tarot .image-preview__item {
  width: 120px;
  height: 180px;
}

/* —— Messages —— */
.messages-section { padding-bottom: 3rem; }

.messages-section__title {
  margin: 0 0 1.25rem;
  font-size: 1.2rem;
  font-weight: 400;
  text-align: center;
  color: var(--text-muted);
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-card {
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(220, 190, 230, 0.3);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px var(--shadow);
  transition: outline 0.2s ease, filter 0.2s ease;
}

.message-card:hover {
  outline: 2px solid var(--select-red);
  filter: saturate(1.15) contrast(1.05);
}

.message-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
}

.message-card__name {
  margin: 0;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
}

.message-card__date {
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.message-card__body {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-card__images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.message-card__image {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(196, 163, 90, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.message-card__image:hover {
  transform: scale(1.06);
  filter: saturate(1.5) contrast(1.1);
  outline: 2px solid var(--select-blue);
}

.messages-empty,
.messages-loading,
.tarot-loading,
.tarot-empty {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.messages-empty { font-style: italic; }

.tarot-empty a { color: var(--sage-deep); }

/* —— Tarot panel —— */
.tarot-panel { margin-bottom: 2.5rem; }

.tarot-panel__header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.tarot-panel__icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  color: var(--gold-deep);
  background: linear-gradient(135deg, rgba(255, 200, 230, 0.35), rgba(200, 220, 255, 0.3));
  border-radius: 50%;
}

.tarot-panel__desc {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tarot-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.tarot-form {
  padding-top: 1.25rem;
  border-top: 1px solid rgba(220, 190, 230, 0.3);
}

.btn--outline {
  width: auto;
  color: var(--sage-deep);
  background: transparent;
  border: 1px solid rgba(154, 171, 154, 0.45);
}

.btn--outline:hover:not(:disabled) {
  background: rgba(200, 220, 255, 0.15);
  box-shadow: none;
}

.btn--ghost {
  width: auto;
  color: var(--gold-deep);
  background: transparent;
  border: none;
  letter-spacing: 0.06em;
  text-transform: none;
  font-weight: 500;
}

.btn--ghost:hover:not(:disabled) {
  color: var(--weird-pink);
  transform: none;
  box-shadow: none;
}

.btn--gold {
  background: linear-gradient(135deg, #f0d8b8 0%, var(--gold) 55%, var(--gold-deep) 100%);
}

.btn--inline {
  width: auto;
  margin-top: 1.25rem;
}

.tarot-template-downloads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.tarot-template-downloads .btn--inline {
  margin-top: 0;
}

/* —— Tarot gallery —— */
.tarot-section {
  margin-bottom: 2.75rem;
}

.tarot-section__title {
  margin: 0 0 0.35rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tarot-section__desc {
  margin: 0 0 1.35rem;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 36rem;
}

.tarot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.25rem;
  padding-bottom: 0.5rem;
}

@media (min-width: 640px) {
  .tarot-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem;
  }
}

.tarot-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tarot-card__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform 0.2s ease, outline 0.2s ease, filter 0.2s ease;
  position: relative;
}

.tarot-card__btn .glitchable__face {
  display: block;
}

.tarot-card__btn .glitchable__face img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.tarot-card__btn:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  outline: 3px solid var(--select-red);
  filter: saturate(1.35) contrast(1.08);
}

.tarot-card__btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.tarot-card__img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--cream-deep);
}

.tarot-card__meta { text-align: center; }

.tarot-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.tarot-card__author {
  margin: 0.2rem 0 0;
  font-family: "Jost", "Segoe UI", system-ui, sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* —— Lightbox (weirdcore on reveal) —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(20, 15, 30, 0.88);
  backdrop-filter: blur(3px) saturate(1.3);
}

.lightbox[hidden] { display: none; }

.lightbox__inner {
  margin: 0;
  max-width: min(92vw, 480px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox__img {
  max-width: 100%;
  max-height: min(78vh, 720px);
  object-fit: contain;
  border-radius: 4px;
  outline: 3px solid var(--select-red);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.25), 0 16px 48px rgba(0, 0, 0, 0.4);
  filter: contrast(1.05) saturate(1.1);
}

.lightbox__caption {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.1rem;
  color: #ffb32c;
  text-align: center;
  text-shadow: 2px 2px 0 #5c3310;
}

.lightbox__close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: 3px solid var(--select-blue);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg__sparkles,
  .weird-layer__grain,
  .sparkle-burst,
  .glitchable.is-revealed,
  .title--glitchable:hover { animation: none; }
  .action-card,
  .btn,
  .tarot-card__btn,
  .message-card__image { transition: none; }
}

/* —— Mobile polish —— */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: rgba(212, 184, 150, 0.3);
}

.page {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.form-group input,
.form-group textarea,
.file-input {
  font-size: 16px;
}

.btn,
.action-card,
.back-link {
  touch-action: manipulation;
}

.btn {
  min-height: 48px;
}

.action-card {
  min-height: 120px;
}

@media (max-width: 540px) {
  .hero {
    padding: 2rem 0.75rem 1.25rem;
  }

  .title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .photo-carousel-wrap {
    width: min(100%, 280px);
    margin-top: 1rem;
  }

  .when-card {
    width: min(100%, 280px);
    padding: 0.6rem 0.75rem;
  }

  .when-card__value {
    font-size: 0.95rem;
  }

  .when-card__times {
    font-size: 0.62rem;
  }

  .actions {
    width: 100%;
    padding: 0 0.75rem 2rem;
  }

  .action-card {
    padding: 1.35rem 1.1rem;
  }

  .page-header {
    padding: 2rem 0.75rem 1.25rem;
  }

  .container--wide {
    width: min(100% - 1.25rem, 820px);
  }

  .message-form,
  .tarot-panel {
    padding: 1.25rem;
  }

  .image-preview__item {
    width: 76px;
    height: 76px;
  }

  .tarot-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
