/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps.
 */

/* ─── Kindredhearth theme ────────────────────────────────────────────────────
 *
 * "Digital Keepsake" aesthetic: warm, soft, family-focused, intimate.
 * Colours converted from the brand palette hex values to oklch (DaisyUI v5).
 *
 * Primary  – #F08080  Light Coral  (main brand)
 * Secondary – #9e4143  Deep Rose   (headers / accents)
 * Accent   – #4DB6AC  Soft Teal   (milestones / badges)
 * Neutral  – #303330  Warm Charcoal (body text)
 * Base     – #faf9f6  Cream       (page background)
 * ─────────────────────────────────────────────────────────────────────────── */

[data-theme="kindredhearth"] {
  color-scheme: light;

  --color-primary:           oklch(72% 0.13 19);
  --color-primary-content:   oklch(100% 0 0);
  --color-secondary:         oklch(42% 0.12 18);
  --color-secondary-content: oklch(100% 0 0);
  --color-accent:            oklch(70% 0.08 184);
  --color-accent-content:    oklch(100% 0 0);
  --color-neutral:           oklch(23% 0.01 140);
  --color-neutral-content:   oklch(100% 0 0);

  --color-base-100:          oklch(98% 0.005 95);
  --color-base-200:          oklch(94% 0.004 95);
  --color-base-300:          oklch(89% 0.005 95);
  --color-base-content:      oklch(23% 0.01 140);

  --color-info:              oklch(74% 0.10 234);
  --color-info-content:      oklch(100% 0 0);
  --color-success:           oklch(76% 0.10 148);
  --color-success-content:   oklch(100% 0 0);
  --color-warning:           oklch(88% 0.14 86);
  --color-warning-content:   oklch(20% 0.05 86);
  --color-error:             oklch(68% 0.13 19);
  --color-error-content:     oklch(100% 0 0);

  /* Shape */
  --radius-box:      1.5rem;    /* cards, modals, alerts */
  --radius-selector: 9999px;   /* buttons — full pill */
  --radius-field:    0.5rem;   /* inputs, textareas */
  --radius-badge:    9999px;
}

/* button_to inside a daisyUI menu: the menu styles the <form> as the item
   (padding + hover colour), leaving its padding unclickable. Move the padding
   onto the button so the whole highlighted row is clickable. */
.menu li > form {
  display: block;
  padding: 0;
}
.menu li > form > button {
  width: 100%;
  padding-block: 0.375rem;
  padding-inline: 0.75rem;
  border-radius: inherit;
  cursor: pointer;
}

/* Wish areas on a letter photo (shared page). Hidden until the letter is
   hovered so the letter itself stays in focus. Touch screens can't hover, so
   they get a short hint when the page opens instead. */
.letter-area {
  border: 2px solid transparent;
  border-radius: 0.5rem;
  transition: border-color 0.2s, background-color 0.2s;
}
.letter-area:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}
@media (hover: hover) {
  .letter-photo:hover .letter-area {
    border-color: color-mix(in oklch, var(--color-primary) 35%, transparent);
  }
  .letter-photo .letter-area:hover {
    border-color: var(--color-primary);
    background-color: color-mix(in oklch, var(--color-primary) 15%, transparent);
  }
}
@media (hover: none) {
  .letter-area {
    animation: letter-area-hint 2.5s ease-out 0.6s backwards;
  }
  .letter-area:active {
    background-color: color-mix(in oklch, var(--color-primary) 15%, transparent);
  }
}
@keyframes letter-area-hint {
  0%, 50% {
    border-color: var(--color-primary);
    background-color: color-mix(in oklch, var(--color-primary) 12%, transparent);
  }
  100% {
    border-color: transparent;
    background-color: transparent;
  }
}

/* Toasts (shared/_flash): bottom centre on phones, bottom right on wider
   screens. --bottom-nav-space keeps them above the phone tab bar. */
.toast-stack {
  position: fixed;
  z-index: 60;
  left: 1rem;
  right: 1rem;
  bottom: calc(var(--bottom-nav-space, 0px) + 1rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}
@media (min-width: 640px) {
  .toast-stack { left: auto; align-items: flex-end; }
}
.toast-message {
  pointer-events: auto;
  width: 100%;
  max-width: 24rem;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.2s, transform 0.2s;
}
.toast-message.toast-leaving {
  opacity: 0;
  transform: translateY(0.5rem);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
}
@media (prefers-reduced-motion: reduce) {
  .toast-message { animation: none; transition: none; }
}

/* Phone tab bar (shared/_bottom_nav): keep page content and toasts clear of
   it, including the iPhone home indicator area. */
.has-bottom-nav {
  --bottom-nav-space: calc(4rem + env(safe-area-inset-bottom, 0px));
  padding-bottom: var(--bottom-nav-space);
}
.has-bottom-nav .dock {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: var(--bottom-nav-space);
}
@media (min-width: 640px) {
  .has-bottom-nav { --bottom-nav-space: 0px; }
}

/* While Turbo submits a form it marks it aria-busy and disables the button
   (which also stops double taps). Show a small spinner on that button so a
   slow connection doesn't look like nothing happened. */
form[aria-busy="true"] :is(button, input[type="submit"]):disabled {
  cursor: progress;
}
form[aria-busy="true"] button:disabled::after {
  content: "";
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.4em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  form[aria-busy="true"] button:disabled::after { animation-duration: 2s; }
}
