@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700;9..144,900&family=Manrope:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  font-family: "Manrope", sans-serif;
  color: #2e2a26;
  background: #f8f5ef;
  font-synthesis: none;
  --cream: #f8f5ef;
  --paper: #fcfaf6;
  --white: #ffffff;
  --forest: #244936;
  --terracotta: #c66a45;
  --terracotta-dark: #a95334;
  --charcoal: #2e2a26;
  --muted: #6e665d;
  --border: #ded7cb;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 3px;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 72px;
}

.hero {
  min-height: 96svh;
  display: flex;
  flex-direction: column;
  padding: 44px 0 108px;
}

.invitation-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.calendar-menu {
  position: relative;
}

.calendar-button,
.save-date,
.new-chat {
  padding: 10px 18px;
  border: 1px solid var(--forest);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.calendar-button {
  list-style: none;
  user-select: none;
}

.calendar-button::-webkit-details-marker {
  display: none;
}

.save-date {
  color: var(--cream);
  background: var(--forest);
}

.save-date:hover {
  border-color: var(--terracotta);
  background: var(--terracotta);
}

.calendar-button,
.new-chat {
  color: var(--forest);
  background: var(--cream);
}

.calendar-button:hover,
.new-chat:hover {
  color: var(--cream);
  background: var(--forest);
}

.calendar-options {
  position: absolute;
  z-index: 10;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  padding: 10px;
  border: 1px solid var(--forest);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 6px 6px 0 rgba(36, 73, 54, 0.12);
}

.calendar-options a {
  display: block;
  padding: 10px;
  border-radius: 2px;
  color: var(--forest);
  font-size: 13px;
  text-decoration: none;
}

.calendar-options a:hover {
  color: var(--paper);
  background: var(--terracotta);
}

.calendar-options p {
  margin: 11px 10px 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy {
  width: min(100%, 820px);
  margin: auto;
  padding: clamp(104px, 14vh, 168px) 0 68px;
}

.eyebrow {
  margin: 0;
  color: var(--terracotta);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  line-height: 1.5;
  text-transform: uppercase;
}

.hero-copy > .eyebrow {
  margin: 0 0 32px;
  text-align: center;
}

.hero-title {
  margin: 0;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: clamp(62px, 12.8vw, 162px);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.78;
  text-transform: uppercase;
  text-align: center;
}

.hero-title span {
  display: block;
}

.title-first,
.title-second {
  text-align: center;
}

.title-ampersand {
  width: max-content;
  margin: 0.14em auto 0.12em;
  color: var(--terracotta);
  font-size: 0.42em;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.85;
}

.wedding-details {
  margin: clamp(60px, 8.8vh, 96px) auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.wedding-details p {
  margin: 0;
}

.wedding-details span {
  width: 42px;
  height: 1px;
  background: var(--terracotta);
}

.hero-prompt {
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.65;
  text-align: center;
}

.chat-section {
  position: relative;
  width: min(900px, 100%);
  min-height: 720px;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 60px);
  display: grid;
  grid-template-rows: auto minmax(310px, 1fr) auto auto;
  gap: 24px;
  border: 1px solid var(--forest);
  background: var(--paper);
}

.chat-section::before {
  position: absolute;
  inset: 7px;
  border: 1px solid var(--border);
  content: "";
  pointer-events: none;
}

.chat-heading {
  position: relative;
  z-index: 1;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.chat-heading h2 {
  margin: 7px 0 0;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: clamp(36px, 6vw, 58px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
}

.messages {
  position: relative;
  z-index: 1;
  min-height: 0;
  padding: 8px 2px 18px;
  overflow-y: auto;
  scrollbar-color: rgba(36, 73, 54, 0.38) transparent;
  scrollbar-width: thin;
}

.message {
  display: flex;
  margin: 16px 0;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(650px, 88%);
  padding: 16px;
  border-radius: 8px;
  color: var(--charcoal);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant .bubble {
  border: 1px solid var(--border);
  border-left: 3px solid var(--forest);
  border-bottom-left-radius: 2px;
  background: #f3f0e8;
  text-align: left;
}

.user .bubble {
  border: 1px solid var(--border);
  border-top: 3px solid var(--terracotta);
  border-bottom-right-radius: 2px;
  background: var(--white);
}

.markdown {
  overflow-x: auto;
  white-space: normal;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown > :last-child {
  margin-bottom: 0;
}

.markdown p {
  margin: 0 0 0.8em;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 1em 0 0.45em;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-weight: 700;
  line-height: 1.25;
}

.markdown h1 {
  font-size: 1.4em;
}

.markdown h2 {
  font-size: 1.25em;
}

.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  font-size: 1.1em;
}

.markdown ul,
.markdown ol {
  margin: 0.5em 0 0.9em;
  padding-left: 1.5em;
}

.markdown li + li {
  margin-top: 0.25em;
}

.markdown a {
  color: var(--forest);
  text-decoration-color: var(--terracotta);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.markdown a:hover {
  color: var(--terracotta-dark);
}

.markdown code {
  padding: 0.12em 0.35em;
  border-radius: 3px;
  background: rgba(36, 73, 54, 0.09);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.markdown pre {
  margin: 0.7em 0;
  padding: 14px;
  overflow-x: auto;
  border-radius: 4px;
  color: var(--cream);
  background: var(--forest);
  white-space: pre;
}

.markdown pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.markdown blockquote {
  margin: 0.7em 0;
  padding-left: 13px;
  border-left: 3px solid var(--terracotta);
  color: var(--muted);
}

.markdown hr {
  margin: 1em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.markdown table {
  width: 100%;
  margin: 0.7em 0;
  border-collapse: collapse;
  font-size: 0.92em;
}

.markdown th,
.markdown td {
  padding: 7px 9px;
  border: 1px solid var(--border);
  text-align: left;
}

.markdown th {
  color: var(--forest);
  background: rgba(36, 73, 54, 0.08);
}

.pending .bubble:empty::after {
  content: "Thinking…";
  color: var(--muted);
}

.error .bubble {
  color: var(--terracotta-dark);
  border-color: rgba(198, 106, 69, 0.4);
  background: #fff7f2;
}

.composer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  width: 100%;
  padding: 9px 9px 9px 17px;
  border: 1px solid var(--forest);
  border-radius: 8px;
  background: var(--white);
}

.composer:focus-within {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

textarea {
  width: 100%;
  max-height: 160px;
  padding: 9px 0;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--charcoal);
  background: transparent;
  line-height: 1.45;
}

textarea::placeholder {
  color: var(--muted);
}

.composer button,
.login-form button {
  min-width: 76px;
  padding: 12px 18px;
  border: 1px solid var(--terracotta);
  border-radius: 3px;
  color: var(--white);
  background: var(--terracotta);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 160ms ease, border-color 160ms ease;
}

.composer button {
  border-radius: 8px;
}

.composer button:hover,
.login-form button:hover {
  border-color: var(--terracotta-dark);
  background: var(--terracotta-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.status {
  position: relative;
  z-index: 1;
  min-height: 16px;
  margin: -12px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.suggestion-chip,
.suggestion {
  border: 1px solid var(--forest);
  border-radius: 4px;
  color: var(--forest);
  background: var(--cream);
}

.suggestion-chip:hover,
.suggestion:hover,
.suggestion-chip[aria-pressed="true"],
.suggestion[aria-pressed="true"] {
  color: var(--cream);
  background: var(--forest);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  position: relative;
  width: min(460px, 100%);
  padding: 52px;
  border: 1px solid var(--forest);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 7px 7px 0 rgba(36, 73, 54, 0.12);
}

.login-card::before {
  position: absolute;
  inset: 7px;
  border: 1px solid var(--border);
  content: "";
  pointer-events: none;
}

.login-card h1 {
  margin: 8px 0 14px;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: clamp(48px, 9vw, 68px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.login-copy {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-form {
  position: relative;
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--forest);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 3px;
  outline: 0;
  color: var(--charcoal);
  background: var(--white);
}

.login-form input:focus {
  border-color: var(--forest);
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

.login-form button {
  margin-top: 7px;
  padding: 14px 16px;
}

.login-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--terracotta-dark);
  font-size: 13px;
}

/* ---------- Save the Date modal ---------- */

.std-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(44, 38, 32, 0.55);
  backdrop-filter: blur(3px);
}

.std-overlay.open {
  display: flex;
}

.std-modal {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 44px 38px 38px;
  border: 1px solid var(--forest);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 8px 8px 0 rgba(36, 73, 54, 0.12);
  animation: std-rise 0.35s ease;
}

@keyframes std-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.std-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--charcoal);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.std-close-btn:hover {
  background: rgba(44, 38, 32, 0.06);
  transform: rotate(90deg);
}

.std-modal-header {
  text-align: center;
  margin-bottom: 8px;
}

.std-branch-sm,
.std-branch {
  color: var(--terracotta);
}

.std-branch-sm {
  width: 74px;
  margin-bottom: 10px;
}

.std-modal h2 {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 34px;
  margin: 0 0 6px;
  color: var(--forest);
}

.std-modal .std-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 28px;
  line-height: 1.55;
}

.std-field-row {
  display: flex;
  gap: 14px;
}

.std-field-row .std-field {
  flex: 1;
}

.std-field {
  margin-bottom: 18px;
}

.std-modal label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.std-optional {
  text-transform: none;
  letter-spacing: 0;
}

.std-modal input[type="text"],
.std-modal input[type="email"],
.std-modal textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--charcoal);
  background: var(--cream);
}

.std-modal input:focus,
.std-modal textarea:focus {
  border-color: var(--forest);
  outline: 2px solid var(--forest);
  outline-offset: 2px;
  background: var(--white);
}

.std-modal textarea {
  resize: vertical;
  min-height: 66px;
}

.std-match-note {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--forest);
  font-size: 12px;
}

.std-match-note.show {
  display: flex;
}

.std-plus-one-fields {
  display: none;
  padding: 14px 0 4px 16px;
  margin-top: 4px;
  margin-left: 4px;
  border-top: 1px solid var(--border);
  border-left: 2px solid var(--border);
}

.std-plus-one-fields.show {
  display: block;
}

.std-section-title {
  margin: 0 0 14px;
  color: var(--forest);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.std-submit-btn {
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--forest);
  border-radius: 4px;
  color: var(--cream);
  background: var(--forest);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.std-submit-btn:hover {
  border-color: var(--terracotta-dark);
  background: var(--terracotta-dark);
}

.std-submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.std-error-text {
  display: none;
  margin-top: 10px;
  color: var(--terracotta-dark);
  font-size: 12px;
}

.std-error-text.show {
  display: block;
}

.std-success-view {
  display: none;
  text-align: center;
  padding: 20px 0;
}

.std-success-view.show {
  display: block;
}

.std-success-view .std-branch {
  width: 110px;
  margin: 0 auto 18px;
  display: block;
}

.std-success-view h2 {
  margin-bottom: 10px;
}

.std-success-view p {
  max-width: 340px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.std-close-secondary {
  margin-top: 26px;
  padding: 12px 28px;
  border: 1px solid var(--forest);
  border-radius: 4px;
  color: var(--forest);
  background: var(--cream);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.std-close-secondary:hover {
  color: var(--cream);
  background: var(--forest);
}

@media (prefers-reduced-motion: reduce) {
  .std-modal,
  .std-close-btn {
    animation: none;
    transition: none;
  }
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 28px, 1180px);
    padding-bottom: 28px;
  }

  .hero {
    min-height: 92svh;
    padding: 18px 0 46px;
  }

  .header-actions {
    gap: 6px;
  }

  .calendar-button,
  .save-date,
  .new-chat {
    padding: 8px 9px;
    font-size: 8px;
  }

  .hero-copy {
    padding-top: 76px;
  }

  .hero-copy > .eyebrow {
    margin-bottom: 18px;
  }

  .hero-title {
    font-size: clamp(58px, 20.5vw, 112px);
    line-height: 0.76;
  }

  .title-ampersand {
    margin-left: 40%;
  }

  .title-second {
    padding-right: 1%;
  }

  .wedding-details {
    margin-top: 42px;
    gap: 12px;
    font-size: 9px;
    letter-spacing: 0.11em;
  }

  .wedding-details span {
    width: 20px;
  }

  .hero-prompt {
    max-width: 290px;
    margin-right: auto;
    margin-left: auto;
    font-size: 14px;
  }

  .chat-section {
    min-height: 680px;
    padding: 34px 24px 26px;
    gap: 18px;
  }

  .chat-section::before {
    inset: 5px;
  }

  .bubble {
    max-width: 94%;
    padding: 16px;
  }

  .composer {
    padding-left: 13px;
  }

  .composer button {
    min-width: 64px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .login-card {
    padding: 40px 30px;
  }

  .std-modal {
    padding: 34px 22px 28px;
  }

  .std-field-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (max-width: 390px) {
  .calendar-button,
  .save-date,
  .new-chat {
    letter-spacing: 0.06em;
  }

  .hero-title {
    font-size: 19.8vw;
  }
}

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

body {
  min-height: 0;
}

.shell {
  width: min(1040px, calc(100% - 40px));
  height: 100vh;
  height: 100dvh;
  padding: 16px 0 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.hero {
  min-height: 0;
  display: block;
  padding: 0;
}

.invitation-header {
  gap: 16px;
}

.hero-copy {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 28px 0 4px;
}

.hero-copy > .eyebrow {
  margin: 0 0 18px;
  font-size: 15px;
  text-align: center;
}

.hero-title {
  font-size: clamp(46px, 7.2vw, 86px);
  line-height: 0.74;
}

.title-ampersand {
  margin: 0.02em 0 0.02em 47%;
}

.title-second {
  padding-right: 8%;
}

.title-first {
  padding-left: 8%;
}

.wedding-details {
  margin-top: 23px;
  gap: 14px;
  font-size: 14px;
}

.wedding-details span {
  width: 28px;
}

.hero-prompt {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-section {
  width: min(900px, 100%);
  min-height: 0;
  height: auto;
  margin: 0 auto;
  padding: 10px 0 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
}

.chat-section::before,
.chat-heading {
  display: none;
}

.messages {
  min-height: 0;
  padding: 4px 2px 8px;
}

.message {
  margin: 8px 0;
}

.bubble {
  padding: 16px;
  font-size: 13px;
  line-height: 1.55;
}

.composer {
  padding-top: 7px;
  padding-bottom: 7px;
}

textarea {
  padding: 7px 0;
}

.status {
  min-height: 14px;
  margin: -4px 4px 0;
  font-size: 11px;
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 24px, 1040px);
    padding: 12px 0 10px;
    gap: 8px;
  }

  .hero {
    min-height: 0;
    padding: 0;
  }

  .calendar-button,
  .save-date,
  .new-chat {
    padding: 7px 8px;
    font-size: 8px;
  }

  .hero-copy {
    padding: 6px 0 3px;
  }

  .hero-copy > .eyebrow {
    margin-bottom: 4px;
  }

  .hero-title {
    font-size: clamp(42px, 13.6vw, 58px);
    line-height: 0.75;
  }

  .title-first {
    padding-left: 4%;
  }

  .title-second {
    padding-right: 4%;
  }

  .wedding-details {
    margin-top: 10px;
    gap: 9px;
    font-size: 8px;
  }

  .wedding-details span {
    width: 16px;
  }

  .hero-prompt {
    max-width: none;
    margin: 5px 0 0;
    font-size: 12px;
  }

  .chat-section {
    min-height: 0;
    padding: 8px 0 0;
    gap: 6px;
  }

  .bubble {
    padding: 16px;
    font-size: 12px;
  }

  .composer {
    padding: 6px 6px 6px 12px;
  }

  .composer button {
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

@media (max-height: 650px) {
  .hero-copy > .eyebrow {
    display: none;
  }

  .hero-title {
    font-size: clamp(40px, 6.5vw, 62px);
  }

  .wedding-details {
    margin-top: 8px;
  }

  .hero-prompt {
    margin-top: 3px;
  }
}

.hero-title {
  font-size: clamp(24px, 6vw, 62px);
  line-height: 0.9;
  text-align: center;
  white-space: nowrap;
}

.hero-title span {
  display: inline;
}

.title-first,
.title-second {
  padding: 0;
}

.title-ampersand {
  margin: 0;
  font-size: 1em;
  line-height: inherit;
}
