/* ════════════════════════════════════════════
   PLUTOPIA — Stylesheet
   Vanilla CSS · Modern practices · 2025
   ════════════════════════════════════════════

   Layer order (specificity management):
   1. reset    — browser normalization
   2. tokens   — design tokens (custom properties)
   3. base     — raw HTML elements
   4. layout   — structural / page-level
   5. components — UI blocks
   6. utilities  — one-off helpers
*/

@layer reset, tokens, base, layout, components, utilities;


/* ════════════════════════════════════════════
   RESET
   ════════════════════════════════════════════ */
@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

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

  button, input {
    font: inherit;
  }

  ul, ol {
    list-style: none;
  }
}


/* ════════════════════════════════════════════
   TOKENS (Design System)
   ════════════════════════════════════════════ */
@layer tokens {
  :root {
    /* ── Color ── */
    --color-bg:           #0A0908;
    --color-surface:      #141210;
    --color-text:         #F0EDE8;
    --color-muted:        #6B6560;
    --color-accent:       #C8B89A;   /* warm gold — placeholder, update per moodboard */
    --color-border:       rgba(240, 237, 232, 0.08);
    --color-error:        #9B4040;

    /* ── Typography ── */
    --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

    /* ── Scale (fluid, using clamp) ── */
    --text-xs:   clamp(0.65rem,  1vw,  0.75rem);
    --text-sm:   clamp(0.8rem,   1.2vw, 0.9rem);
    --text-base: clamp(0.9rem,   1.5vw, 1rem);
    --text-lg:   clamp(1.5rem,   3vw,  2rem);
    --text-xl:   clamp(2rem,     5vw,  3.5rem);
    --text-2xl:  clamp(3rem,     9vw,  7rem);
    --text-hero: clamp(3.5rem,  13vw, 10rem);

    /* ── Spacing ── */
    --space-2xs: 0.25rem;
    --space-xs:  0.5rem;
    --space-sm:  1rem;
    --space-md:  2rem;
    --space-lg:  4rem;
    --space-xl:  8rem;
    --space-2xl: 12rem;

    /* ── Motion ── */
    --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out:     cubic-bezier(0.45, 0, 0.55, 1);
    --duration-fast:   300ms;
    --duration-base:   600ms;
    --duration-slow:   900ms;

    /* ── Layout ── */
    --page-gutter: clamp(1.25rem, 5vw, 4rem);
    --max-prose:   64ch;
  }
}


/* ════════════════════════════════════════════
   BASE
   ════════════════════════════════════════════ */
@layer base {
  html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
  }

  body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 300;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

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

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


/* ════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════ */
@layer layout {
  /* Shared page padding */
  .page-section {
    padding-inline: var(--page-gutter);
  }
}


/* ════════════════════════════════════════════
   COMPONENTS
   ════════════════════════════════════════════ */
@layer components {

  /* ─────────────────────────────────────────
     GRAIN OVERLAY
     Adds a subtle film-grain texture for that
     editorial / print-inspired premium feel.
  ──────────────────────────────────────────── */
  .grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 900;
    opacity: 0.035;
    background-image:
      url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
  }


  /* ─────────────────────────────────────────
     PASSWORD GATE
  ──────────────────────────────────────────── */
  .gate {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background-color: var(--color-bg);
    z-index: 800;
    transition: opacity var(--duration-base) var(--ease-out);
  }

  .gate.is-exiting {
    opacity: 0;
    pointer-events: none;
  }

  .gate__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    text-align: center;
    animation: fade-up var(--duration-slow) var(--ease-out) both;
  }

  .gate__brand {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-weight: 300;
    letter-spacing: 0.45em;
    color: var(--color-text);
  }

  .gate__hint {
    font-size: var(--text-xs);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-muted);
  }

  .gate__form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    width: min(100%, 320px);
  }

  .gate__input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: var(--text-base);
    letter-spacing: 0.35em;
    padding-block: var(--space-sm);
    text-align: center;
    outline: none;
    transition: border-color var(--duration-base) var(--ease-out);
  }

  .gate__input::placeholder {
    color: var(--color-muted);
    letter-spacing: 0.25em;
  }

  .gate__input:focus {
    border-bottom-color: var(--color-accent);
  }

  .gate__btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    font-size: var(--text-xs);
    letter-spacing: 0.3em;
    padding: 0.85rem 2.5rem;
    text-transform: uppercase;
    transition:
      background var(--duration-base) var(--ease-out),
      border-color var(--duration-base) var(--ease-out),
      color var(--duration-base) var(--ease-out);
  }

  .gate__btn:hover,
  .gate__btn:focus-visible {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-bg);
    outline: none;
  }

  .gate__error {
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    color: var(--color-error);
    min-height: 1em;
  }


  /* ─────────────────────────────────────────
     SITE WRAPPER
  ──────────────────────────────────────────── */
  .site {
    min-height: 100svh;
  }

  /* Fade in the whole site when gate exits */
  .site.is-visible {
    animation: fade-in var(--duration-slow) var(--ease-out) both;
  }


  /* ─────────────────────────────────────────
     NAVIGATION
  ──────────────────────────────────────────── */
  .nav {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--page-gutter);
    z-index: 100;

    /* Mix-blend inverts text over any background color,
       keeping it legible without needing JS scroll detection. */
    mix-blend-mode: difference;
    color: var(--color-text);
  }

  .nav__brand {
    font-family: var(--font-serif);
    font-size: 1rem;
    letter-spacing: 0.4em;
  }

  .nav__label {
    font-size: var(--text-xs);
    letter-spacing: 0.2em;
    color: var(--color-muted);
  }


  /* ─────────────────────────────────────────
     HERO
  ──────────────────────────────────────────── */
  .hero {
    position: relative;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: var(--space-2xl) var(--page-gutter) var(--space-xl);
  }

  .hero__content {
    text-align: center;
  }

  .hero__title {
    font-family: var(--font-serif);
    font-size: var(--text-hero);
    font-weight: 300;
    line-height: 0.95;
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: column;
    gap: 0.08em;
  }

  .hero__line {
    display: block;
    opacity: 0;
    transform: translateY(28px);
    animation: fade-up var(--duration-base) var(--ease-out) both;
  }

  .hero__line:nth-child(1) { animation-delay: 150ms; }
  .hero__line:nth-child(2) { animation-delay: 300ms; }
  .hero__line:nth-child(3) { animation-delay: 450ms; }

  .hero__line--italic {
    font-style: italic;
    color: var(--color-accent);
  }

  .hero__tagline {
    margin-block-start: var(--space-md);
    font-size: var(--text-xs);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--color-muted);
    opacity: 0;
    animation: fade-up var(--duration-base) var(--ease-out) 650ms both;
  }

  /* Scroll indicator */
  .hero__scroll {
    position: absolute;
    inset-block-end: var(--space-md);
    inset-inline-start: 50%;
    translate: -50% 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    opacity: 0;
    animation: fade-up var(--duration-base) var(--ease-out) 1100ms both;
  }

  .hero__scroll-label {
    font-size: var(--text-xs);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--color-muted);
  }

  .hero__scroll-bar {
    width: 1px;
    height: 3.5rem;
    background: var(--color-border);
    position: relative;
    overflow: hidden;
  }

  .hero__scroll-bar::after {
    content: '';
    position: absolute;
    inset-block-start: -100%;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
    animation: scroll-bar 2.2s var(--ease-in-out) 1.6s infinite;
  }


  /* ─────────────────────────────────────────
     MANIFESTO
  ──────────────────────────────────────────── */
  .manifesto {
    padding: var(--space-xl) var(--page-gutter);
    border-block-start: 1px solid var(--color-border);
  }

  .manifesto__inner {
    max-width: 800px;
  }

  .label {
    display: block;
    font-size: var(--text-xs);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-block-end: var(--space-md);
  }

  .manifesto__statement {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-weight: 300;
    line-height: 1.25;
    margin-block-end: var(--space-md);
  }

  .manifesto__body {
    font-size: var(--text-sm);
    line-height: 1.85;
    color: var(--color-muted);
    max-width: var(--max-prose);
  }


  /* ─────────────────────────────────────────
     DIVIDER IMAGE
     Placeholder for a campaign visual / hero image.
     Replace the inner content with an <img> when ready.
  ──────────────────────────────────────────── */
  .divider-image {
    margin-block: var(--space-lg);
    border-block: 1px solid var(--color-border);
  }

  .divider-image__inner {
    aspect-ratio: 16 / 9;
    background-color: var(--color-surface);
    display: grid;
    place-items: center;
    overflow: hidden;
  }

  @container (min-width: 600px) {
    .divider-image__inner {
      aspect-ratio: 21 / 9;
    }
  }

  .divider-image__placeholder {
    font-family: var(--font-serif);
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--color-muted);
    letter-spacing: 0.1em;
  }


  /* ─────────────────────────────────────────
     NOTIFY (Email signup)
  ──────────────────────────────────────────── */
  .notify {
    padding: var(--space-xl) var(--page-gutter);
    border-block-start: 1px solid var(--color-border);
  }

  .notify__inner {
    max-width: 560px;
    margin-inline: auto;
    text-align: center;
  }

  .notify__title {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-weight: 300;
    line-height: 1.2;
    margin-block-end: var(--space-sm);
  }

  .notify__title em {
    font-style: italic;
    color: var(--color-accent);
  }

  .notify__sub {
    font-size: var(--text-sm);
    line-height: 1.75;
    color: var(--color-muted);
    margin-block-end: var(--space-md);
  }

  .notify__field {
    display: flex;
    border: 1px solid var(--color-border);
    transition: border-color var(--duration-base) var(--ease-out);
  }

  .notify__field:focus-within {
    border-color: var(--color-accent);
  }

  .notify__input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: var(--text-sm);
    padding: var(--space-sm);
    outline: none;
  }

  .notify__input::placeholder {
    color: var(--color-muted);
  }

  .notify__btn {
    background: transparent;
    border: none;
    border-inline-start: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    font-size: var(--text-xs);
    letter-spacing: 0.25em;
    padding: var(--space-sm) var(--space-md);
    text-transform: uppercase;
    transition:
      background var(--duration-base) var(--ease-out),
      color var(--duration-base) var(--ease-out);
    white-space: nowrap;
  }

  .notify__btn:hover,
  .notify__btn:focus-visible {
    background: var(--color-text);
    color: var(--color-bg);
    outline: none;
  }

  .notify__feedback {
    margin-block-start: var(--space-sm);
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    color: var(--color-accent);
    min-height: 1.2em;
  }


  /* ─────────────────────────────────────────
     FOOTER
  ──────────────────────────────────────────── */
  .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-md) var(--page-gutter);
    border-block-start: 1px solid var(--color-border);
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    color: var(--color-muted);
  }

} /* end @layer components */


/* ════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════ */
@layer utilities {

  /* Scroll-triggered reveal — JS adds .is-visible */
  .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
      opacity  var(--duration-slow) var(--ease-out),
      transform var(--duration-slow) var(--ease-out);
  }

  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

}


/* ════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════ */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scroll-bar {
  0%   { inset-block-start: -100%; }
  50%  { inset-block-start: 100%;  }
  100% { inset-block-start: 100%;  }
}


/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 600px) {
  .footer {
    flex-direction: column;
    text-align: center;
  }

  .notify__field {
    flex-direction: column;
  }

  .notify__btn {
    border-inline-start: none;
    border-block-start: 1px solid var(--color-border);
    padding-block: var(--space-sm);
  }

  .nav {
    padding-block: var(--space-sm);
  }
}


/* ════════════════════════════════════════════
   REDUCED MOTION
   Honor the user's OS preference.
   ════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero__line,
  .hero__tagline,
  .hero__scroll,
  .gate__inner {
    opacity: 1;
    transform: none;
  }
}
