/* ==========================================================================
   Quercia viva — Brand moments (brand §4, §8)
   Container styles for the surfaces where the growth rings appear: login,
   empty states, loading, courtesy/error pages. The rings themselves are
   painted by public/js/growth-rings.js.
   ========================================================================== */

/* Generic rings canvas: sits behind content, never interactive */
.qc-rings {
  display: block;
  pointer-events: none;
  user-select: none;
}

/* ================================================================== *
 * Login / auth (brand moment: rings behind the header)
 * ================================================================== */
.qc-auth {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--qc-background);
  overflow: hidden;
}
.qc-auth__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--qc-surface);
  border: 1px solid var(--qc-border);
  border-radius: var(--qc-radius-panel);
  box-shadow: var(--qc-shadow-lg);
  padding: 2.5rem 2rem 2rem;
  overflow: hidden;
}
.qc-auth__header {
  position: relative;
  text-align: center;
  margin-bottom: 1.75rem;
}
/* rings live behind the logo + welcome, clipped by the card */
.qc-auth__rings {
  position: absolute;
  left: 50%;
  top: -3.5rem;
  transform: translateX(-50%);
  width: 320px;
  height: 320px;
  z-index: 0;
}
.qc-auth__brand,
.qc-auth__title,
.qc-auth__subtitle {
  position: relative;
  z-index: 1;
}
.qc-auth__brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}
.qc-auth__logo { height: 44px; width: auto; }
.qc-auth__title {
  font-family: var(--qc-font-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--qc-text-primary);
  margin: 0;
}
.qc-auth__subtitle {
  color: var(--qc-text-secondary);
  margin: .25rem 0 0;
}
.qc-auth__footer {
  text-align: center;
  color: var(--qc-text-tertiary);
  margin-top: 1.25rem;
}

/* ================================================================== *
 * Login / auth 2.0 — split-screen "anelli vivi"
 * Brand panel (fixed deep-forest ground, rings as hero) beside a calm
 * form panel on the neutral canvas. Reuses .qc-auth__title/__subtitle/
 * __footer above; the .qc-auth__card path stays for forgot/reset.
 * ================================================================== */
.qc-auth--split {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: stretch;
  padding: 0;
}
.qc-auth__brandpanel {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: clamp(2rem, 4vw, 3.25rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  /* brand moment: a deep forest ground in BOTH themes */
  background: radial-gradient(120% 90% at 15% 12%, #2E6B45 0%, #1F5233 45%, #0C2A1A 100%);
  color: #EAF6EE;
  /* rings (and any primary) read light on the fixed dark ground, both themes */
  --qc-primary: #8FE3AC;
  --qc-accent: #E7B978;
}
.qc-auth__brandrings {
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 460px;
  height: 460px;
  z-index: 0;
}
.qc-auth__grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .45;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.qc-auth__brandtop,
.qc-auth__manifesto { position: relative; z-index: 1; }
.qc-auth__wordmark {
  font-family: var(--qc-font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -.02em;
  color: #fff;
}
.qc-auth__headline {
  font-family: var(--qc-font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  line-height: 1.04;
  letter-spacing: -.03em;
  color: #fff;
  max-width: 15ch;
  margin: 0;
}
.qc-auth__subline {
  margin: .9rem 0 0;
  max-width: 36ch;
  color: #C7E7D2;
  font-size: 1.02rem;
  line-height: 1.55;
}
.qc-auth__formpanel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(2rem, 4vw, 3rem);
  background: var(--qc-background);
}
.qc-auth__form { width: 100%; max-width: 400px; }
.qc-auth__passkey { margin-top: 1.5rem; }
.qc-auth__fields { margin-top: 1.25rem; }
/* password show/hide affordance */
.qc-pw-toggle { cursor: pointer; color: var(--qc-text-tertiary); }
.qc-pw-toggle:hover { color: var(--qc-primary); }

@media (max-width: 820px) {
  .qc-auth--split { grid-template-columns: 1fr; }
  .qc-auth__brandpanel {
    min-height: 220px;
    justify-content: flex-end;
  }
  .qc-auth__formpanel { min-height: auto; }
  .qc-auth__brandrings { width: 320px; height: 320px; right: -70px; bottom: -90px; }
}

/* ================================================================== *
 * Empty state (brand §8) — icon on faint static rings; an invitation
 * ================================================================== */
.qc-empty__figure {
  position: relative;
  width: 128px;
  height: 128px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qc-empty__rings {
  position: absolute;
  inset: 0;
  width: 128px;
  height: 128px;
  z-index: 0;
}
.qc-empty__icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  color: var(--qc-primary);
}
/* keep Tabler's .empty subtitle on-token */
.empty-subtitle { color: var(--qc-text-secondary); }
.empty-title { font-family: var(--qc-font-display); font-weight: 700; }

/* ================================================================== *
 * Loading — branded ring loader (brand §8). The canvas loops the
 * draw-in via public/js/growth-rings.js. Reuse via
 * templates/components/_loading_rings.html.twig for any loading state.
 * ================================================================== */
.qc-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1.5rem 0;
  text-align: center;
}
.qc-loader__rings { display: block; }
.qc-loader__label {
  font-weight: 600;
  color: var(--qc-text-secondary);
}
.qc-loader--inline {
  flex-direction: row;
  padding: 0;
  gap: .5rem;
}

/* ================================================================== *
 * Loading — skeleton shimmer on surface-light (brand §8)
 * ================================================================== */
.qc-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--qc-surface-light);
  border-radius: var(--qc-radius-input);
}
.qc-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg,
      transparent,
      color-mix(in srgb, var(--qc-primary) 10%, transparent),
      transparent);
  animation: qc-shimmer 1.4s ease-in-out infinite;
}
@keyframes qc-shimmer {
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .qc-skeleton::after { animation: none; }
}

/* ================================================================== *
 * Courtesy / error pages — rings behind the status icon
 * ================================================================== */
.qc-courtesy {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--qc-background);
  overflow: hidden;
  text-align: center;
}
.qc-courtesy__inner { position: relative; z-index: 1; max-width: 480px; }
.qc-courtesy__figure {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qc-courtesy__rings { position: absolute; inset: 0; width: 160px; height: 160px; z-index: 0; }
.qc-courtesy__code {
  position: relative;
  z-index: 1;
  font-family: var(--qc-font-display);
  font-weight: 800;
  font-size: 3rem;
  letter-spacing: -.03em;
  color: var(--qc-primary);
  font-variant-numeric: tabular-nums;
}
.qc-courtesy__title {
  font-family: var(--qc-font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--qc-text-primary);
  margin-bottom: .5rem;
}
.qc-courtesy__text { color: var(--qc-text-secondary); margin-bottom: 1.5rem; }

/* ── Turbo Drive progress bar ──────────────────────────────────────────────
   Turbo shows this at the top of the viewport during navigations longer than
   ~500ms. Re-skinned with the brand gradient (primary → accent). */
.turbo-progress-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--qc-primary), var(--qc-accent));
  box-shadow: 0 0 8px color-mix(in srgb, var(--qc-primary) 60%, transparent);
}

/* ── Turbo 8 view transitions ──────────────────────────────────────────────
   A subtle cross-fade on same-origin visits (opt-in via the <meta name=
   "view-transition"> in minimal.html.twig). Kept short so it reads as "instant
   but smooth", and fully disabled under reduced-motion (brand rule §9). */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 160ms;
    animation-timing-function: ease;
  }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
