:root {
  color-scheme: light;
  --sky: #8b4b35;
  --deep-blue: #4e3327;
  --gold: #c58a24;
  --gold-light: #f7d77e;
  --sand: #fff5df;
  --ink: #4f3c31;
  --coral: #e77353;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #c8b18a; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  overflow-x: hidden;
}

button, input { font: inherit; }

.backdrop {
  position: fixed;
  inset: -3vmax;
  z-index: -3;
  background-color: #f3e5cb;
  background-image: url("/wedding-background-v4.png");
  background-position: center center;
  background-size: 768px 512px;
  background-repeat: repeat;
  filter: saturate(.88) brightness(.98);
  transform: scale(1.03);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 248, 235, .13);
}

.sunlight {
  position: fixed;
  z-index: -2;
  top: -20vw;
  right: -22vw;
  width: 65vw;
  height: 65vw;
  border-radius: 50%;
  display: none;
  animation: breathe 8s ease-in-out infinite alternate;
}

.page-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.welcome-card {
  position: relative;
  width: min(100%, 490px);
  min-height: 620px;
  padding: 48px 38px 26px;
  border: 1px solid rgba(255, 221, 132, .92);
  border-radius: 30px;
  background: linear-gradient(150deg, rgba(255, 252, 240, .95), rgba(250, 237, 207, .92));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 25px 70px rgba(68, 43, 25, .34), inset 0 0 0 5px rgba(255,255,255,.5), inset 0 0 0 7px rgba(178,120,24,.4);
  overflow: hidden;
  animation: card-arrival .9s cubic-bezier(.2,.8,.2,1) both;
}

.welcome-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(205, 145, 28, .38);
  border-radius: 21px;
  pointer-events: none;
}

.corner {
  position: absolute;
  top: 13px;
  color: var(--gold);
  font-size: 33px;
  line-height: 1;
  opacity: .85;
}

.corner-left { left: 19px; transform: rotate(-38deg); }
.corner-right { right: 19px; transform: scaleX(-1) rotate(-38deg); }

.hero { text-align: center; }

.eyebrow {
  margin: 0 0 18px;
  color: #8a6328;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-weight: 400;
  line-height: 1.08;
  text-shadow: 0 1px 0 #fff, 0 2px 2px rgba(99,58,0,.16);
}

.couple-line {
  display: block;
  color: var(--gold);
  font-size: clamp(1.2rem, 5.8vw, 2.35rem);
  letter-spacing: -.035em;
  white-space: nowrap;
}

.welcome-line {
  display: block;
  margin-top: 9px;
  color: #704631;
  font-size: clamp(1.4rem, 5.8vw, 2rem);
  font-style: italic;
  letter-spacing: -.02em;
}

.ornament { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 21px auto; color: var(--gold); }
.ornament span { width: 62px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament span:last-child { transform: scaleX(-1); }
.ornament b { font-size: 9px; }

.intro {
  max-width: 360px;
  margin: 0 auto 31px;
  color: #58483e;
  font-size: 1.02rem;
  line-height: 1.65;
}

.lookup-form { position: relative; z-index: 1; }
.lookup-form label { display: block; margin: 0 0 10px 3px; color: #5e4638; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .78rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }

.input-wrap {
  padding: 1px;
  border: 1px solid rgba(180, 126, 36, .7);
  border-radius: 14px;
  background: rgba(255, 250, 238, .82);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 8px 22px rgba(92,59,29,.09);
}

input {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  outline: 0;
  padding: 0 17px;
  color: #4d372c;
  background: rgba(255, 253, 247, .84);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
}

input:focus { box-shadow: inset 0 0 0 2px rgba(165,102,54,.2); }
input::placeholder { color: #9a887b; }

.lookup-form button,
.result .text-button {
  cursor: pointer;
  border: 0;
}

.lookup-form button {
  width: 100%;
  min-height: 57px;
  margin-top: 18px;
  border: 1px solid rgba(112, 57, 40, .34);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #fffaf0;
  background: linear-gradient(135deg, #9a5a41, #713b2d);
  box-shadow: 0 10px 24px rgba(94,49,35,.24), inset 0 1px rgba(255,255,255,.22);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 750;
  transition: transform .2s ease, box-shadow .2s ease;
}

.lookup-form button:hover { transform: translateY(-2px); box-shadow: 0 13px 29px rgba(94,49,35,.3); }
.lookup-form button:active { transform: translateY(0); }
.lookup-form button:focus-visible, .camera-button:focus-visible { outline: 3px solid rgba(151,91,57,.3); outline-offset: 3px; }
.lookup-form button[disabled] { cursor: wait; opacity: .72; }
.lookup-form button i { font-style: normal; font-size: 1.4rem; line-height: 1; }

.form-message {
  min-height: 42px;
  margin: 10px 5px 0;
  color: #a23d31;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .84rem;
  line-height: 1.4;
  text-align: center;
}

.result {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: reveal .7s cubic-bezier(.18,.85,.3,1.15) both;
}

.result-kicker { margin: 4px 0 7px; color: #966311; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .72rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.result h2 { margin: 0 0 10px; color: var(--deep-blue); font-size: 2.25rem; font-weight: 400; line-height: 1.08; }
.result > p:not(.result-kicker):not(.result-wish) { margin: 0; }

.table-number {
  width: min(100%, 300px);
  margin: 20px auto;
  padding: 20px 17px;
  border: 1px solid #d3a132;
  border-radius: 18px;
  color: #fff8df;
  background: linear-gradient(145deg, #d7a12d, #a96910);
  box-shadow: 0 15px 35px rgba(123,75,5,.26), inset 0 0 0 3px rgba(255,237,171,.25);
  font-size: clamp(2rem, 10vw, 3.4rem);
  line-height: 1;
  text-shadow: 0 2px 3px rgba(79,44,0,.25);
}

.result-wish { max-width: 335px; margin: 16px auto; line-height: 1.55; }
.text-button { padding: 8px; color: #176b92; background: transparent; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; }

.table-details > p { margin: 0; }
.photo-panel { margin-top: 15px; padding-top: 14px; border-top: 1px solid rgba(190,132,24,.28); }
.photo-panel h3 { margin: 0 0 7px; color: var(--deep-blue); font-size: 1.16rem; }
.photo-explanation { margin: 0 auto 13px; max-width: 350px; color: #5b493e; font: .86rem/1.45 ui-sans-serif, system-ui, sans-serif; }
.photo-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 11px; }
.photo-stats div { padding: 9px; border: 1px solid rgba(205,145,28,.35); border-radius: 12px; background: rgba(255,255,255,.5); }
.photo-stats strong, .photo-stats span { display: block; }
.photo-stats strong { color: #a66b10; font-size: 1.45rem; line-height: 1; }
.photo-stats span { margin-top: 4px; font: .7rem ui-sans-serif, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; }
.camera-button { width: 100%; min-height: 50px; border: 1px solid rgba(112,57,40,.34); border-radius: 13px; color: #fffaf0; background: linear-gradient(135deg, #9a5a41, #713b2d); box-shadow: 0 8px 20px rgba(94,49,35,.22); font: 750 .92rem ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.camera-button:disabled { cursor: not-allowed; opacity: .55; }
.photo-status { min-height: 32px; margin: 8px 0 0; color: #496c7c; font: .75rem/1.35 ui-sans-serif, system-ui, sans-serif; }
.visually-hidden { position: fixed !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.result-mode .hero { display: none; }
.result-mode.welcome-card { display: flex; align-items: center; justify-content: center; padding-top: 58px; padding-bottom: 70px; }
.result-mode .result { width: 100%; }
.result-mode .result h2 { font-size: 1.85rem; }
.result-mode .table-number { margin: 10px auto; padding: 12px; font-size: 2.1rem; }

.petals { position: absolute; inset: -45px -25px 0; pointer-events: none; overflow: hidden; }
.petal { position: absolute; top: -18px; width: 11px; height: 17px; border-radius: 70% 30% 65% 35%; background: linear-gradient(145deg, #ffb493, #e56b4d); animation: petal-fall 2.4s ease-in forwards; opacity: 0; }

footer {
  position: absolute;
  left: 35px;
  right: 35px;
  bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  color: #8f681d;
  font-size: .92rem;
  font-style: italic;
}
footer b { color: var(--gold); font-style: normal; font-size: .72rem; }

@keyframes card-arrival { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes breathe { from { transform: translate(0, 0) scale(.95); } to { transform: translate(-3vw, 2vw) scale(1.08); } }
@keyframes petal-fall { 0% { opacity: 0; transform: translate3d(0, -12px, 0) rotate(0); } 12% { opacity: .9; } 100% { opacity: 0; transform: translate3d(var(--drift), 360px, 0) rotate(420deg); } }

@media (max-width: 520px) {
  body { width: 100%; height: 100svh; min-height: 100svh; overflow: hidden; }
  .page-shell { width: 100%; height: 100svh; min-height: 0; padding: 8px; align-items: stretch; overflow: hidden; }
  .welcome-card { height: calc(100svh - 16px); min-height: 0; padding: clamp(31px, 5svh, 43px) 25px 58px; border-radius: 25px; }
  .intro { font-size: .96rem; margin-bottom: 25px; }
  .backdrop { background-position: center center; }
}

@media (max-width: 520px) and (max-height: 700px) {
  .eyebrow { margin-bottom: 4px; }
  .couple-line { font-size: clamp(1.14rem, 5.65vw, 1.5rem); }
  .welcome-line { margin-top: 6px; font-size: 1.35rem; }
  .ornament { margin: 12px auto; }
  .intro { margin-bottom: 13px; font-size: .91rem; line-height: 1.45; }
  input { min-height: 49px; }
  .lookup-form button { min-height: 50px; }
  .form-message { min-height: 30px; margin-top: 7px; }
  .result-mode.welcome-card { padding-top: 48px; padding-bottom: 64px; }
  .result-mode .hero { margin-bottom: 6px; }
  .result-mode .result-kicker { display: none; }
  .result-mode .result h2 { font-size: 1.55rem; margin-bottom: 6px; }
  .photo-panel { margin-top: 9px; padding-top: 9px; }
  .photo-explanation { margin-bottom: 8px; font-size: .78rem; }
  .photo-stats { margin-bottom: 8px; }
  .photo-stats div { padding: 7px; }
  .photo-status { margin-top: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .petals { display: none; }
}
