/* Base: reset, scene, typography, layout rhythm. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The hidden attribute must always win, even over display rules like
   .masonry { display: grid } (this exact bug made the carousel show the wall). */
[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

[data-theme='dark'] {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-hi);
  background:
    radial-gradient(1200px 700px at 85% -10%, var(--aurora-blue), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, var(--aurora-violet), transparent 55%),
    radial-gradient(800px 700px at 110% 80%, var(--aurora-pink), transparent 55%),
    var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body::selection {
  color: #fff;
  background: var(--accent);
}

::selection {
  color: #fff;
  background: var(--accent);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-0);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border: 3px solid var(--bg-0);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
}

[data-theme='dark'] ::-webkit-scrollbar-track {
  background: var(--bg-0);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--bg-0);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Film-grain so the glass has something real to refract (desktop only). */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-aurora);
  pointer-events: none;
  opacity: 0.3;
  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'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

@media (max-width: 720px) {
  body::before {
    display: none;
  }
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  letter-spacing: var(--display-tracking);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

main {
  position: relative;
  z-index: var(--z-content);
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

.section-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  margin: 34px 0 16px;
}

.muted {
  color: var(--ink-lo);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- States (loading / empty / error) --- */
.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
}

.state-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.state-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* !important here is intentional: the reduced-motion override must win the cascade. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
