/* ==========================================================================
   Meora Studios — style.css
   Organic Editorial design system.
   ========================================================================== */

/* --- Custom Font Faces --- */
@font-face {
  font-family: 'Lucida';
  src: url('assets/fonts/Lucida.woff2') format('woff2'),
       url('assets/fonts/Lucida.otf') format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'Blackstone';
  src: url('assets/fonts/Blackstone.woff2') format('woff2'),
       url('assets/fonts/Blackstone.otf') format('opentype');
  font-display: swap;
}

/* --- Design Tokens --- */
:root {
  /* Brand Colors — derived from Meora Studios branding */
  --ink:            #1A1A18;
  --ink-soft:       #2A2A28;
  --warm-black:     #0F0F0E;
  --sand:           #E6D5C3;
  --sand-light:     #F0E5D8;
  --cream:          #F5EDE4;
  --warm-white:     #EEE1CF;
  --sage:           #5E6B6B;
  --sage-light:     #8A9494;
  --text-muted:     #4A4A47;
  --text-on-dark:   rgba(230, 213, 195, 0.85);
  --text-on-dark-muted: rgba(230, 213, 195, 0.65);
  --border-subtle:  rgba(26, 26, 24, 0.1);

  /* Easing */
  --ease-silk:      cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Durations — max 400ms for UI, up to 800ms for entrance only */
  --dur-fast:     150ms;
  --dur-normal:   250ms;
  --dur-slow:     400ms;
  --dur-entrance: 800ms;

  /* Fluid Type — min 12px (0.75rem) for smallest */
  --text-xs:   clamp(0.75rem, 0.7rem + 0.15vw, 0.8125rem);
  --text-sm:   clamp(0.875rem, 0.82rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.92rem + 0.3vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem + 0.45vw, 1.375rem);
  --text-xl:   clamp(1.375rem, 1.1rem + 0.9vw, 2rem);
  --text-2xl:  clamp(1.75rem, 1.3rem + 1.5vw, 2.75rem);
  --text-3xl:  clamp(2.25rem, 1.5rem + 2.5vw, 4rem);
  --text-display: clamp(2.5rem, 1.6rem + 3vw, 5rem);

  /* Spacing */
  --section-pad: clamp(80px, 10vw, 140px);
  --content-max: 1080px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--warm-black);
  line-height: 1.7;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

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

/* --- Font Gate --- */
html:not(.fonts-loaded) .hero,
html:not(.fonts-loaded) .manifesto,
html:not(.fonts-loaded) .apps,
html:not(.fonts-loaded) .footer {
  opacity: 0;
}
html.fonts-loaded .hero,
html.fonts-loaded .manifesto,
html.fonts-loaded .apps,
html.fonts-loaded .footer {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* --- Selection --- */
::selection {
  background: var(--sand);
  color: var(--ink);
}

/* --- Skip to Content --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sand);
  color: var(--ink);
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  z-index: 1000;
  transition: top var(--dur-fast) ease;
}
.skip-link:focus {
  top: 0;
}

/* --- Focus Styles --- */
:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
}

/* ==========================================================================
   SCROLL REVEAL
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity var(--dur-entrance) var(--ease-out-expo),
              transform var(--dur-entrance) var(--ease-out-expo);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #2C3831;
  overflow: hidden;
  padding: 2rem;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
}

/* Background image */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Grain overlay */
.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  mix-blend-mode: soft-light;
}

/* Botanical shadow — full coverage, centered */
.hero-botanical {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: botanicalReveal 2s var(--ease-out-expo) 0.5s forwards;
}
.hero-botanical img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@keyframes botanicalReveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Warm glow behind logo */
.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50vw;
  height: 50vw;
  max-width: 600px;
  max-height: 600px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.03) 40%,
    transparent 70%
  );
  z-index: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* Hero content */
.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  max-width: 640px;
}

.hero-logo {
  width: min(480px, 80vw);
  height: auto;
  margin: 0 auto;
  opacity: 0;
  animation: logoReveal 1.2s var(--ease-silk) 0.3s forwards;
}

@keyframes logoReveal {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(1.02);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Thin separator line */
.hero-line {
  height: 1px;
  background: var(--sand);
  margin: 2rem auto;
  opacity: 0;
  transform: scaleX(0);
  width: 60px;
  animation: lineReveal 0.6s var(--ease-out-expo) 0.9s forwards;
}

@keyframes lineReveal {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 0.4; transform: scaleX(1); }
}

.hero-subhead {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-lg);
  font-weight: 300;
  font-style: italic;
  color: rgba(255, 255, 255, 0.7);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.8;
  letter-spacing: 0.02em;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-silk) 1.1s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scroll indicator */
.hero-scroll {
  position: absolute;
  bottom: 2.5rem;
  bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
  animation: fadeUp 0.6s var(--ease-silk) 1.6s forwards;
}

.hero-scroll span {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.hero-scroll-line {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.35), transparent);
}

/* ==========================================================================
   MANIFESTO
   ========================================================================== */

.manifesto {
  background: var(--sand-light);
  padding: var(--section-pad) 2rem;
  position: relative;
  overflow: hidden;
}

/* Hero curved bottom edge */
.hero::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--sand-light);
  clip-path: ellipse(55% 100% at 50% 100%);
  z-index: 4;
  pointer-events: none;
}

.manifesto-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
}

.manifesto-eyebrow {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 2.5rem;
}

.manifesto-statement {
  font-family: 'Lucida', Georgia, serif;
  font-size: var(--text-3xl);
  font-weight: normal;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 2.5rem;
}

.manifesto-statement em {
  font-family: 'Blackstone', 'Brush Script MT', cursive;
  font-style: normal;
  font-size: 1.1em;
}

.manifesto-body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.8;
}

.manifesto-body em {
  font-family: 'Blackstone', 'Brush Script MT', cursive;
  font-style: normal;
  font-size: 1.6em;
}

/* Stagger manifesto reveals */
.manifesto .reveal:nth-child(1) { transition-delay: 0ms; }
.manifesto .reveal:nth-child(2) { transition-delay: 120ms; }
.manifesto .reveal:nth-child(3) { transition-delay: 240ms; }

/* ==========================================================================
   APPS
   ========================================================================== */

.apps {
  background: var(--cream);
  padding: var(--section-pad) 0;
  position: relative;
}

.apps-header {
  text-align: center;
  padding: 0 2rem;
  margin-bottom: clamp(48px, 6vw, 80px);
}

.apps-eyebrow {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 1.25rem;
}

.apps-title {
  font-family: 'Lucida', Georgia, serif;
  font-size: var(--text-2xl);
  font-weight: normal;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Stagger header */
.apps-header .reveal:nth-child(1) { transition-delay: 0ms; }
.apps-header .reveal:nth-child(2) { transition-delay: 100ms; }

/* --- App Spread — Editorial Layout --- */

.app-spread {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(40px, 5vw, 64px) clamp(1.5rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
  position: relative;
  border-top: 1px solid var(--border-subtle);
}

.app-spread:last-of-type {
  border-bottom: 1px solid var(--border-subtle);
}

/* Layout variant — swap column order without RTL hack */
.app-spread--left .app-spread-content {
  grid-column: 2;
  grid-row: 1;
}
.app-spread--left .app-spread-decoration {
  grid-column: 1;
  grid-row: 1;
}
/* Numbering — subtle watermark behind content */
.app-spread-number {
  position: absolute;
  top: clamp(24px, 3vw, 48px);
  left: clamp(1.5rem, 4vw, 3rem);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-display);
  font-weight: 300;
  color: rgba(26, 26, 24, 0.05);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.app-spread--left .app-spread-number {
  left: auto;
  right: clamp(1.5rem, 4vw, 3rem);
}

/* Content column */
.app-spread-content {
  position: relative;
  z-index: 2;
}

.app-spread-meta {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.app-spread-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--warm-white);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex-shrink: 0;
  transition: transform var(--dur-normal) var(--ease-out-quart);
}

.app-spread:hover .app-spread-icon {
  transform: translateY(-2px);
}

.app-spread-icon svg {
  width: 22px;
  height: 22px;
}

.app-spread-icon--img {
  overflow: hidden;
  padding: 0;
}
.app-spread-icon--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}

.app-spread-badge {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage);
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--sage-light);
  border-radius: 999px;
  white-space: nowrap;
}

.app-spread-name {
  font-family: 'Lucida', Georgia, serif;
  font-size: var(--text-2xl);
  font-weight: normal;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.375rem;
}

.app-spread-tagline {
  font-family: 'Blackstone', 'Brush Script MT', cursive;
  font-size: var(--text-xl);
  color: var(--sage);
  margin-bottom: 1.25rem;
  line-height: 1.3;
}

.app-spread-description {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 420px;
  margin-bottom: 1.75rem;
}

.app-spread-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* CTA link */
.app-spread-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background var(--dur-normal) var(--ease-out-quart),
              color var(--dur-normal) var(--ease-out-quart);
}
.app-spread-cta svg {
  transition: transform var(--dur-normal) var(--ease-out-quart);
}
.app-spread-cta:hover {
  background: var(--ink);
  color: var(--cream);
}
.app-spread-cta:hover svg {
  transform: translate(2px, -2px);
}

/* Social link */
.app-spread-social {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  cursor: pointer;
}
.app-spread-social svg {
  width: 15px;
  height: 15px;
  fill: var(--text-muted);
  transition: fill var(--dur-fast) ease;
}
.app-spread-social span {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  transition: color var(--dur-fast) ease;
}
.app-spread-social:hover svg {
  fill: var(--ink);
}
.app-spread-social:hover span {
  color: var(--ink);
}

/* Decoration SVG column */
.app-spread-decoration {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage-light);
  opacity: 0.35;
  transition: opacity var(--dur-slow) ease;
}

.app-spread:hover .app-spread-decoration {
  opacity: 0.6;
}

.app-spread-decoration svg {
  width: 100%;
  max-width: 200px;
  height: auto;
}

.app-spread-decoration--img {
  opacity: 0.85;
}
.app-spread-decoration--img img {
  width: 100%;
  max-width: 260px;
  height: auto;
  object-fit: contain;
}
.app-spread:hover .app-spread-decoration--img {
  opacity: 1;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  background: #2C3831;
  padding: var(--section-pad) 2rem clamp(40px, 4vw, 60px);
  padding-bottom: calc(clamp(40px, 4vw, 60px) + env(safe-area-inset-bottom, 0px));
  position: relative;
  overflow: hidden;
}

/* Grain on footer */
.footer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  mix-blend-mode: overlay;
}

/* Curved transition from apps */
.footer::after {
  content: "";
  position: absolute;
  top: -1px;
  left: -5%;
  right: -5%;
  width: 110%;
  height: 80px;
  background: var(--cream);
  border-radius: 0 0 50% 50%;
  z-index: 1;
  pointer-events: none;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
}

.footer-contact {
  margin-bottom: 2.5rem;
}

.footer-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
  margin-bottom: 0.875rem;
}

.footer-email {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xl);
  font-weight: 400;
  font-style: italic;
  color: var(--sand);
  text-decoration: none;
  position: relative;
  display: inline-block;
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}

.footer-email::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--sand);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-normal) var(--ease-out-expo);
}

.footer-email:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.footer-line {
  width: 40px;
  height: 1px;
  background: rgba(230, 213, 195, 0.15);
  margin: 0 auto 2.5rem;
}

.footer-logo {
  width: 120px;
  height: auto;
  opacity: 0.25;
  margin: 0 auto 1.25rem;
}

.footer-copyright {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--text-on-dark-muted);
}

/* Stagger footer reveals */
.footer .reveal:nth-child(1) { transition-delay: 0ms; }
.footer .reveal:nth-child(2) { transition-delay: 120ms; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Tablet */
@media (max-width: 1023px) {
  .app-spread-decoration svg {
    max-width: 160px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .hero {
    padding: 1.5rem;
  }

  .hero-logo {
    width: min(300px, 85vw);
  }

  .hero-scroll {
    bottom: 1.5rem;
  }

  .manifesto-statement {
    font-size: var(--text-2xl);
  }

  .app-spread {
    grid-template-columns: 1fr;
    padding: clamp(32px, 5vw, 48px) 1.5rem;
  }

  /* Reset column placement on mobile */
  .app-spread--left .app-spread-content,
  .app-spread--left .app-spread-decoration,
  .app-spread--left .app-spread-number {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
  }

  .app-spread-number {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    font-size: var(--text-2xl);
    color: rgba(26, 26, 24, 0.08);
    margin-bottom: 0.5rem;
  }

  .app-spread--left .app-spread-number {
    left: auto;
    right: auto;
  }

  .app-spread-decoration {
    order: -1;
    margin-bottom: 0.5rem;
  }
  .app-spread-decoration svg {
    max-width: 120px;
  }

  .app-spread-name {
    font-size: var(--text-xl);
  }

  .app-spread-tagline {
    font-size: var(--text-lg);
  }

  .footer-email {
    font-size: var(--text-lg);
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .hero-subhead {
    font-size: var(--text-base);
  }

  .hero-subhead br {
    display: none;
  }

  .manifesto {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .manifesto-statement br {
    display: none;
  }

  .app-spread-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-logo,
  .hero-line,
  .hero-subhead,
  .hero-scroll,
  .hero-botanical {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .hero-botanical img {
    opacity: 1;
  }

  .hero-glow {
    transform: translate(-50%, -50%);
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
