:root {
  --cream: #f5ecdd;
  --paper: #fbf6ec;
  --paper-deep: #eee0ca;
  --ink: #49352c;
  --ink-soft: #745d4f;
  --terracotta: #b9573f;
  --terracotta-dark: #93412f;
  --amber: #d99a43;
  --sage: #778565;
  --sage-dark: #556148;
  --line: rgba(110, 63, 46, .18);
  --shadow: 0 24px 70px rgba(73, 53, 44, .18);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --script: "Caveat", "Segoe Print", "Bradley Hand", cursive;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 10% 15%, rgba(217, 154, 67, .18), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgba(119, 133, 101, .2), transparent 34rem),
    #d9c7ae;
  color: var(--ink);
  font-family: var(--serif);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 85% 6%, rgba(217, 154, 67, .22), transparent 240px),
    radial-gradient(circle at 8% 30%, rgba(185, 87, 63, .12), transparent 260px),
    radial-gradient(circle at 90% 62%, rgba(119, 133, 101, .16), transparent 280px),
    radial-gradient(circle at 12% 96%, rgba(217, 154, 67, .2), transparent 260px),
    linear-gradient(105deg, rgba(255, 255, 255, .28), transparent 22%),
    var(--cream);
  box-shadow: var(--shadow);
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.page-shell::before {
  top: -115px;
  right: -120px;
  width: 280px;
  height: 280px;
  border: 42px solid rgba(185, 87, 63, .14);
}

.page-shell::after {
  bottom: -170px;
  left: -150px;
  width: 340px;
  height: 340px;
  border: 52px solid rgba(119, 133, 101, .16);
}

.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.topline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: calc(50px + env(safe-area-inset-top));
  padding: calc(14px + env(safe-area-inset-top)) 20px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  color: var(--ink-soft);
  font-family: Georgia, serif;
  font-size: 9px;
  letter-spacing: .15em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(110, 63, 46, .1);
  background: linear-gradient(to bottom, rgba(245, 236, 221, .96), rgba(245, 236, 221, .83));
  backdrop-filter: blur(8px);
}

.topline-mark {
  color: var(--terracotta);
  font-weight: 700;
}

#progress-label {
  text-align: center;
}

#progress-number {
  text-align: right;
}

#invitation {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(72px + env(safe-area-inset-top)) 22px calc(26px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(28px);
  transition: opacity .34s ease, transform .42s cubic-bezier(.22, .78, .32, 1), visibility 0s linear .42s;
}

.screen.active {
  z-index: 3;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition-delay: .18s;
}

.screen.slide-out {
  z-index: 2;
  opacity: 0;
  visibility: visible;
  transform: translateX(-28px);
  transition-delay: 0s;
}

.screen-content {
  position: relative;
  z-index: 2;
  width: min(100%, 392px);
  margin: auto;
  padding: 12px 2px 8px;
}

.compact-content {
  max-width: 362px;
}

.centered-content {
  text-align: center;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--terracotta);
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .27em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: .94;
}

h1 {
  max-width: 355px;
  font-size: clamp(49px, 14vw, 70px);
}

h2 {
  font-size: clamp(42px, 11.5vw, 58px);
}

h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.05;
}

.lead,
.section-intro {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.42;
}

.lead {
  margin: 24px 0 28px;
}

.section-intro {
  margin: 18px 0 21px;
}

strong {
  color: var(--ink);
  font-weight: 700;
}

.handwritten {
  margin: 22px 0 30px;
  color: var(--sage-dark);
  font-family: var(--script);
  font-size: 29px;
  line-height: 1.05;
  transform: rotate(-2deg);
}

.small-script {
  margin: 23px 0;
  font-size: 24px;
  text-align: center;
}

.button {
  position: relative;
  min-height: 52px;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
  transition: transform .16s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.color-swatch:focus-visible {
  outline: 3px solid rgba(217, 154, 67, .55);
  outline-offset: 3px;
}

.button:active {
  transform: translateY(2px) scale(.99);
}

.button:disabled {
  cursor: wait;
  opacity: .62;
}

.button-primary {
  width: 100%;
  padding: 17px 23px;
  color: #fffaf1;
  background: var(--terracotta);
  box-shadow: 0 8px 22px rgba(147, 65, 47, .2);
}

.button-primary:hover:not(:disabled) {
  background: var(--terracotta-dark);
  box-shadow: 0 10px 27px rgba(147, 65, 47, .27);
}

.button-primary span {
  display: inline-block;
  margin-left: 9px;
  font-size: 16px;
  transition: transform .2s ease;
}

.button-primary:hover span {
  transform: translateX(3px);
}

.button-secondary {
  width: 100%;
  padding: 15px 22px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, .45);
}

.button-text {
  display: block;
  min-height: 42px;
  margin: 8px auto 0;
  padding: 10px 16px;
  color: var(--ink-soft);
  border-bottom: 1px solid rgba(73, 53, 44, .26);
  background: transparent;
}

.button-text:hover {
  color: var(--terracotta);
  border-color: var(--terracotta);
}

.corner-sprig,
.side-botanical {
  position: absolute;
  z-index: 1;
  width: 156px;
  height: 116px;
  color: var(--sage);
  pointer-events: none;
}

.corner-sprig-left {
  bottom: -8px;
  left: -34px;
  transform: rotate(8deg);
  opacity: .74;
}

.corner-sprig-right {
  top: 58px;
  right: -44px;
  transform: rotate(118deg);
  opacity: .53;
}

.side-botanical {
  top: 76px;
  right: -46px;
  transform: rotate(105deg);
  opacity: .45;
}

.bottom-botanical {
  top: auto;
  right: -30px;
  bottom: 12px;
  transform: rotate(192deg);
}

.intro-screen {
  text-align: left;
}

.intro-screen::before {
  content: "";
  position: absolute;
  top: 16%;
  left: 22px;
  width: 1px;
  height: 69%;
  background: linear-gradient(var(--terracotta), transparent);
  opacity: .28;
}

.intro-content {
  padding-left: 18px;
}

.hero-flower {
  width: 106px;
  height: 106px;
  margin: 0 0 19px auto;
  color: var(--terracotta);
  transform: rotate(8deg);
  filter: drop-shadow(0 6px 14px rgba(185, 87, 63, .25));
}

.hero-flower svg {
  width: 100%;
  height: 100%;
}

.small-flower {
  width: 63px;
  height: 63px;
  margin: 0 auto 18px;
}

.date-lockup {
  display: grid;
  grid-template-columns: auto 1px 1fr;
  align-items: center;
  gap: 15px;
  margin: 19px 0 20px;
  padding: 13px 17px;
  color: var(--terracotta);
  background: linear-gradient(120deg, rgba(185, 87, 63, .13), rgba(217, 154, 67, .15));
  border: 1px solid rgba(185, 87, 63, .2);
  border-radius: 12px;
}

.date-day {
  font-size: 58px;
  font-weight: 600;
  line-height: 1;
}

.date-rule {
  width: 1px;
  height: 42px;
  background: var(--terracotta);
  opacity: .45;
}

.date-copy {
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.45;
  text-transform: uppercase;
}

.details-list {
  border-top: 1px solid var(--line);
}

.detail-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.detail-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.35;
}

.detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--terracotta-dark);
  background: rgba(217, 154, 67, .22);
  border-radius: 50%;
  font-size: 19px;
}

.note-card {
  position: relative;
  margin: 15px 0 16px;
  padding: 14px 17px;
  border: 1px solid rgba(119, 133, 101, .34);
  border-left: 5px solid var(--sage);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(135deg, rgba(119, 133, 101, .16), rgba(217, 154, 67, .1));
}

.note-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.36;
}

.note-divider {
  display: block;
  width: 52px;
  height: 1px;
  margin: 10px 0;
  background: var(--amber);
}

.gift-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 16px 15px;
  margin-bottom: 12px;
  background: linear-gradient(125deg, rgba(217, 154, 67, .16), rgba(245, 236, 221, .4));
  border: 1px solid rgba(185, 87, 63, .18);
  border-radius: 14px;
}

.gift-card + .gift-card {
  background: linear-gradient(125deg, rgba(119, 133, 101, .16), rgba(245, 236, 221, .4));
  border-color: rgba(119, 133, 101, .26);
}

.gift-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.38;
}

.gift-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #fffaf0;
  background: var(--terracotta);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(185, 87, 63, .3);
}

.gift-card + .gift-card .gift-number {
  background: var(--sage);
  box-shadow: 0 4px 10px rgba(119, 133, 101, .3);
}

.status-message {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  color: var(--ink-soft);
  border-left: 3px solid var(--amber);
  background: rgba(217, 154, 67, .1);
  font-size: 14px;
  line-height: 1.35;
}

.status-message.visible {
  display: block;
}

.status-message.success {
  color: var(--sage-dark);
  border-color: var(--sage);
  background: rgba(119, 133, 101, .12);
}

.status-message.error {
  color: var(--terracotta-dark);
  border-color: var(--terracotta);
  background: rgba(185, 87, 63, .09);
}

.buffet-list {
  max-height: 151px;
  margin: 0 0 15px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--line);
  scrollbar-color: var(--sage) transparent;
}

.buffet-list:empty {
  display: none;
}

.buffet-entry {
  display: grid;
  grid-template-columns: minmax(70px, .8fr) minmax(0, 1.5fr);
  gap: 12px;
  padding: 10px 3px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.25;
}

.buffet-entry strong {
  color: var(--terracotta-dark);
}

.buffet-entry span {
  color: var(--ink-soft);
}

.buffet-form,
.music-form {
  display: grid;
  gap: 7px;
}

label {
  margin-top: 3px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid rgba(110, 63, 46, .23);
  border-radius: 0;
  background: rgba(255, 252, 246, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
  outline: none;
}

input {
  height: 46px;
  padding: 0 13px;
  font-size: 16px;
}

textarea {
  min-height: 112px;
  padding: 13px;
  resize: vertical;
  font-size: 18px;
  line-height: 1.35;
}

input::placeholder,
textarea::placeholder {
  color: #aa9585;
}

.buffet-form .button,
.music-form .button {
  margin-top: 8px;
}

.rsvp-actions {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.response-bubble {
  min-height: 54px;
  margin: 22px 0 0;
  color: var(--sage-dark);
  font-family: var(--script);
  font-size: 26px;
  line-height: 1.1;
}

.drawing-content {
  text-align: center;
}

.drawing-content h2 {
  font-size: clamp(40px, 10.5vw, 52px);
}

.drawing-content .section-intro {
  margin: 12px auto 14px;
  max-width: 340px;
  font-size: 16px;
}

.portrait-frame {
  position: relative;
  width: min(74vw, 288px);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  padding: 13px;
  background:
    linear-gradient(135deg, transparent 7px, rgba(255, 255, 255, .24) 8px, transparent 10px),
    repeating-linear-gradient(90deg, #934c32 0, #bd7045 9px, #a65838 18px, #d08b55 23px);
  border: 2px solid #7f3d2d;
  box-shadow:
    0 9px 25px rgba(73, 53, 44, .22),
    inset 0 0 0 3px rgba(246, 201, 122, .4);
}

.portrait-frame::before,
.portrait-frame::after {
  content: "✦";
  position: absolute;
  z-index: 2;
  color: #f2c979;
  font-size: 15px;
}

.portrait-frame::before {
  top: 2px;
  left: 5px;
}

.portrait-frame::after {
  right: 5px;
  bottom: 2px;
}

.frame-inner {
  width: 100%;
  height: 100%;
  padding: 5px;
  background: #e8c98c;
  box-shadow: inset 0 0 5px rgba(73, 53, 44, .55);
}

#portrait-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  background: #fffaf0;
}

.color-palette {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 11px;
}

.color-swatch {
  width: 31px;
  height: 31px;
  padding: 0;
  border: 3px solid var(--cream);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(73, 53, 44, .18);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.color-swatch.active {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 0 0 2px var(--ink);
}

.light-swatch {
  box-shadow: 0 0 0 1px rgba(73, 53, 44, .38);
}

.drawing-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 15px;
}

.drawing-actions .button-text {
  margin: 0;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.3;
}

.field-meta span:last-child {
  flex: none;
}

.end-summary {
  width: 100%;
  margin: 0 0 22px;
  padding: 14px 18px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.4;
}

.end-summary:empty {
  display: none;
}

.share-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--sage-dark);
  font-size: 14px;
}

noscript {
  position: fixed;
  inset: auto 12px 12px;
  z-index: 100;
  padding: 12px;
  color: #fff;
  background: var(--terracotta-dark);
  text-align: center;
}

@media (max-height: 720px) {
  .screen {
    align-items: flex-start;
  }

  .screen-content {
    margin-top: 0;
  }

  .intro-screen,
  #screen-rsvp,
  #screen-end {
    align-items: center;
  }

  .portrait-frame {
    width: min(57vh, 238px);
  }

  .drawing-content .section-intro {
    margin-bottom: 9px;
  }
}

@media (min-width: 600px) {
  body {
    padding: 18px 0;
  }

  .page-shell {
    height: calc(100% - 36px);
    border-radius: 3px;
  }
}

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