:root {
  --text: #f5f5f7;
  --muted: #a6a6b3;
  --glass-stroke: rgba(255, 255, 255, 0.14);
  --accent: #7aa2ff;
  --accent-2: #c08cff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont,
    "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #07070b;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Hide text content until JS has loaded the real values, so no placeholder
   text flashes through on load. Revealed by body.loaded (set in app.js, with
   an inline failsafe timeout). */
.brand, .hero-content { opacity: 0; transition: opacity 0.4s var(--ease); }
body.loaded .brand, body.loaded .hero-content { opacity: 1; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* fallback gradient when no background image is set */
  background: radial-gradient(125% 125% at 50% -10%, #1a1c28 0%, #0b0b11 58%, #050507 100%);
}

.hero-bg { position: absolute; inset: 0; }

/* carousel slides cross-fade */
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.hero-slide.active { opacity: 1; }

.hero-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom,
      rgba(0, 0, 0, 0.55) 0%,
      rgba(0, 0, 0, 0.18) 28%,
      rgba(0, 0, 0, 0.30) 60%,
      rgba(0, 0, 0, 0.85) 100%);
}

/* ---------------- Top bar ---------------- */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.7rem) clamp(1.1rem, 3.5vw, 2.4rem);
  padding-top: max(clamp(1rem, 2.5vw, 1.7rem), env(safe-area-inset-top));
}

.brand {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 2.3vw, 1.4rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  opacity: 1;
  white-space: nowrap;
  -webkit-text-stroke: 0.7px #fff; /* extra weight beyond Space Grotesk's 700 */
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.top-actions { display: flex; align-items: center; gap: 0.7rem; flex: 0 0 auto; }

.enquire-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.2s var(--ease), transform 0.15s var(--ease);
}
.enquire-btn:hover { opacity: 0.7; }
.enquire-btn:active { transform: scale(0.95); }
.enquire-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---------------- Hero content (bottom-left) ---------------- */
.hero-content {
  position: relative;
  z-index: 3;
  margin-top: auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1.2rem, 4.5vw, 3.6rem);
  padding-bottom: max(clamp(2rem, 6vw, 4rem), calc(env(safe-area-inset-bottom) + 1.5rem));
  max-width: 920px;
}

.hero-role {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 500;
  color: #fff;
  opacity: 0.88;
  margin: 0 0 0.85rem;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.5);
}

.hero-bio {
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  max-width: 54ch;
  margin: 0 0 1.5rem;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5);
}

/* ---------------- Link pills ---------------- */
.links { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: flex-start; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.18s var(--ease), background 0.2s var(--ease);
}
.pill:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.22); }
.pill-icon { display: inline-flex; width: 16px; height: 16px; opacity: 0.9; }
.pill-icon svg { width: 100%; height: 100%; fill: currentColor; }
body.editing .pill { cursor: pointer; border-style: dashed; }
body.editing .pill::after { content: "✎"; font-size: 0.8rem; opacity: 0.7; margin-left: 0.1rem; }

/* ---------------- Editing state ---------------- */
[contenteditable="true"] { outline: none; border-radius: 10px; transition: box-shadow 0.2s, background 0.2s; }
body.editing [contenteditable="true"] {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.05em 0.3em;
  cursor: text;
}
body.editing [contenteditable="true"]:focus { box-shadow: 0 0 0 2px var(--accent); background: rgba(0, 0, 0, 0.4); }

/* ---------------- Glass + modals ---------------- */
.glass {
  background: rgba(20, 20, 28, 0.72);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-stroke);
}

.modal {
  border: 1px solid var(--glass-stroke);
  border-radius: 22px;
  padding: 0;
  color: var(--text);
  width: min(400px, 92vw);
  background: rgba(20, 20, 28, 0.86);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* See-through frosted "Get in touch" panel — blur only, no rim, no sheen */
#enquire-modal {
  border-radius: 28px;
  background: rgba(28, 30, 38, 0.16);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  backdrop-filter: blur(48px) saturate(180%);
  border: none;
  box-shadow: none;
}
#enquire-modal::backdrop {
  background: rgba(0, 0, 0, 0.15);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
#enquire-modal input, #enquire-modal textarea {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}
.modal form, .modal-body { padding: 1.75rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal h2 { margin: 0; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.02em; }
.modal-sub { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.modal input, .modal textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
}
.modal input:focus, .modal textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }

.error { color: #ff8585; font-size: 0.85rem; margin: 0; }
.field-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-top: 0.35rem; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.5rem; }
.modal-actions.spread { justify-content: flex-start; align-items: center; }
.modal-actions .spacer { flex: 1; }

/* ---------------- Buttons ---------------- */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), filter 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #0a0a12; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); border-color: var(--glass-stroke); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.15); }
.btn.ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.danger { background: rgba(255, 80, 80, 0.18); color: #ff9b9b; border-color: rgba(255, 80, 80, 0.35); }
.btn.danger:hover { background: rgba(255, 80, 80, 0.28); }
.btn.full { width: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 0.4rem; }
.btn.small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.key-glyph { font-size: 1rem; }

.divider { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0.25rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--glass-stroke); }
.divider span { padding: 0 0.75rem; }

/* ---------------- Contact form ---------------- */
.contact-form { display: flex; flex-direction: column; gap: 0.7rem; }
.contact-form textarea { resize: vertical; }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-status { font-size: 0.88rem; margin: 0.1rem 0 0; color: var(--muted); }
.form-status.ok { color: #5fd08a; }
.form-status.err { color: #ff8585; }

/* ---------------- Passkey list ---------------- */
.passkey-list { list-style: none; margin: 0.25rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.passkey-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.7rem 0.9rem; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-stroke); font-size: 0.9rem;
}
.passkey-empty { color: var(--muted); font-size: 0.9rem; padding: 0.5rem 0; }

/* ---------------- Discreet login key (top bar) ---------------- */
.key-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  opacity: 0.5;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity 0.2s, background 0.2s;
}
.key-btn:hover, .key-btn:focus-visible { opacity: 1; background: rgba(255, 255, 255, 0.15); outline: none; }
.key-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.editing .key-btn { display: none; }

/* ---------------- Floating edit pill (Instagram-style) ----------------
   Visible ONLY while body.editing — only set after authentication. */
.navpill {
  position: fixed;
  bottom: max(1.4rem, env(safe-area-inset-bottom));
  left: 0; right: 0;
  margin-inline: auto;
  width: max-content;
  max-width: 94vw;
  display: none;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem;
  border-radius: 999px;
  z-index: 50;
  background: rgba(18, 19, 24, 0.62);
  -webkit-backdrop-filter: blur(38px) saturate(180%);
  backdrop-filter: blur(38px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
body.editing .navpill { display: flex; animation: pillUp 0.4s var(--ease) both; }
@keyframes pillUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.navbtn {
  width: 54px; height: 46px;
  display: grid; place-items: center;
  border: none; background: transparent; color: #f5f5f7;
  border-radius: 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s var(--ease), transform 0.1s var(--ease);
}
.navbtn:hover, .navbtn:focus-visible { background: rgba(255, 255, 255, 0.13); outline: none; }
.navbtn:active { transform: scale(0.9); }
.navbtn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.navbtn.save { background: linear-gradient(135deg, rgba(122, 162, 255, 0.9), rgba(192, 140, 255, 0.9)); color: #0a0a12; }
.navbtn.save:hover { filter: brightness(1.08); }
.navbtn.save svg { stroke-width: 2.4; }

/* ---------------- Status toast ---------------- */
.status-toast {
  position: fixed;
  bottom: calc(max(1.4rem, env(safe-area-inset-bottom)) + 70px);
  left: 0; right: 0;
  margin-inline: auto;
  width: max-content;
  max-width: 90vw;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  z-index: 51;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(18, 19, 24, 0.82);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: pillUp 0.25s var(--ease) both;
}
.status-toast.ok { color: #5fd08a; }
.status-toast.err { color: #ff8585; }
.status-toast.saving { color: var(--accent); }

/* ---------------- Background manager grid ---------------- */
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.bg-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--glass-stroke);
}
.bg-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-remove {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.bg-remove:hover { background: rgba(220, 60, 60, 0.85); }

/* ---------------- Mobile (desktop layout unchanged) ---------------- */
@media (max-width: 600px) {
  .topbar {
    align-items: flex-start;
    padding: 1rem 1.1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    gap: 0.6rem;
  }
  .brand {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    white-space: normal;
    line-height: 1.15;
    max-width: 60vw;
    -webkit-text-stroke: 0.4px #fff;
  }
  .top-actions { gap: 0.2rem; }
  .key-btn { width: 32px; height: 32px; }
  .enquire-btn { width: 42px; height: 42px; }
  .enquire-btn svg { width: 24px; height: 24px; }

  .hero-content {
    padding: 1.5rem 1.2rem;
    padding-bottom: max(2rem, calc(env(safe-area-inset-bottom) + 1.4rem));
  }

  .navbtn { width: 48px; height: 44px; }
  .navbtn svg { width: 22px; height: 22px; }
}
