@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Inter:wght@400;600&family=EB+Garamond:ital@1&display=swap');

:root{
  --bg:#0c0c11; --ink:#0b0b0f; --fg:#f5f5f7; --muted:#9aa1b3;
  --accent:#8a7bff; --ring: rgba(138,123,255,.25);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background: radial-gradient(1200px 800px at 50% 40%, #11121a 0%, var(--bg) 60%, #07070b 100%);
  color:var(--fg); font: 400 16px/1.5 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow:hidden;
}
h1,h2,h3,.title{ font-family:'Cinzel Decorative', serif; letter-spacing:.02em }

#ink{
  position:fixed; inset:0; width:100%; height:100%; display:block;
  background:
    url('/assets/media/noise.png') repeat,
    radial-gradient(60vw 60vh at 50% 45%, rgba(255,255,255,.03), rgba(0,0,0,0));
  mix-blend-mode: normal;
}

.stage{ position:relative; z-index:2; height:100dvh; display:grid; place-items:center; padding:2rem; }
.sigil{ text-align:center; max-width:72ch; }
.title{ margin:0 0 .25rem 0; font-weight:700; font-size:clamp(2.4rem,6vw,6rem); line-height:.95; text-shadow:0 0 35px rgba(138,123,255,.35), 0 4px 22px rgba(0,0,0,.6) }
.subtitle{ margin:.25rem 0 2rem 0; opacity:.75; letter-spacing:.15em; font-weight:600; font-size:clamp(1.1rem,2.2vw,1.6rem) }
.cta{ display:grid; gap:.75rem; place-items:center; }
.byline{ margin:0; color:var(--muted); font-size:.9rem; opacity:.8 }
.seal{ position:relative; isolation:isolate; display:inline-grid; place-items:center; padding:1.1rem 2.8rem; border:1px solid var(--ring); border-radius:999px; background:rgba(12,12,17,.35); backdrop-filter: blur(6px); color:var(--fg); text-transform:uppercase; letter-spacing:.2em; font-weight:700; cursor:pointer; transition: transform .18s ease, border-color .18s ease; box-shadow: inset 0 0 40px rgba(138,123,255,.15), 0 10px 40px rgba(0,0,0,.45) }
.seal:hover{ transform: translateY(-1px) scale(1.02); border-color: rgba(138,123,255,.55) }
.seal:active{ transform: translateY(0) scale(.995) }
.seal-ring{ position:absolute; inset:-12px; border-radius:inherit; box-shadow:0 0 60px 20px var(--ring); opacity:0; transition: opacity .25s }
.seal:hover .seal-ring{ opacity:1 }

.inside{ min-height:100dvh; padding:4rem max(4vw,1.5rem); display:grid; gap:2rem; overflow:auto }
.inside-head h1{ margin:0 0 .25rem 0; font-size: clamp(1.8rem, 3.6vw, 3rem) }
.muted{ color:var(--muted); margin:.25rem 0 0 0 }
.inside-nav{ display:flex; gap:.75rem; flex-wrap:wrap }
.pill{ display:inline-block; padding:.5rem .9rem; border:1px solid rgba(255,255,255,.1); border-radius:999px; text-decoration:none; color:var(--fg); opacity:.9 }
.pill:hover{ border-color:rgba(255,255,255,.22) }
.inside-body{ max-width:70ch; display:grid; gap:2rem }

blockquote.painter{ font-family:'EB Garamond', serif; font-style:italic; font-size:1.1rem; border-left:3px solid var(--accent); padding-left:1rem; margin:1.5rem 0; color:var(--muted) }

.module-fallback{ border:1px dashed rgba(255,255,255,.2); padding:1rem; border-radius:.75rem; background:rgba(255,255,255,.02) }

@media (prefers-reduced-motion: reduce){
  .seal, .seal-ring { transition: none; }
}

/* ===== DYSI Portal Base ===== */
:root{
  --empirical:#4cc9f0;            /* Empirical blue */
  --empirical-soft: rgba(76,201,240,.28);
  --portal-shadow: 0 30px 80px rgba(0,0,0,.45);
}

html.is-portal, .portal {
  background: radial-gradient(1200px 800px at 50% 40%, #0f1118 0%, #0b0c12 60%, #07080d 100%);
  color: var(--fg);
}

/* Header Nav */
.portal-nav{
  position: fixed; inset: 0 0 auto 0; height: 64px;
  display:flex; align-items:center; justify-content:space-between;
  padding: 0 1.25rem;
  background: linear-gradient(to bottom, rgba(8,9,13,.72), rgba(8,9,13,0));
  backdrop-filter: blur(8px);
  z-index: 5;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.portal-nav .brand{
  font-family:'Cinzel Decorative', serif;
  font-weight:700; letter-spacing:.04em; text-decoration:none; color:var(--fg);
  display:flex; gap:.5rem; align-items:center;
}
.portal-nav .brand .dot{ color: var(--empirical); font-size: 1.2rem; line-height: 1; }
.portal-nav .links{ display:flex; gap:.9rem; }
.portal-nav .links a{
  color:var(--muted); text-decoration:none; padding:.35rem .6rem; border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
}
.portal-nav .links a[aria-disabled="true"]{
  opacity:.6; cursor:not-allowed;
}
.portal-nav .links a:hover{ border-color:rgba(255,255,255,.18); color:var(--fg); }

/* Footer */
.portal-foot{
  position: fixed; inset:auto 0 0 0; height: 56px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(to top, rgba(8,9,13,.72), rgba(8,9,13,0));
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255,255,255,.06);
  z-index: 4;
}

/* Stage */
.portal-stage{
  min-height: 100dvh;
  display:grid; place-items:center;
  padding: 64px 1rem 56px; /* room for fixed header/footer */
  position: relative; isolation:isolate;
  overflow:hidden;
}

/* Ambient background */
.portal-bg{
  position:absolute; inset:0;
  background:
    url('/assets/media/noise.png') repeat,
    radial-gradient(60vw 60vh at 50% 45%, rgba(76,201,240,.05), rgba(0,0,0,0) 70%);
  filter: saturate(110%);
  z-index: -1;
}

/* The breathing word */
.dysi-glow{
  font-family:'Cinzel Decorative', serif;
  font-weight:700; letter-spacing:.06em;
  font-size: clamp(3rem, 14vw, 12rem);
  line-height: .9; margin: 0;
  color: var(--fg);
  text-shadow:
    0 0 40px var(--empirical-soft),
    0 0 90px rgba(76,201,240,.14);
  animation: dysi-breathe 4.6s ease-in-out infinite;
}

/* gentle pulse + chroma flicker */
@keyframes dysi-breathe{
  0%   { text-shadow: 0 0 24px var(--empirical-soft), 0 0 65px rgba(76,201,240,.10); transform: translateY(0); }
  50%  { text-shadow: 0 0 52px var(--empirical-soft), 0 0 120px rgba(76,201,240,.22); transform: translateY(-2px); color: #eafaff; }
  100% { text-shadow: 0 0 24px var(--empirical-soft), 0 0 65px rgba(76,201,240,.10); transform: translateY(0); }
}

/* Small screens */
@media (max-width: 640px){
  .portal-nav { height: 56px; }
  .portal-foot { height: 52px; }
  .portal-stage { padding: 56px 1rem 52px; }
  .portal-nav .links { gap:.5rem; }
  .portal-nav .links a { padding:.3rem .5rem; }
}

/* ===== Mobile & Accessibility polish ===== */

/* Use small-viewport units to avoid iOS 100vh bugs */
:root { --header-h: 56px; --footer-h: 52px; }
@media (min-width: 640px){ :root { --header-h: 64px; --footer-h: 56px; } }

html { scroll-behavior: smooth; }
body { -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility; }

/* Notch-safe paddings */
.portal-nav, .portal-foot {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

/* Header */
.portal-nav{
  height: var(--header-h);
}
.portal-nav .brand{ font-size: clamp(1rem, 3.5vw, 1.15rem); }
.portal-nav .links a{
  font-size: 0.95rem;
  padding: .45rem .7rem;
  min-height: 40px;            /* finger-friendly */
  display: inline-flex; align-items: center;
}

/* Desktop vs Mobile nav */
.links-desktop { display: none; }
.burger{
  display:inline-flex; gap:6px; flex-direction:column; justify-content:center;
  width:44px; height:44px; border:1px solid rgba(255,255,255,.12);
  border-radius:10px; background:rgba(255,255,255,.03); cursor:pointer;
}
.burger span{ width:20px; height:2px; background:#cfd3e1; display:block; }
@media (min-width: 768px){
  .links-desktop { display: flex; gap:.9rem; }
  .burger, .links-mobile { display: none; }
}

/* Mobile drawer */
.links-mobile{
  position: absolute; top: calc(var(--header-h) + 6px); right: 10px;
  display: none; flex-direction: column; gap:.5rem;
  padding: .6rem; border-radius: 12px;
  background: rgba(8,9,13,.9); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.links-mobile.show{ display: flex; }
.links-mobile a{ min-width: 180px; }

/* Footer */
.portal-foot{
  height: var(--footer-h);
  font-size: .95rem;
  text-align:center;
  padding-bottom: max(.25rem, env(safe-area-inset-bottom));
}

/* Stage with safe area and proper viewport units */
.portal-stage{
  min-height: calc(100svh - var(--header-h) - var(--footer-h));
  padding: var(--header-h) 1rem var(--footer-h);
}

/* Breathing word scales on phones */
.dysi-glow{
  font-size: clamp(2.6rem, 16vw, 12rem);
  text-align:center;
  padding: 0 .5rem;
  line-height: .95;
}

/* Improve contrast & reduce heavy glow on small screens */
@media (max-width: 480px){
  .dysi-glow{
    text-shadow:
      0 0 24px var(--empirical-soft),
      0 0 60px rgba(76,201,240,.12);
  }
}

/* Reduced motion = gentler breathing */
@media (prefers-reduced-motion: reduce){
  .dysi-glow{ animation: none; }
}

/* Make cards/sections finger-friendly if/when modules appear later */
.mod-card { padding: 1rem; border-radius: 16px; }
.mod-head h3 { font-size: 1rem; }
.pill{ min-height: 40px; display:inline-flex; align-items:center; padding:.5rem .9rem; }

/* Prevent horizontal scroll on tiny screens */
html, body { overflow-x: hidden; }

/* Ensure background noise doesn't jitter on mobile */
.portal-bg{ will-change: opacity, transform; }
.portal-bg{
  background-size: auto, 100% 100%;
}
.mobile-cta{ margin-top:1rem; display:grid; place-items:center; }
.mobile-cta .pill{ padding:.6rem 1rem; border:1px solid rgba(255,255,255,.18); border-radius:999px; text-decoration:none; color:var(--fg); }
.mobile-cta .pill:hover{ border-color:rgba(255,255,255,.3); background:rgba(255,255,255,.06); }
