/* ===================================================================
   HOMEOSTASIS — marketing site styles
   Derived from the in-app "soft" theme: cream paper, chunky ink
   outlines, hard offset shadows, Fredoka / DM Mono / Nunito.
   =================================================================== */

/* ---- tokens ---- */
:root{
  --cream:    #F1E7D3;
  --cream-2:  #F7EFDF;
  --paper:    #FBF5E8;   /* card fill */
  --paper-2:  #FDF9F0;
  --paper-sink:#F4ECDA;

  --ink:      #181715;
  --ink-2:    #2a2824;
  --muted:    #6f685c;   /* secondary text */
  --muted-2:  #948b7b;

  --coral:    #FF5C5C;
  --coral-d:  #E84A4A;
  --coral-deep:#c93c3c;
  --gold:     #F5C23A;
  --gold-d:   #E0A92A;
  --amber:    #F3CB54;
  --green:    #57C277;
  --green-d:  #46a863;
  --mint:     #8FE3B5;

  --blue:     #ABDDF2;
  --blue-d:   #7FBEDD;
  --purple:   #C3A6EF;
  --purple-d: #9B7FD4;
  --pink:     #F5A6CE;
  --pink-d:   #E07FB0;
  --er:       #F2965C;
  --er-d:     #DC7F46;

  --line: var(--ink);
  --bw: 3px;                    /* base border weight */
  --radius: 20px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --shadow-hard: 0 5px 0 var(--ink);
  --shadow-hard-sm: 0 3px 0 var(--ink);
  --shadow-soft: 0 14px 30px -16px rgba(40,30,15,.45);
  --shadow-card: 0 5px 0 var(--ink), 0 18px 34px -20px rgba(40,30,15,.5);

  --maxw: 1180px;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;
  --font-body: "Nunito", system-ui, sans-serif;
}

*{ box-sizing:border-box; }
html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
  overflow-x:hidden;
  overflow-x:clip;            /* preserves position:sticky in modern browsers */
}
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--cream);
  background-image:
    radial-gradient(120% 80% at 50% -10%, #FBF3E2 0%, rgba(251,243,226,0) 55%),
    radial-gradient(140% 120% at 100% 120%, #F6E0C6 0%, rgba(246,224,198,0) 50%),
    radial-gradient(120% 100% at 0% 110%, #EFE9F2 0%, rgba(239,233,242,0) 45%);
  background-attachment:fixed;
  line-height:1.55;
  overflow-x:hidden;
  overflow-x:clip;
  overflow-wrap:break-word;   /* very long unbroken strings can't push the layout */
  -webkit-font-smoothing:antialiased;
}

/* subtle paper grain */
body::before{
  content:"";
  position:fixed; inset:0; z-index:-1; pointer-events:none;
  opacity:.05;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- type ---- */
.eyebrow{
  font-family:var(--font-mono);
  text-transform:uppercase;
  letter-spacing:.28em;
  font-size:13px;
  font-weight:500;
  color:var(--muted);
  margin:0;
}
.display{
  font-family:var(--font-display);
  font-weight:700;
  line-height:.96;
  letter-spacing:-.01em;
  margin:0;
}
h1,h2,h3{ font-family:var(--font-display); font-weight:600; margin:0; line-height:1.02; letter-spacing:-.01em; }
p{ margin:0 0 1em; }
a{ color:inherit; }

.section{ padding:96px 24px; }
.wrap{ max-width:var(--maxw); margin:0 auto; }
.center{ text-align:center; }
.lead{ font-size:20px; color:var(--muted); line-height:1.5; }

.section-head{ max-width:720px; margin:0 auto 56px; text-align:center; }
.section-head h2{ font-size:clamp(34px,5vw,52px); margin:14px 0 16px; }
.section-head p{ font-size:19px; color:var(--muted); }

/* ---- chunky primitives ---- */
.card{
  background:var(--paper);
  border:var(--bw) solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow-card);
}

.btn{
  --bg:var(--paper);
  display:inline-flex; align-items:center; gap:10px;
  font-family:var(--font-display); font-weight:600; font-size:17px;
  text-decoration:none; color:var(--ink);
  background:var(--bg);
  border:var(--bw) solid var(--line);
  border-radius:var(--radius-pill);
  padding:15px 26px;
  box-shadow:var(--shadow-hard);
  cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease, background .12s ease;
  white-space:nowrap;
}
.btn:hover{ transform:translateY(-2px); box-shadow:0 7px 0 var(--ink); }
.btn:active{ transform:translateY(3px); box-shadow:0 1px 0 var(--ink); }
.btn-coral{ --bg:var(--coral); color:#fff; }
.btn-coral:hover{ --bg:#ff6e6e; }
.btn-gold{ --bg:var(--gold); }
.btn-lg{ font-size:19px; padding:18px 32px; }

.chip{
  display:inline-flex; align-items:center; gap:8px;
  font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.12em;
  font-size:12px; font-weight:500;
  background:var(--paper); border:var(--bw) solid var(--line);
  border-radius:10px; padding:7px 12px;
  box-shadow:var(--shadow-hard-sm);
}
.chip b{ font-family:var(--font-display); font-weight:700; font-size:14px; }

/* mono label pill like the in-game organelle tags */
.tag{
  font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.1em;
  font-size:11px; font-weight:500;
  background:var(--paper-2); border:2.5px solid var(--line);
  border-radius:8px; padding:4px 9px; display:inline-block;
}

/* pip row */
.pips{ display:inline-flex; gap:4px; }
.pip{ width:13px; height:13px; border:2.5px solid var(--ink); border-radius:4px; background:var(--paper-2); }
.pip.on{ background:var(--gold); }

/* ---- nav ---- */
.nav{
  position:sticky; top:0; z-index:50;
  backdrop-filter:blur(8px);
  background:rgba(241,231,211,.72);
  border-bottom:var(--bw) solid var(--line);
}
.nav-inner{
  max-width:var(--maxw); margin:0 auto;
  display:flex; align-items:center; gap:18px;
  padding:13px 24px;
}
.brand{
  display:flex; align-items:center; gap:11px;
  font-family:var(--font-display); font-weight:700; font-size:20px;
  letter-spacing:-.01em; text-decoration:none; color:var(--ink);
}
.brand .mark{
  width:34px; height:34px; flex:0 0 auto;
  border:3px solid var(--ink); border-radius:11px;
  background:var(--blue);
  display:grid; place-items:center;
  box-shadow:var(--shadow-hard-sm);
}
.brand .mark span{ width:14px; height:14px; border-radius:50%; background:var(--purple); border:2.5px solid var(--ink); }
.nav-links{ display:flex; gap:6px; margin-left:auto; align-items:center; }
.nav-links a{
  font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.14em;
  font-size:12px; font-weight:500; text-decoration:none; color:var(--ink);
  padding:9px 13px; border-radius:10px; transition:background .15s;
}
.nav-links a:hover{ background:rgba(24,23,21,.07); }
.nav-cta{ margin-left:4px; }

/* ---- mobile nav ---- */
.nav-toggle{
  display:none;
  width:44px; height:44px; padding:0; margin-left:auto;
  background:var(--paper); color:var(--ink);
  border:var(--bw) solid var(--ink); border-radius:12px;
  box-shadow:var(--shadow-hard-sm);
  cursor:pointer;
  align-items:center; justify-content:center; flex-direction:column; gap:5px;
}
.nav-toggle:active{ transform:translateY(2px); box-shadow:0 1px 0 var(--ink); }
.nav-toggle span{
  display:block; width:20px; height:2.6px; background:var(--ink); border-radius:2px;
  transition:transform .22s ease, opacity .15s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1){ transform:translateY(7.6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2){ opacity:0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3){ transform:translateY(-7.6px) rotate(-45deg); }

.mobile-drawer{ display:none; }
@media (max-width:620px){
  .mobile-drawer{
    display:block;
    position:absolute; top:100%; left:0; right:0; z-index:49;
    background:var(--paper);
    border-bottom:var(--bw) solid var(--ink);
    box-shadow:var(--shadow-card);
    padding:14px 22px 20px;
    transform:translateY(-10px);
    opacity:0; visibility:hidden; pointer-events:none;
    transition:transform .22s ease, opacity .22s ease, visibility 0s .22s;
  }
  .mobile-drawer.open{
    transform:none; opacity:1; visibility:visible; pointer-events:auto;
    transition:transform .22s ease, opacity .22s ease, visibility 0s;
  }
  .mobile-drawer a:not(.btn){
    display:block;
    font-family:var(--font-display); font-weight:600; font-size:18px;
    text-decoration:none; color:var(--ink);
    padding:14px 4px;
    border-bottom:2px dashed rgba(24,23,21,.18);
  }
  .mobile-drawer a:not(.btn):last-of-type{ border-bottom:none; }
  .mobile-drawer .btn{
    display:flex; width:100%; justify-content:center; margin-top:14px;
  }
}

/* ---- footer ---- */
.footer{
  border-top:var(--bw) solid var(--line);
  background:var(--paper-sink);
  padding:60px 24px 40px;
}
.footer-grid{
  max-width:var(--maxw); margin:0 auto;
  display:flex; flex-wrap:wrap; gap:40px; align-items:flex-start;
  justify-content:space-between;
}
.footer-links{ display:flex; gap:34px; flex-wrap:wrap; }
.footer-col h4{
  font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.16em;
  font-size:11px; color:var(--muted); margin:0 0 12px; font-weight:500;
}
.footer-col a{
  display:block; text-decoration:none; color:var(--ink);
  font-size:15px; padding:4px 0; opacity:.85;
}
.footer-col a:hover{ opacity:1; }
.footer-bottom{
  max-width:var(--maxw); margin:34px auto 0; padding-top:22px;
  border-top:2px dashed rgba(24,23,21,.2);
  display:flex; flex-wrap:wrap; gap:12px; justify-content:space-between;
  font-size:13px; color:var(--muted);
}

/* ---- phone frame ---- */
.phone{
  position:relative;
  width:var(--pw,270px);
  aspect-ratio:1284/2778;
  border:5px solid var(--ink);
  border-radius:42px;
  background:#000;
  box-shadow:0 8px 0 var(--ink), 0 30px 50px -20px rgba(40,30,15,.55);
  overflow:hidden;
  flex:0 0 auto;
}
.phone img{ width:100%; height:100%; object-fit:cover; display:block; }
.phone::after{ /* notch */
  content:""; position:absolute; top:0; left:50%; transform:translateX(-50%);
  width:34%; height:20px; background:var(--ink);
  border-radius:0 0 14px 14px; z-index:2;
}

/* ---- reveal ---- */
.reveal{ opacity:0; transform:translateY(22px); transition:opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in{ opacity:1; transform:none; }
.reveal[data-d="1"]{ transition-delay:.08s; }
.reveal[data-d="2"]{ transition-delay:.16s; }
.reveal[data-d="3"]{ transition-delay:.24s; }
.reveal[data-d="4"]{ transition-delay:.32s; }
.reveal[data-d="5"]{ transition-delay:.40s; }

@media (prefers-reduced-motion:reduce){
  .reveal{ opacity:1; transform:none; transition:none; }
  html{ scroll-behavior:auto; }
  .breathe, .bob, .shimmer{ animation:none !important; }
}

/* ---- the cell ---- */
.cell-svg{ width:100%; height:auto; display:block; overflow:visible; }
.cell-breathe{ transform-box:fill-box; transform-origin:center; animation:breathe 6.5s ease-in-out infinite; }
.cell-bob{ transform-box:fill-box; transform-origin:center; animation:bob 5s ease-in-out infinite; }
@keyframes breathe{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.022); } }
@keyframes bob{ 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-4px); } }

/* ---- generic grids ---- */
.grid{ display:grid; gap:22px; }
.cols-2{ grid-template-columns:repeat(2,1fr); }
.cols-3{ grid-template-columns:repeat(3,1fr); }
.cols-4{ grid-template-columns:repeat(4,1fr); }

@media (max-width:900px){
  .cols-3,.cols-4{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width:620px){
  .section{ padding:64px 18px; }
  .cols-2,.cols-3,.cols-4{ grid-template-columns:1fr; }
  .nav-links{ display:none; }
  .nav-cta{ display:none; }            /* lives in the drawer on mobile */
  .nav-toggle{ display:flex; }
}
