/* Landing & maintenance pages — uses theme.css tokens only (no gallery.css).
 *
 * Server-rendered fragment contract (src/services/landing.py):
 *   .landing-hero__grid   hero photo grid; imgs are children (possibly wrapped)
 *   .landing-showcase     showcase section; cards are links using
 *                         .landing-card with __cover / __name / __slug / __stats
 *   .maintenance-eta      ETA paragraph with a <time> child
 */

* {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Shared bits (both pages)
   -------------------------------------------------------------------------- */

body.landing-page,
body.maintenance-page {
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

.landing-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.landing-toggle:hover {
  background: var(--btn-bg-hover);
}

.landing-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.gallery-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

.gallery-footer__line {
  margin: 0.25rem 0;
}

.gallery-footer__line a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gallery-footer__line a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Landing page
   -------------------------------------------------------------------------- */

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.landing-header__brand {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.landing-header__brand:hover {
  color: var(--accent);
}

.landing-header__brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.landing-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.landing-header__login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s var(--ease-out);
}

.landing-header__login:hover {
  background: var(--accent-hover);
}

.landing-header__login:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.landing-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* Hero — full-bleed photo mosaic with gradient scrim behind the copy */

.landing-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: min(84vh, 46rem);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  overflow: hidden;
  background: radial-gradient(60% 80% at 80% 20%, var(--accent-subtle), transparent 70%);
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(0deg, var(--bg) 0%, transparent 22%),
    linear-gradient(90deg, var(--bg) 8%, color-mix(in srgb, var(--bg) 78%, transparent) 42%,
      color-mix(in srgb, var(--bg) 18%, transparent) 75%, transparent 100%);
}

.landing-hero__copy {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 4rem 1.25rem;
}

.landing-hero__kicker {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.landing-hero__title {
  margin: 0 0 1.25rem;
  max-width: 16ch;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 6.2vw, 4.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.06;
  text-wrap: balance;
  word-break: keep-all;
}

.landing-hero__lead {
  margin: 0 0 1.75rem;
  max-width: 30rem;
  font-size: 1.0625rem;
  color: var(--muted);
  line-height: 1.6;
  word-break: keep-all;
}

.landing-hero__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.5rem;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s var(--ease-out);
}

.landing-hero__cta:hover {
  background: var(--accent-hover);
}

.landing-hero__cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero photo mosaic — server fragment: <div class="landing-hero__grid">…<img>…</div> */

.landing-hero__grid {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 3px;
}

.landing-hero__grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--slot-bg);
  filter: saturate(0.9) brightness(0.85);
  animation: hero-photo-in 1.1s var(--ease-out) both;
}

.landing-hero__grid img:nth-child(2) { animation-delay: 0.08s; }
.landing-hero__grid img:nth-child(3) { animation-delay: 0.16s; }
.landing-hero__grid img:nth-child(4) { animation-delay: 0.24s; }
.landing-hero__grid img:nth-child(5) { animation-delay: 0.12s; }
.landing-hero__grid img:nth-child(6) { animation-delay: 0.2s; }
.landing-hero__grid img:nth-child(7) { animation-delay: 0.28s; }
.landing-hero__grid img:nth-child(8) { animation-delay: 0.36s; }

@keyframes hero-photo-in {
  from {
    opacity: 0;
    transform: scale(1.12);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scroll/load reveal — .js gate keeps no-JS fully visible */

html.js :where(.landing-hero__copy > *, .landing-showcase) {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

html.js .landing-hero__copy > *:nth-child(2) { transition-delay: 0.08s; }
html.js .landing-hero__copy > *:nth-child(3) { transition-delay: 0.16s; }
html.js .landing-hero__copy > *:nth-child(4) { transition-delay: 0.24s; }

html.js .is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.js :where(.landing-hero__copy > *, .landing-showcase) {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .landing-hero__grid img {
    animation: none;
  }
}

/* Sections (showcase, guide) */

.landing-section {
  padding: 2rem 0;
}

.landing-section__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* Showcase — server fragment: <section class="landing-showcase">…cards…</section> */

.landing-showcase {
  padding: 2rem 0;
}

.landing-showcase__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.landing-showcase__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.landing-showcase a {
  color: inherit;
  text-decoration: none;
}

.landing-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.landing-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.landing-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.landing-card__cover,
.landing-showcase img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--slot-bg);
  transition: transform 0.6s var(--ease-out);
}

.landing-card:hover .landing-card__cover,
.landing-card:hover img {
  transform: scale(1.05);
}

.landing-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.875rem 1rem 1rem;
}

.landing-card__name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
}

.landing-card__stats {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Maintenance page
   -------------------------------------------------------------------------- */

.maintenance-page__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem 1.25rem;
}

.maintenance-card {
  width: 100%;
  max-width: 26rem;
  padding: 2.5rem 1.75rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.maintenance-card__icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 1rem;
}

.maintenance-card__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.maintenance-card__lead {
  margin: 0.25rem 0;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ETA — server fragment: <p class="maintenance-eta"><span data-i18n>…</span>: <time>…</time></p> */

.maintenance-eta {
  margin: 1.25rem 0 0;
  padding: 0.65rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  font-size: 0.9375rem;
}

.maintenance-eta time {
  font-weight: 600;
}

.maintenance-card__toggles {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.maintenance-card__admin {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.7;
  transition: color 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.maintenance-card__admin:hover {
  color: var(--fg);
  opacity: 1;
}

.maintenance-card__admin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .landing-hero {
    align-items: flex-end;
    min-height: 82vh;
  }

  .landing-hero::before {
    background: linear-gradient(0deg, var(--bg) 10%,
      color-mix(in srgb, var(--bg) 72%, transparent) 48%,
      color-mix(in srgb, var(--bg) 25%, transparent) 100%);
  }

  .landing-hero__copy {
    padding: 8rem 1.25rem 2.5rem;
  }

  .landing-hero__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }

  .landing-header__login {
    padding: 0 0.75rem;
    font-size: 0.8125rem;
  }

  .landing-showcase__grid {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  }
}

/* --------------------------------------------------------------------------
   Tenant request form
   -------------------------------------------------------------------------- */
.landing-request__form {
  display: grid;
  gap: 1rem;
  max-width: 30rem;
}

.landing-request__form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 500;
}

.landing-request__form input,
.landing-request__form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: inherit;
  font: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}

.landing-request__form textarea {
  min-height: 6rem;
  resize: vertical;
}

.landing-request__form input:focus-visible,
.landing-request__form textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.landing-request__form button {
  justify-self: start;
  min-height: 44px;
  padding: 0 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease-out);
}

.landing-request__form button:hover {
  background: var(--accent-hover);
}

.landing-request__form button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.landing-request__error {
  margin: 0;
  color: var(--danger, #e5484d);
}

.landing-request__loading {
  color: var(--muted);
}

/* The hidden attribute must win over class-level display rules (e.g.
   .landing-hero__cta / .landing-header__login use inline-flex). */
[hidden] {
  display: none !important;
}

/* Tenant request modal dialog */
.landing-request-dialog {
  width: 100%;
  max-width: min(30rem, 92vw);
  padding: 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--fg);
}

.landing-request-dialog::backdrop {
  background: rgb(0 0 0 / 0.55);
}

.landing-request-dialog__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.landing-request-dialog__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.landing-request-dialog__cancel {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
}

.landing-request-dialog__cancel:hover {
  background: var(--btn-bg-hover);
}
