/* The Windowsill — rosewater keepsake. See DESIGN.md. */

@font-face {
  font-family: 'Young Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/young-serif-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('fonts/figtree-latin.woff2') format('woff2');
}

:root {
  --bg: #F6E7EB;
  --bg-deep: #EFD3DC;
  --card: #FDF8F9;
  --ink: #3E2430;
  --ink-soft: #815C6B;
  --rose: #B4526F;
  --rose-deep: #A84A67;
  --water: #7396B4;
  --water-deep: #4E6D89;
  --leaf: #7FA98B;
  --leaf-deep: #5E8A6C;
  --danger: #B03D4D;
  --r-card: 24px;
  --shadow: 0 10px 24px -10px rgba(62, 36, 48, 0.25);
  --shadow-soft: 0 6px 14px -8px rgba(62, 36, 48, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Figtree', system-ui, sans-serif;
  font-weight: 400;
  min-height: 100dvh;
  padding: 0 18px calc(30px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* ------------------------------------------------ hero */

.hero {
  padding: calc(26px + env(safe-area-inset-top)) 4px 22px;
  text-align: center;
}

.hero-greeting {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.hero-title {
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 8vw, 2.4rem);
  line-height: 1.08;
  margin-top: 6px;
}

.hero-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 1px;
  background: var(--rose);
  opacity: 0.5;
  margin: 14px auto 0;
}

.hero-mood {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ------------------------------------------------ section labels */

.rail-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: 1.15rem;
  margin: 28px 4px 14px;
}

.rail-label .count {
  font-family: 'Figtree', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 10px;
  box-shadow: var(--shadow-soft);
}

/* ------------------------------------------------ thirsty cards */

.thirsty-card {
  background: var(--card);
  border: 1px solid var(--bg-deep);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 18px;
}

.thirsty-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-deep);
}

/* the first (thirstiest) plant is the largest; the rest sit back a little */
.thirsty-card.is-rest .thirsty-photo { aspect-ratio: 16 / 10; }

.thirsty-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mood-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: var(--shadow-soft);
}

.mood-chip.is-due { color: var(--water-deep); }
.mood-chip.is-thirsty { color: var(--rose-deep); }
.mood-chip.is-dying { color: var(--danger); }

.thirsty-body { padding: 18px 20px 20px; }

.plant-name {
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.12;
}

.plant-sub {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 3px;
}

.speech {
  margin-top: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--bg-deep);
  font-family: 'Young Serif', serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
}

.care-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 14px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-weight: 500;
}

.care-line .drop { flex-shrink: 0; color: var(--water-deep); }

.water-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  border: none;
  border-radius: 999px;
  background: var(--rose);
  color: #FDF8F9;
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(168, 74, 103, 0.6);
  transition: transform 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}

.water-btn:active { transform: scale(0.97); background: var(--rose-deep); }
.water-btn[disabled] { opacity: 0.55; }

/* ------------------------------------------------ happy garden */

.garden {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.garden-card {
  background: var(--card);
  border: 1px solid var(--bg-deep);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.garden-photo {
  aspect-ratio: 1 / 1;
  background: var(--bg-deep);
}

.garden-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.garden-body { padding: 12px 14px 14px; }

.garden-name {
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.2;
}

.garden-next {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.45;
}

.garden-when {
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--ink-soft);
  opacity: 0.8;
}

/* all-happy state */
.all-happy {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--bg-deep);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  padding: 30px 22px;
  margin-top: 4px;
}

.all-happy svg, .splash-drop svg {
  width: 34px;
  height: 44px;
  display: inline-block;
}

.all-happy p {
  margin-top: 10px;
  font-family: 'Young Serif', serif;
  font-size: 1.1rem;
}

.all-happy span {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ------------------------------------------------ footer */

.footer {
  margin-top: 42px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.6;
}

.add-plant-btn {
  display: block;
  width: 100%;
  padding: 15px;
  border: 1px dashed var(--rose);
  border-radius: 999px;
  background: none;
  color: var(--rose);
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease;
  touch-action: manipulation;
}

.add-plant-btn:active { transform: scale(0.97); }

.linkish {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-family: 'Figtree', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: underline;
  margin-top: 4px;
  padding: 12px;
  min-height: 44px;
  cursor: pointer;
}

/* ------------------------------------------------ add-plant sheet */

.days-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.days-row input { width: 90px; text-align: center; }

.days-row span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.photo-btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 1px dashed var(--bg-deep);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.photo-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  margin-top: 10px;
}

/* ------------------------------------------------ plant detail sheet */

.plant-sheet-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 14px;
}

.plant-sheet-meta {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 4px;
}

.remove-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--bg-deep);
  border-radius: 999px;
  background: none;
  color: var(--danger);
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  touch-action: manipulation;
}

.remove-btn.confirm {
  background: var(--danger);
  border-color: var(--danger);
  color: #FDF8F9;
}

.keep-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

/* custom plants without a photo */
.photo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  font-family: 'Young Serif', serif;
  font-size: 2.2rem;
  color: var(--ink-soft);
}

/* ------------------------------------------------ watering confirmation */

.splash {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(246, 231, 235, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  text-align: center;
  padding: 30px;
}

.splash.show { display: flex; animation: splash-fade 0.35s ease-out; }

@keyframes splash-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.splash-drop {
  animation: drop-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drop-in {
  from { transform: translateY(-24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.splash-msg {
  margin-top: 16px;
  font-family: 'Young Serif', serif;
  font-size: 1.25rem;
  line-height: 1.4;
  max-width: 26ch;
  animation: pop-in 0.4s 0.15s ease-out both;
}

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

/* ------------------------------------------------ setup sheet */

.sheet-backdrop[hidden] { display: none; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(62, 36, 48, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 28px 22px calc(30px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 520px;
  max-height: 86dvh;
  overflow-y: auto;
  box-shadow: 0 -12px 40px -12px rgba(62, 36, 48, 0.4);
}

.sheet h2 {
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.sheet p {
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 12px;
  font-weight: 500;
}

.sheet p.hint { color: var(--ink-soft); font-size: 0.82rem; }

.sheet label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 16px 0 6px;
}

.sheet input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--bg-deep);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Figtree', sans-serif;
  font-weight: 500;
  font-size: 1rem;
}

.sheet input:focus { outline: none; border-color: var(--rose); }

.sheet .water-btn { margin-top: 20px; }

.sheet .status-line {
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.sheet .status-line.ok { color: var(--leaf-deep); }
.sheet .status-line.err { color: var(--danger); }

.step-done {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--leaf-deep);
}

@media (prefers-reduced-motion: reduce) {
  .splash.show, .splash-drop, .splash-msg { animation: none; }
}
