/* Jhazi — soft, romantic look. Phone first, then laptop. */

:root {
  /* Colours */
  --blush: #f6dde2;
  --blush-soft: #fbeef0;
  --rose: #c76b82;        /* buttons, active menu item */
  --rose-dark: #a24d66;   /* button hover, readable on cream */
  --cream: #fffaf6;
  --white: #ffffff;
  --gold: #c9a45c;        /* decoration only */
  --gold-text: #8a6a2c;   /* gold that is dark enough to read */
  --ink: #4a363d;         /* main text: dark plum, not harsh black */
  --ink-soft: #7a6168;    /* secondary text */
  --line: #ecd6da;

  /* Shape and spacing */
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 20px rgba(162, 77, 102, 0.10);
  --gutter: 16px;
  --nav-h: 68px;

  /* Fonts */
  --font-title: "Amiri", "Times New Roman", serif;
  --font-body: "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--cream);
  background-image: radial-gradient(circle at 100% 0%, var(--blush-soft) 0, transparent 45%),
                    radial-gradient(circle at 0% 100%, var(--blush-soft) 0, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}

a { color: inherit; }

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Rose decoration in the corners (very light, behind everything) */
.roses { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.rose { position: absolute; width: 150px; opacity: 0.3; }
.rose--top { top: 40px; left: -70px; transform: rotate(160deg); opacity: 0.22; }
.rose--bottom { bottom: calc(var(--nav-h) - 10px); right: -40px; transform: rotate(-20deg); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--gutter);
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(255, 250, 246, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.brand__name {
  font-family: var(--font-title);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--rose-dark);
}
.brand__heart { color: var(--gold); font-size: 20px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--ink-soft);
  text-decoration: none;
}
.icon-btn:hover, .icon-btn.is-active { background: var(--blush); color: var(--rose-dark); }

/* Bottom menu (phone) */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--white);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(162, 77, 102, 0.06);
}
.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  min-width: 0;
}
.nav a span { white-space: nowrap; }
.nav a.is-active { color: var(--rose-dark); font-weight: 700; }
.nav__plus {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-top: -22px;
  border-radius: 50%;
  background: var(--rose);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(162, 77, 102, 0.35);
  border: 3px solid var(--white);
}
.nav__plus svg { stroke-width: 2.4; }
.nav__add.is-active .nav__plus { background: var(--rose-dark); }

/* Page content */
.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px var(--gutter);
  outline: none;
}

.screen__title {
  margin: 0 0 4px;
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}
.screen__lead { margin: 0 0 20px; color: var(--ink-soft); }

/* Empty message */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 32px 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty__art { width: 96px; opacity: 0.85; }
.empty__text { margin: 0; font-size: 19px; font-weight: 500; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn--primary { background: var(--rose-dark); color: var(--white); }
.btn--primary:hover { background: #8c3f56; }

/* "Where is it from?" choices on the add screen */
.choices { display: grid; gap: 12px; }
.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 14px 18px;
  text-align: right;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.choice:hover { border-color: var(--rose); }
.choice__icon { grid-row: 1 / 3; font-size: 30px; }
.choice__name { font-weight: 700; font-size: 18px; }
.choice__hint { font-size: 14px; color: var(--ink-soft); }

.notice {
  margin: 16px 0 0;
  padding: 12px 16px;
  text-align: center;
  background: var(--blush);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* Settings list */
.settings-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.settings-list li:last-child { border-bottom: 0; }
.muted { color: var(--ink-soft); font-size: 15px; }

/* ---------- Door (sign-in) ---------- */
/* Until the owner is signed in, only the door is visible. */
body:not([data-state="ready"]) .topbar,
body:not([data-state="ready"]) .nav,
body:not([data-state="ready"]) .page { display: none; }
body:not([data-state="ready"]) { padding-bottom: 0; }
body[data-state="ready"] .gate { display: none; }

.gate {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter);
}
.gate__card {
  width: 100%;
  max-width: 400px;
  padding: 36px 24px;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.gate__art { width: 110px; }
.gate__brand {
  margin: 4px 0 8px;
  font-family: var(--font-title);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--rose-dark);
}
.gate__part { display: none; }
body[data-state="loading"] [data-gate="loading"],
body[data-state="signed-out"] [data-gate="signed-out"],
body[data-state="denied"] [data-gate="denied"],
body[data-state="offline"] [data-gate="offline"],
body[data-state="error"] [data-gate="error"],
body[data-state="not-configured"] [data-gate="not-configured"] { display: block; }
.gate__text { margin: 0 0 20px; font-size: 18px; }
.gate__text--warn { color: var(--rose-dark); font-weight: 700; }

.btn--google {
  gap: 12px;
  width: 100%;
  background: var(--white);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(74, 54, 61, 0.08);
}
.btn--google:hover { border-color: var(--rose); }
.btn--google .g-logo { width: 22px; height: 22px; stroke: none; }
.btn[disabled] { opacity: 0.6; cursor: wait; }

.btn--outline {
  background: transparent;
  color: var(--rose-dark);
  border: 1.5px solid var(--rose);
}
.btn--outline:hover { background: var(--blush-soft); }

.account {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  text-align: center;
}
.account p { margin: 0; }
.account bdi { direction: ltr; unicode-bidi: isolate; }

/* Laptop: menu moves to the top, under the brand */
@media (min-width: 768px) {
  body { padding-bottom: 32px; }

  .nav {
    position: sticky;
    top: 67px;
    bottom: auto;
    height: auto;
    padding: 6px var(--gutter);
    display: flex;
    justify-content: center;
    gap: 6px;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.92);
  }
  .nav a {
    flex-direction: row;
    gap: 8px;
    padding: 8px 16px;
    font-size: 16px;
    border-radius: 999px;
  }
  .nav a.is-active { background: var(--blush); }
  .nav__plus {
    width: 30px;
    height: 30px;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
  .nav__plus svg { width: 18px; height: 18px; }

  .page { padding-top: 32px; }
  .screen__title { font-size: 34px; }
  .choices { grid-template-columns: repeat(3, 1fr); }
  .rose { width: 220px; }
  .rose--bottom { bottom: -20px; }
}

/* ---------- Motion ---------- */
/* Entrances (screens, door, roses) are animated by GSAP in js/motion.js.
   Here: only the small hover and press effects, which CSS does best. */

/* Colour changes fade gently for everyone. */
.btn, .choice, .icon-btn, .nav a, .nav__plus, .brand__heart {
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease,
              box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Movement only for people who haven't asked their phone to reduce motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Pressing anything gives a small "squeeze". */
  .btn:active:not([disabled]), .choice:active, .icon-btn:active { transform: scale(0.97); }
  .nav a svg { transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .nav a:active svg { transform: scale(0.9); }
  .nav a.is-active svg { transform: translateY(-1px) scale(1.08); }
  .nav a.nav__add.is-active svg { transform: none; }
}

/* Hover effects: only on devices with a mouse, so they don't "stick" on phones. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .btn:hover:not([disabled]) {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(162, 77, 102, 0.22);
  }
  .btn--google:hover { box-shadow: 0 8px 18px rgba(74, 54, 61, 0.12); }
  .choice:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(162, 77, 102, 0.16);
  }
  .icon-btn svg { transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .icon-btn:hover svg { transform: rotate(30deg); }
  .nav a:hover { color: var(--rose-dark); }
  .nav a:hover svg { transform: translateY(-2px); }
  .nav__add:hover .nav__plus { transform: scale(1.06); box-shadow: 0 6px 16px rgba(162, 77, 102, 0.4); }
  .nav a.nav__add:hover svg { transform: rotate(90deg); }
  .brand:hover .brand__heart { transform: scale(1.2); }
  /* Keep the press "squeeze" working on top of the hover lift. */
  .btn:active:not([disabled]) { transform: scale(0.97); }
  .choice:active { transform: translateY(-1px) scale(0.98); }
}

@media (min-width: 768px) and (hover: hover) {
  .nav a:not(.is-active):hover { background: var(--blush-soft); }
}
