/* ───────────────────────────────────────────────────────────────
   PORTAL — RATIO ET VIS
   Hybrid palette (Option C): cream + blood + black
   Split aesthetic with yin-yang central focus
─────────────────────────────────────────────────────────────── */

:root {
  --cream:      #F2EBDC;
  --cream-deep: #E8DFC9;
  --cream-text: #1A1A1A;
  --cream-dim:  #5A5247;
  --cream-line: rgba(26,26,26,0.15);

  --black-bg:   #0A0A0A;
  --black-deep: #050505;
  --black-text: #F4F4F4;
  --black-dim:  #9A9A9A;
  --black-line: rgba(244,244,244,0.12);

  --blood:      #D84C26;

  --serif:      'Playfair Display', 'Cormorant', serif;
  --mono:       'JetBrains Mono', 'Courier New', monospace;
  --sans:       'Inter', system-ui, sans-serif;

  --ease:       cubic-bezier(0.22, 1, 0.36, 1);
}

body.portal-body {
  margin: 0;
  background: var(--black-bg);
  color: var(--black-text);
  overflow-x: hidden;
}

/* ─── PORTAL container ──────────────────────────────────────── */
.portal {
  position: relative;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ─── Hero image background (yin-yang watercolor artwork) ──── */
.portal-bg-image {
  position: absolute;
  inset: 0;
  background-image: url("../img/portal-ratio-et-viz.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
}
/* Legibility overlay for the detailed architectural image:
   - left wash: tones down wireframe noise behind RATIO text
   - right wash: deepens the dark side behind VIS text
   - bottom-centre radial: darkens behind the mantra in the split zone
   - edge vignette: pulls focus inward */
.portal-bg-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      rgba(242,235,220,0.35) 0%,
      transparent            32%,
      transparent            62%,
      rgba(0,0,0,0.32)       100%),
    radial-gradient(ellipse 55% 28% at 50% 92%,
      rgba(0,0,0,0.45) 0%,
      transparent      100%),
    radial-gradient(ellipse 88% 72% at 50% 50%,
      transparent      38%,
      rgba(0,0,0,0.30) 100%);
  pointer-events: none;
}

/* ─── NAV ───────────────────────────────────────────────────── */
.portal-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 3rem;
  z-index: 10;
}
.portal-logo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.portal-logo-text--left {
  /* The "Eligere" sits on the cream side */
  color: var(--cream-text);
  position: relative;
  z-index: 1;
}
.portal-logo-text--right {
  color: var(--black-text);
  position: relative;
  z-index: 1;
}
.portal-logo-dot {
  color: var(--blood);
  font-weight: 900;
}
.portal-nav-links {
  display: flex;
  gap: 2.5rem;
  align-items: center;
}
.portal-nav-link {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--black-text);
  opacity: 0.7;
  transition: opacity 0.3s var(--ease), color 0.3s var(--ease);
}
.portal-nav-link:hover {
  opacity: 1;
  color: var(--blood);
}
.portal-nav-link--cta {
  border: 1px solid var(--black-dim);
  padding: 0.65rem 1.2rem;
  opacity: 0.9;
}
.portal-nav-link--cta:hover {
  border-color: var(--blood);
  color: var(--blood);
  opacity: 1;
}

/* ─── PORTAL STAGE (text overlays around the yin-yang image) ─ */
.portal-stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  grid-template-rows: 1fr auto;
  align-items: start;
  min-height: 100vh;
  padding: 14rem 3rem 6rem;
  gap: 0 2rem;
}
.portal-bg-image {
  transition: background-position 850ms cubic-bezier(.22, 1, .36, 1);
}

/* ─── SIDE COLUMNS ─────────────────────────────────────────── */
.portal-side {
  display: block;
  text-decoration: none;
  padding: 0 2rem;
  max-width: 440px;
  grid-row: 1;
  align-self: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition:
    transform 500ms var(--ease),
    opacity 700ms cubic-bezier(.4, 0, .2, 1);
}
.portal-side--left {
  color: var(--cream-text);
  grid-column: 1;
  justify-self: start;
  text-align: left;
}
.portal-side--right {
  color: var(--black-text);
  grid-column: 3;
  justify-self: end;
  text-align: right;
}
.portal-side:hover {
  transform: translateY(-3px);
}
/* Text shadows for readability over the watercolor image
   (multi-layered: solid halo + outline + subtle depth) */
.portal-side--left .portal-side-subtitle,
.portal-side--left .portal-side-desc {
  text-shadow:
    0 0 12px rgba(242,235,220,0.95),
    0 0 4px rgba(242,235,220,0.85),
    0 1px 1px rgba(0,0,0,0.08);
}
.portal-side--right .portal-side-subtitle,
.portal-side--right .portal-side-desc {
  text-shadow:
    0 0 12px rgba(10,10,10,0.95),
    0 0 4px rgba(10,10,10,0.85),
    0 1px 1px rgba(244,244,244,0.08);
}

.portal-side-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.portal-side--left .portal-side-inner { align-items: flex-start; }
.portal-side--right .portal-side-inner { align-items: flex-end; }

/* Mode label (RATIO / VIS) */
.portal-side-label {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}
.portal-side--right .portal-side-label { flex-direction: row-reverse; }
.portal-side-label-text {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--blood);
  font-weight: 500;
}
.portal-side-label-line {
  display: inline-block;
  width: 50px;
  height: 1px;
  background: var(--blood);
  opacity: 0.7;
}

/* Subtitle (small headline) */
.portal-side-subtitle {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 420px;
}
.portal-side--left .portal-side-subtitle { color: var(--cream-text); }
.portal-side--right .portal-side-subtitle { color: var(--black-text); }

/* Description */
.portal-side-desc {
  font-family: var(--sans);
  font-size: 0.93rem;
  font-weight: 400;
  line-height: 1.65;
  margin: 0;
  max-width: 420px;
}
.portal-side--left .portal-side-desc { color: #3A3530; }
.portal-side--right .portal-side-desc { color: #B5B5B5; }

/* CTA */
.portal-side-cta {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blood);
  margin-top: 0.75rem;
  position: relative;
  display: inline-block;
}
.portal-side-cta::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--blood);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}
.portal-side:hover .portal-side-cta::after {
  transform: scaleX(1);
  opacity: 1;
}

/* ─── CENTER (just spacer — image yin-yang sits behind) ────── */
.portal-center {
  /* Empty space in the grid where the image's yin-yang shows through.
     Headline overlay sits at bottom-center via grid-row positioning. */
  grid-column: 2;
  grid-row: 1;
}

/* RATIO ET VIS headline — bottom-center overlay */
.portal-headline-wrap {
  grid-column: 1 / -1;
  grid-row: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-self: end;
  margin-bottom: 2rem;
  position: relative;
  z-index: 3;
}
.portal-headline {
  font-family: var(--serif);
  font-size: 3.5rem;
  line-height: 1;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.portal-headline-word {
  text-transform: uppercase;
}
.portal-headline-word--ratio {
  color: var(--cream-text);
  text-shadow: 0 2px 8px rgba(242,235,220,0.3);
}
.portal-headline-word--vis {
  color: var(--black-text);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.portal-headline-amp {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 2.2rem;
  color: var(--blood);
  text-transform: lowercase;
  letter-spacing: 0;
  position: relative;
  top: -2px;
}

/* Mantra */
.portal-mantra {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
  color: var(--blood);
  font-weight: 300;
}

/* Submantra — quiet interpretive footnote */
.portal-submantra {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0.6rem 0 0;
  color: var(--blood);
  opacity: 0.9;
}

/* ─── SCROLL HINT ──────────────────────────────────────────── */
.portal-scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--blood);
  text-decoration: none;
  z-index: 5;
  opacity: 0.75;
  transition: opacity 0.3s var(--ease);
}
.portal-scroll-hint:hover { opacity: 1; }
.portal-scroll-line {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, var(--blood), transparent);
  animation: portalScrollPulse 2s ease-in-out infinite;
}
@keyframes portalScrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(0.8); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ─── INQUIRY section below portal (kept on black background) ─ */
.inquiry--portal {
  background: var(--black-bg);
  padding: 8rem 4rem;
}

/* ─── FOOTER (portal variant) ──────────────────────────────── */
.footer--portal {
  background: var(--black-deep);
  border-top: 1px solid var(--black-line);
}

/* ─── FOOTER WHISPER (single-line signature, harmonized with portal) ── */
.footer-whisper {
  background: var(--black-bg);
  padding: 2.75rem 2rem;
  border-top: 1px solid rgba(244,244,244,0.06);
}
.footer-whisper-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black-dim);
}
.footer-whisper-brand {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--black-text);
  font-weight: 600;
}
.footer-whisper-brand .logo-dot { color: var(--blood); font-weight: 800; }
.footer-whisper-item {
  white-space: nowrap;
  color: var(--black-dim);
}
.footer-whisper-sep {
  color: var(--blood);
  opacity: 0.6;
  user-select: none;
}
.footer-whisper-link {
  white-space: nowrap;
  color: var(--black-dim);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}
.footer-whisper-link:hover { color: var(--blood); }

@media (max-width: 720px) {
  .footer-whisper {
    padding: 2rem 1.25rem;
  }
  .footer-whisper-inner {
    gap: 0.75rem 1.1rem;
    font-size: 0.62rem;
  }
  .footer-whisper-brand { font-size: 0.95rem; }
}

/* ─── ENTRANCE REVEAL (load-time stagger fade-up) ──────────── */
@keyframes portalFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes portalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.portal-bg-image {
  animation: portalFadeIn 1400ms cubic-bezier(0.22, 1, 0.36, 1) 0ms backwards;
}
.portal-nav {
  animation: portalFadeUp 900ms cubic-bezier(0.22, 1, 0.36, 1) 150ms backwards;
}
.portal-side--left {
  animation: portalFadeUp 1000ms cubic-bezier(0.22, 1, 0.36, 1) 550ms backwards;
}
.portal-side--right {
  animation: portalFadeUp 1000ms cubic-bezier(0.22, 1, 0.36, 1) 750ms backwards;
}
/* Mantra leads on desktop — animates before the columns */
.portal-headline-wrap {
  animation: portalFadeUp 1000ms cubic-bezier(0.22, 1, 0.36, 1) 350ms backwards;
}

/* CTA arrow micro-interaction */
.portal-side-cta-arrow {
  display: inline-block;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  margin-left: 0.15em;
}
.portal-side:hover .portal-side-cta-arrow {
  transform: translateX(6px);
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .portal-bg-image,
  .portal-nav,
  .portal-side--left,
  .portal-side--right,
  .portal-headline-wrap {
    animation: none;
  }
  .portal-side-cta-arrow {
    transition: none;
  }
}

/* ─── HOVER WEIGHT-SHIFT (desktop only) ─────────────────────
   Image breathes via background-position, opposite side dims
   + translates slightly outward. Container widths never change,
   so text never reflows or jumps lines. */
@media (hover: hover) and (min-width: 881px) {
  /* RATIO (left) hovered */
  .portal:has(.portal-side--left:hover) .portal-bg-image {
    background-position: 40% center;
  }
  .portal:has(.portal-side--left:hover) .portal-side--right {
    opacity: 0.45;
    transform: translateX(28px) scale(0.97);
  }

  /* VIS (right) hovered */
  .portal:has(.portal-side--right:hover) .portal-bg-image {
    background-position: 60% center;
  }
  .portal:has(.portal-side--right:hover) .portal-side--left {
    opacity: 0.45;
    transform: translateX(-28px) scale(0.97);
  }
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .portal-headline { font-size: 2.8rem; }
  .portal-yinyang { width: 220px; height: 220px; }
  .portal-side { padding: 0 2rem; }
  .portal-side-subtitle { font-size: 1.3rem; }
}

/* ─── MOBILE LAYOUT (single-column stack) ──────────────────── */
@media (max-width: 880px) {
  .portal-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    align-items: center;
    padding: 6rem 1.5rem 5rem;
    gap: 2.5rem;
    min-height: auto;
  }

  /* Reset desktop grid-column/grid-row, assign explicit single-column rows */
  .portal-side {
    max-width: 100%;
    padding: 0 1rem;
  }
  .portal-side--left {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    text-align: center;
    padding: 1.75rem 1.5rem;
    background: rgba(242, 235, 220, 0.40);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 3px;
  }
  .portal-center {
    grid-column: 1;
    grid-row: 4;
    min-height: 0;
  }
  .portal-side--right {
    grid-column: 1;
    grid-row: 3;
    justify-self: stretch;
    text-align: center;
    padding: 1.75rem 1.5rem;
    background: rgba(10, 10, 10, 0.50);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 3px;
  }
  /* On mobile, the homepage cards act as navigation hooks — full body
     copy lives on the /ratio and /vis subpages; hide it here so both
     cards fit on the first screen without sacrificing readability. */
  .portal-side-desc {
    display: none;
  }
  /* Override text shadows since the backdrop now handles legibility */
  .portal-side--left .portal-side-subtitle,
  .portal-side--left .portal-side-desc,
  .portal-side--left .portal-side-label-text {
    text-shadow: none;
  }
  .portal-side--right .portal-side-subtitle,
  .portal-side--right .portal-side-desc,
  .portal-side--right .portal-side-label-text {
    text-shadow: none;
  }

  /* Inner blocks centered on mobile */
  .portal-side-inner {
    align-items: center !important;
    text-align: center;
    gap: 1.1rem;
  }

  /* Mantra leads on mobile — same frosted strip as desktop. */
  .portal-headline-wrap {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.50);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
  .portal-mantra    { color: var(--cream); text-shadow: none; }
  .portal-submantra { color: var(--cream); opacity: 0.75; text-shadow: none; }

  /* Nav adjustments for narrow viewport */
  .portal-nav {
    padding: 1.25rem 1.25rem;
  }
  .portal-nav-links {
    gap: 1rem;
  }
  .portal-nav-link {
    font-size: 0.65rem;
    white-space: nowrap;
  }
  .portal-nav-link--cta {
    padding: 0.55rem 0.85rem;
  }

  /* Background image position — for vertical viewport, frame the yin-yang */
  .portal-bg-image {
    background-position: center 38%;
  }
  /* Slightly stronger dim overlay on mobile to improve text legibility */
  .portal-bg-image::after {
    background:
      radial-gradient(ellipse 95% 70% at 50% 50%, rgba(0,0,0,0.0) 40%, rgba(0,0,0,0.32) 100%);
  }
}

@media (max-width: 480px) {
  .portal-stage {
    padding: 5rem 1rem 4rem;
    gap: 2.25rem;
  }
  .portal-side-label-text {
    font-size: 2.2rem;
  }
  .portal-side-subtitle {
    font-size: 1.05rem;
  }
  .portal-nav-links { gap: 0.65rem; }
  .portal-nav-link { font-size: 0.58rem; letter-spacing: 0.1em; }
  .portal-nav-link--cta { padding: 0.5rem 0.7rem; }

  /* Logo + "Briefs" + "Get in Touch" no longer fit on one line at this
     width — they crowd and collide. Drop the secondary "Briefs" link
     (still reachable from the footer on every page) and keep the header
     down to logo + CTA, which fit cleanly with room to breathe. */
  .portal-nav-link:not(.portal-nav-link--cta) {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EXPERIMENT: BIG RATIO / VIS HEADLINES
   Replaces the tiny mono labels with prominent serif names so
   "RATIO" and "VIS" become the visual anchors of each side.
   Easy to revert by removing this block.
═════════════════════════════════════════════════════════════════ */

/* Promote: label container → block, line hidden */
.portal-side-label {
  display: block;
  margin-bottom: 0.4rem;
  gap: 0;
}
.portal-side-label-line {
  display: none;
}

/* The BIG headline: RATIO / VIS */
.portal-side-label-text {
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.portal-side--left .portal-side-label-text {
  color: var(--cream-text);
  text-shadow:
    0 0 20px rgba(242,235,220,0.7),
    0 0 6px rgba(242,235,220,0.85),
    0 2px 4px rgba(0,0,0,0.04);
}
.portal-side--right .portal-side-label-text {
  color: var(--black-text);
  text-shadow:
    0 0 20px rgba(10,10,10,0.7),
    0 0 6px rgba(10,10,10,0.85),
    0 2px 4px rgba(244,244,244,0.04);
}

/* Demote: subtitle becomes the secondary tagline */
.portal-side-subtitle {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 0.25rem;
}

/* Slight gap increase between elements to breathe with bigger headline */
.portal-side-inner {
  gap: 1.4rem;
}

/* Responsive scale-down for the big headline */
@media (max-width: 1100px) {
  .portal-side-label-text { font-size: 4rem; }
  .portal-side-subtitle { font-size: 1.1rem; }
}
@media (max-width: 880px) {
  .portal-side-label-text { font-size: 2.6rem; }
}
@media (max-width: 480px) {
  .portal-side-label-text { font-size: 2.2rem; }
  .portal-side-subtitle { font-size: 1.05rem; }
}

/* ─── DESKTOP TEXT BACKDROPS + GRID REORDER ─────────────────────
   Frosted-glass plates behind each text column.
   Mantra moves to row 1 (above the two columns) — it frames the
   duality rather than closing it. Columns shift to row 2.
──────────────────────────────────────────────────────────────── */
@media (min-width: 881px) {
  /* Mantra-first layout: row 1 = mantra (auto height), row 2 = columns (1fr) */
  .portal-stage {
    grid-template-rows: auto 1fr;
    row-gap: 2rem;
    padding-top: 4rem;
    padding-bottom: 8rem;
  }
  .portal-center {
    grid-row: 2;
  }
  /* Columns: transparent over image, vertically centred so headings align */
  .portal-side--left {
    grid-row: 2;
    align-self: center;
  }
  .portal-side--right {
    grid-row: 2;
    align-self: center;
  }

  /* Mantra: row 1, floats directly over the image — no frosted strip */
  .portal-headline-wrap {
    grid-row: 1;
    align-self: start;
    margin-bottom: 0;
    padding: 1rem 3rem;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .portal-mantra {
    color: var(--cream);
    text-shadow:
      0 0 24px rgba(0,0,0,0.95),
      0 0 8px  rgba(0,0,0,0.85),
      0 1px 3px rgba(0,0,0,0.7);
  }
  .portal-submantra {
    color: var(--cream);
    opacity: 0.9;
    text-shadow:
      0 0 18px rgba(0,0,0,0.9),
      0 1px 2px rgba(0,0,0,0.7);
  }
}
