@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600&display=swap");

:root {
  color-scheme: light;
  --ink: #292a25;
  --muted: #77766f;
  --paper: #f8f4ec;
  --card: #fffdf8;
  --line: #e8e1d6;
  --olive: #687453;
  --olive-dark: #4e5b3e;
  --peach: #f0dfd2;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 9% 2%, rgb(240 223 210 / 44%), transparent 29rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #a47752;
  outline-offset: 3px;
}

.page {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
  padding: 34px 0 24px;
}

.intro {
  padding: 10px 0 32px;
  text-align: center;
}

.brand-mark,
.footer-flower {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid #d5c7b2;
  border-radius: 50%;
  color: var(--olive);
  font-size: 22px;
}

.eyebrow,
.step-label {
  color: var(--olive-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 10px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 9vw, 3.45rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.intro-copy,
.section-hint {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.intro-copy {
  max-width: 370px;
  margin: 0 auto;
}

.check-in,
.gift-section {
  margin: 0 auto;
}

.step-label {
  margin-bottom: 9px;
}

.step-label span {
  padding: 0 4px;
  color: #b6a48b;
}

h2 {
  margin-bottom: 7px;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 6vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.section-hint {
  margin-bottom: 17px;
  font-size: 0.88rem;
}

.mood-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.mood-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 253 248 / 74%);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.mood-button:hover {
  transform: translateY(-1px);
  border-color: #c9cbb9;
}

.mood-button[aria-pressed="true"] {
  border-color: var(--olive);
  background: #e9ebdf;
  color: var(--olive-dark);
}

.mood-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 10px;
  background: #f2ebe1;
  color: var(--olive-dark);
  font-size: 1.1rem;
}

.mood-button[aria-pressed="true"] .mood-icon {
  background: #dce1ce;
}

.mood-button-wide {
  grid-column: 1 / -1;
}

.gift-section {
  margin-top: 30px;
}

.gift-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: min(100%, 360px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f0ebe2;
}

.gift-option {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.gift-option span {
  margin-right: 5px;
}

.gift-option.is-selected {
  background: var(--card);
  box-shadow: 0 2px 8px rgb(52 43 32 / 8%);
  color: var(--olive-dark);
}

.saved-toggle {
  display: block;
  margin: 11px 0 0 auto;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--olive-dark);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.saved-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.favorites-panel {
  margin-top: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 253 248 / 82%);
  box-shadow: 0 8px 24px rgb(69 59 44 / 5%);
}

.favorites-panel[hidden],
.favorites-empty[hidden],
.favorite-image[hidden],
.favorite-image-fallback[hidden],
.favorite-action[hidden] {
  display: none;
}

.favorites-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.favorites-heading .step-label {
  margin-bottom: 4px;
  font-size: 0.64rem;
}

.favorites-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
}

.panel-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.favorites-empty {
  margin: 0;
  padding: 14px 5px 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  text-align: center;
}

.favorites-list {
  display: grid;
  gap: 10px;
}

.favorite-card {
  padding: 13px;
  border: 1px solid #eee7dc;
  border-radius: 14px;
  background: #fffefa;
}

.favorite-mood {
  margin: 0 0 8px;
  color: var(--olive-dark);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.favorite-quote {
  margin: 0 0 9px;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.5;
}

.favorite-source {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.favorite-image {
  display: block;
  width: 100%;
  max-height: 230px;
  border-radius: 10px;
  background: #f0ebe2;
  object-fit: cover;
}

.favorite-image-fallback {
  margin: 0;
  padding: 20px 14px;
  border: 1px dashed #d8cbb8;
  border-radius: 10px;
  background: #f6f1e8;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
}

.favorite-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.favorite-action,
.favorite-remove {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--olive-dark);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
}

.favorite-action:hover,
.favorite-remove:hover {
  background: #f5f0e7;
}

.favorite-remove {
  margin-left: auto;
  color: var(--muted);
}

.result-section {
  margin-top: 19px;
}

.status-message {
  min-height: 24px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  text-align: center;
}

.status-message.is-error {
  color: #9b4138;
}

.result-card {
  overflow: hidden;
  padding: 14px;
  border: 1px solid #ece5da;
  border-radius: 21px;
  background: var(--card);
  box-shadow: 0 12px 35px rgb(69 59 44 / 7%);
}

.result-card[hidden] {
  display: none;
}

.card-content {
  animation: card-enter 360ms cubic-bezier(0.2, 0.75, 0.3, 1) both;
}

.palanquita-image {
  display: block;
  width: 100%;
  max-height: min(58vh, 470px);
  min-height: 190px;
  border-radius: 13px;
  background: #f0ebe2;
  object-fit: cover;
}

.palanquita-image[hidden] {
  display: none;
}

.image-fallback {
  display: grid;
  min-height: 245px;
  place-content: center;
  gap: 9px;
  padding: 25px;
  border: 1px dashed #d8cbb8;
  border-radius: 13px;
  background:
    radial-gradient(ellipse at 20% 20%, rgb(240 223 210 / 60%), transparent 55%),
    #f6f1e8;
  color: var(--olive-dark);
  text-align: center;
}

.image-fallback[hidden] {
  display: none;
}

.fallback-icon {
  font-size: 2rem;
}

.image-fallback strong {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
}

.image-fallback span:last-child {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.quote-content {
  display: grid;
  min-height: 235px;
  align-content: center;
  padding: 28px 17px;
  background:
    radial-gradient(ellipse at 95% 0%, rgb(240 223 210 / 45%), transparent 60%),
    #fbf8f1;
  text-align: center;
}

.quote-mark {
  margin-bottom: 9px;
  color: #9d9c7d;
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 0.8;
}

.quote-text {
  margin: 0 auto 17px;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 5.3vw, 1.8rem);
  font-weight: 500;
  line-height: 1.48;
}

.quote-source {
  margin: 0;
  color: var(--olive-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding-top: 13px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--olive);
  color: white;
}

.button-primary:hover {
  background: var(--olive-dark);
}

.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
  pointer-events: none;
}

.button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button-secondary:hover {
  background: #f5f0e7;
}

.button-favorite {
  border-color: #e8d9d0;
  background: #fbf3ee;
  color: #875b4e;
}

.button-favorite:hover,
.button-favorite.is-favorite {
  background: #f3e5de;
  color: #8a403b;
}

.button[hidden] {
  display: none;
}

.intentions-section {
  margin-top: 48px;
  padding: 23px 17px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgb(255 253 248 / 74%);
}

.intentions-section h2 {
  margin-bottom: 6px;
}

.intentions-intro {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.intentions-privacy {
  margin: -12px 0 16px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.intention-form {
  display: grid;
  gap: 8px;
}

.form-label {
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.form-label span {
  color: var(--muted);
  font-weight: 400;
}

.form-input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffefa;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}

.form-input::placeholder {
  color: #a19b91;
}

.form-input:focus {
  border-color: #9da586;
  outline: 3px solid rgb(104 116 83 / 14%);
}

.intention-textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
}

.character-count {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.intention-submit {
  min-height: 42px;
  padding: 9px 14px;
}

.intention-submit:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.intentions-feed-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 27px;
}

.intentions-feed-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
}

.retry-intentions {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--olive-dark);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
}

.retry-intentions[hidden] {
  display: none;
}

.intentions-status {
  margin: 9px 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.intentions-status.is-error {
  color: #9b4138;
}

.intentions-list {
  display: grid;
  gap: 10px;
}

.intention-card {
  padding: 14px;
  border: 1px solid #eee7dc;
  border-radius: 14px;
  background: #fffefa;
}

.intention-message {
  margin: 0 0 12px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.intention-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  margin-bottom: 12px;
}

.intention-author {
  color: var(--olive-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.intention-date {
  color: var(--muted);
  font-size: 0.74rem;
}

.support-button {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #e8d9d0;
  border-radius: 10px;
  background: #fbf3ee;
  color: #875b4e;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: background-color 160ms ease;
}

.support-button:hover:not(:disabled) {
  background: #f3e5de;
}

.support-button:disabled {
  cursor: default;
  border-color: #e4e6d9;
  background: #eef0e7;
  color: var(--olive-dark);
}

@media (max-width: 380px) {
  .card-actions {
    gap: 6px;
  }

  .card-actions .button {
    padding-right: 5px;
    padding-left: 5px;
    font-size: 0.75rem;
  }

  .intentions-section {
    padding: 19px 13px;
  }
}

.footer {
  padding-top: 35px;
  color: var(--muted);
  text-align: center;
}

.footer-flower {
  width: 28px;
  height: 28px;
  margin-bottom: 9px;
  border: 0;
  font-size: 17px;
}

.footer p {
  margin-bottom: 0;
  font-size: 0.8rem;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 600px) {
  .page {
    padding-top: 52px;
  }

  .intro {
    padding-bottom: 43px;
  }

  .mood-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mood-button-wide {
    grid-column: auto / span 2;
  }

  .gift-section {
    margin-top: 38px;
  }

  .result-section {
    margin-top: 23px;
  }

  .result-card {
    padding: 18px;
  }
}

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