/* ====================================================================
   Trinitas Investment — Common stylesheet
   Refined Ecclesiastical-Vault aesthetic.
   Brown / beige two-tone with antique-gold accents.
==================================================================== */

:root {
  --brown:        #3B2E2A;
  --brown-deep:   #2A1F1B;
  --brown-light:  #4A3B36;
  --beige:        #E9DCC2;
  --beige-deep:   #D9CDB0;
  --gold:         #C5A059;
  --gold-light:   #D4B96A;
  --gold-deep:    #8C6E36;
  --ink:          #15110C;
  --bone:         #F6EFDD;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Lato', 'Noto Sans KR', sans-serif;
  font-weight: 300;
  background: var(--brown);
  color: #F0E8D6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.classic { font-family: 'Cinzel', 'Noto Serif KR', serif; letter-spacing: 0.02em; }
.serif   { font-family: 'Playfair Display', 'Noto Serif KR', serif; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--brown-deep); }
::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
::selection { background: var(--gold); color: var(--brown); }

/* ---- Hero canvas ---- */
.vignette { background: radial-gradient(circle, transparent 30%, var(--brown) 75%); }
#crypto-canvas { width: 100%; height: 100%; display: block; }

/* Square coin-orbit container — keeps a 1:1 aspect across viewports */
.canvas-container {
  position: relative;
  width: 800px;
  height: 800px;
}
@media (max-width: 768px) {
  .canvas-container {
    width: 100vw; height: 100vw;
    max-width: 500px; max-height: 500px;
  }
  .vignette { background: radial-gradient(circle, transparent 20%, var(--brown) 60%); }
}
@media (max-width: 480px) {
  .canvas-container {
    width: 100vw; height: 100vw;
    max-width: 380px; max-height: 380px;
  }
}

/* ---- Section bases ---- */
.brown-section { background: var(--brown); color: #F0E8D6; position: relative; }
.beige-section { background: var(--beige); color: var(--ink);  position: relative; }

/* On beige panels, the antique gold lacks contrast (1.9:1).
   Auto-darken to gold-deep (4.2:1, near AA) for eyebrows and small accents. */
.beige-section .gold-text { color: var(--gold-deep); }

/* fine gold hairline at section transitions */
.brown-section + .beige-section::before,
.beige-section + .brown-section::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold) 50%, transparent);
  opacity: 0.6;
  pointer-events: none;
}

/* ---- Gold dividers ---- */
.gold-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold) 50%, transparent);
}
.gold-divider-solid { height: 1px; background: var(--gold); opacity: 0.55; }

/* ---- Paper grain overlay ---- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  /* Promote to its own GPU layer so the mix-blend-mode composite
     doesn't re-rasterise on every scroll frame. */
  will-change: opacity;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* ---- Hero key logo ---- */
.hero-key {
  width: 130px;
  height: auto;
  filter: drop-shadow(0 0 30px rgba(197,160,89,0.45)) drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  user-select: none;
  -webkit-user-drag: none;
}
@media (min-width: 480px) { .hero-key { width: 160px; } }
@media (min-width: 768px) { .hero-key { width: 220px; } }
@media (min-width: 1024px){ .hero-key { width: 280px; } }

/* ---- Drop cap (Philosophy) ---- */
.drop-cap::first-letter {
  font-family: 'Cinzel', serif;
  font-size: 4.4rem;
  float: left;
  line-height: 0.88;
  padding: 0.5rem 0.7rem 0 0;
  color: var(--gold);
  font-weight: 700;
}

/* ---- Pillar icon ---- */
.pillar-icon { width: 48px; height: 48px; margin: 0 auto 0.5rem; display: block; }

/* ---- Business card ---- */
.business-card {
  border: 1px solid rgba(255,255,255,0.18);
  background: var(--brown-deep);
  padding: 2.5rem;
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1),
              border-color 0.5s ease,
              box-shadow 0.5s ease;
}
.business-card:hover,
.business-card.in-view {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 18px 50px -12px rgba(197,160,89,0.22);
}
.business-card .num-medallion {
  height: 3.5rem; width: 3.5rem; margin-bottom: 1.75rem;
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 1.05rem; letter-spacing: 0.08em;
  color: white;
  transition: all 0.5s ease;
}
.business-card:hover .num-medallion,
.business-card.in-view .num-medallion {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--brown);
}

/* ===========================================================
   Three Pillars — heraldic hover (hairline only)
   Gold hairlines unfurl top/bottom from the centre, like a seal
   being stamped onto the page. No lift, no shadow, no wash —
   the rest of the card stays exactly where it is.
   =========================================================== */
.pillar-card {
  position: relative;
  padding: 1.75rem 1rem;
}

.pillar-card::before,
.pillar-card::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(140, 110, 54, 0.0) 8%,
    var(--gold) 32%,
    var(--gold-light) 50%,
    var(--gold) 68%,
    rgba(140, 110, 54, 0.0) 92%,
    transparent 100%
  );
  opacity: 0;
  pointer-events: none;
  transition: width   0.8s cubic-bezier(0.22, 0.8, 0.22, 1),
              left    0.8s cubic-bezier(0.22, 0.8, 0.22, 1),
              opacity 0.55s ease,
              box-shadow 0.7s ease;
}
.pillar-card::before { top: 0; }
.pillar-card::after  { bottom: 0; }

/* Soft halo that breathes outward from the hairline.
   `.in-view` is added by ui.js on touch devices when the card
   crosses the viewport centre — same effect as :hover on desktop. */
.pillar-card:hover::before,
.pillar-card:hover::after,
.pillar-card.in-view::before,
.pillar-card.in-view::after {
  width: 78%;
  left: 11%;
  opacity: 1;
  box-shadow:
    0 0 12px 0 rgba(212, 185, 106, 0.45),
    0 0 28px 0 rgba(197, 160, 89, 0.22),
    0 0 56px 0 rgba(140, 110, 54, 0.12);
}

/* ---- Navigation ---- */
nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 50;
  padding: 1.75rem 0;
  transition: background 0.5s ease, padding 0.5s ease, box-shadow 0.5s ease;
}
nav.scrolled {
  background: rgba(59,46,42,0.92);
  /* 92% opaque background means a heavy blur is invisible anyway —
     drop blur radius from 14 → 6 and saturate from 140 → 120 to slash
     the per-frame blur texture cost over the live WebGL canvas. */
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  padding: 0.85rem 0;
  box-shadow: 0 4px 20px -10px rgba(0,0,0,0.5);
}
nav a { color: #F0E8D6; text-decoration: none; transition: color 0.3s; }
nav a:hover { color: var(--gold); }

/* ---- Lang toggle ---- */
.lang-toggle a {
  color: inherit;
  opacity: 0.55;
  letter-spacing: 0.2em;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.3s;
}
.lang-toggle a.active { opacity: 1; color: var(--gold); }
.lang-toggle a:hover  { opacity: 1; }
.lang-toggle .sep { opacity: 0.3; margin: 0 0.6rem; }

/* ---- Mobile menu ---- */
.mobile-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  width: 100%;
  background: var(--brown);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.mobile-menu.open {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 0;
  gap: 1.5rem;
}
.mobile-menu a { font-size: 0.95rem; }

/* Hamburger button — mobile only */
.mobile-toggle {
  background: none;
  border: 0;
  padding: 0.4rem;
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.3s;
}
.mobile-toggle:hover { opacity: 0.7; }

@media (min-width: 768px) { .mobile-toggle { display: none; } }
@media (max-width: 767px) { .desktop-nav   { display: none; } }

/* ---- Animations ---- */
@keyframes fadeUp  { from { opacity:0; transform: translateY(28px); } to { opacity:1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes scaleIn { from { opacity:0; transform: scale(0.92); } to { opacity:1; transform: scale(1); } }
@keyframes shimmer { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

.hero-key       { animation: scaleIn 1.6s cubic-bezier(0.4,0,0.2,1) 0.2s both; }
.hero-wordmark  { animation: fadeUp 1.1s ease-out 1.0s both; }
.hero-rule      { animation: fadeUp 1s   ease-out 1.3s both; }
.hero-motto     { animation: fadeUp 1s   ease-out 1.5s both; }
.hero-tag       { animation: fadeUp 1s   ease-out 1.7s both; }
.hero-scroll    { animation: fadeIn 1s ease-out 2.2s both, shimmer 2.6s ease-in-out 2.2s infinite; }

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s cubic-bezier(0.4,0,0.2,1),
              transform 1s cubic-bezier(0.4,0,0.2,1);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.15s; }
.reveal-delay-2 { transition-delay: 0.30s; }
.reveal-delay-3 { transition-delay: 0.45s; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---- Utilities ---- */
.gold-text { color: var(--gold); }
.ink-text  { color: var(--ink); }

/* Korean font weight tweak — Noto Serif KR sits a touch heavier visually */
:lang(ko) body { font-weight: 400; }
:lang(ko) .classic { letter-spacing: 0.06em; }
