/* ---------- Tokens ---------- */
:root {
  --page: #fafafa;
  --bg: #ffffff;
  --ink: #222224;
  --muted: #5d5d63;
  --accent: #ff5410;
  --accent-2: #ff9a3c;
  --accent-ink: #ffffff;
  --echo: #fde8de;
  --echo-stroke: #f8cdb9;
  --line: #e9e6e4;
  --dots: #e3e1df;
  --card-bg: #ffffff;
  --card-edge: #f6d6c6;
  --glow: rgba(255, 84, 16, 0.32);

  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --nav-h: 76px;

  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #100e0d;
    --bg: #161311;
    --ink: #f3efec;
    --muted: #aaa3a0;
    --echo: #2b1a12;
    --echo-stroke: #4b2817;
    --line: #2c2725;
    --dots: #2a2522;
    --card-bg: #1e1916;
    --card-edge: #44291c;
    --glow: rgba(255, 84, 16, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #100e0d;
  --bg: #161311;
  --ink: #f3efec;
  --muted: #aaa3a0;
  --echo: #2b1a12;
  --echo-stroke: #4b2817;
  --line: #2c2725;
  --dots: #2a2522;
  --card-bg: #1e1916;
  --card-edge: #44291c;
  --glow: rgba(255, 84, 16, 0.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: inherit; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px)); }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--page);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 14px 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 2.5vw, 1.25rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 60;
  background: var(--bg);
}

.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark { width: 44px; height: 31px; }
.brand-word { font-weight: 900; letter-spacing: 0.14em; font-size: 1.05rem; }

.nav-links { display: flex; gap: 2.2rem; font-weight: 500; font-size: 0.98rem; }
.nav-links a { position: relative; padding: 0.3rem 0; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.nav-links a:hover::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.pill {
  display: inline-flex; align-items: center;
  height: 38px; padding: 0 1rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-weight: 500; font-size: 0.95rem;
  background: var(--bg);
  transition: border-color .2s ease;
}
.pill:hover { border-color: var(--accent); }

.menu-btn {
  display: none;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.menu-btn span { width: 16px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s ease; }
.menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* ---------- Frame ---------- */
.frame {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg);
  border-left: 1px dashed var(--line);
  border-right: 1px dashed var(--line);
  overflow: hidden;
}

/* ---------- Hero ---------- */
.hero {
  display: flex; flex-direction: column; align-items: center;
  padding: clamp(1rem, 3vw, 1.5rem) 0 clamp(4rem, 9vw, 7rem);
  text-align: center;
}

.stage {
  position: relative;
  width: 100%;
  container-type: inline-size;
  padding: 7cqw 0 9cqw;
  display: flex; justify-content: center;
}

.halftone {
  position: absolute; inset: 12% 2%;
  background-image: radial-gradient(var(--accent) 0.9px, transparent 1.3px);
  background-size: 6px 6px;
  opacity: 0.2;
  -webkit-mask-image: radial-gradient(ellipse 55% 45% at 50% 50%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 55% 45% at 50% 50%, #000 25%, transparent 75%);
  pointer-events: none;
}

.word-stack {
  position: relative;
  font-size: 20cqw; /* JS refines this to fit the width exactly */
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.8;
  display: flex; flex-direction: column; align-items: center;
  user-select: none;
}
.word-stack span { display: inline-block; padding: 0.18em 0.06em; margin: -0.18em 0; white-space: nowrap; }
.word-stack .main { color: var(--accent); position: relative; z-index: 2; }
.word-stack .echo {
  color: var(--echo);
  -webkit-text-stroke: max(1px, 0.008em) var(--echo-stroke);
  z-index: 1;
}
.word-stack .echo-top { -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), #000 70%); mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), #000 70%); }
.word-stack .echo-bottom { -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.55), #000 70%); mask-image: linear-gradient(to top, rgba(0,0,0,.55), #000 70%); }

/* Connecting dashed lines */
.links {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 3; overflow: visible; pointer-events: none;
  opacity: 0;
}
.links path {
  fill: none; stroke: var(--accent);
  stroke-width: 1.3; stroke-dasharray: 3 4;
  animation: march 1.6s linear infinite;
}
.links rect { fill: var(--accent); }
@keyframes march { to { stroke-dashoffset: -14; } }

/* Floating cards */
.card {
  --cs: clamp(56px, 8.4cqw, 104px);
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: var(--cs); height: var(--cs);
  z-index: 4;
  transform:
    translate(-50%, -50%)
    translate(var(--tx, 0px), var(--ty, 0px))
    rotate(calc(var(--r) * 1deg + var(--rot, 0deg)));
  will-change: transform;
}
.card-in {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  border-radius: 22%;
  background:
    radial-gradient(circle at 50% 62%, var(--glow), transparent 68%),
    var(--card-bg);
  border: 1px solid var(--card-edge);
  box-shadow:
    0 1px 0 rgba(255,255,255,.6) inset,
    0 14px 30px -16px var(--glow),
    0 2px 6px -2px rgba(0,0,0,.08);
}
.tile {
  width: 56%; height: 56%;
  border-radius: 24%;
  display: grid; place-items: center;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,.45);
}
.tile svg {
  width: 64%; height: 64%;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.tile svg .fill { fill: currentColor; stroke: none; }
.tamil { font-family: "Noto Sans Tamil", "Latha", "Tamil Sangam MN", sans-serif; font-weight: 700; font-size: calc(var(--cs) * 0.25); line-height: 1; transform: translateY(-4%); }

.tile-black  { background: #1a1a1a; color: #fff; }
.tile-white  { background: #fff; color: #1a1a1a; border: 1px solid #ececec; }
.tile-lime   { background: #d6ff1f; color: #1a1a1a; }
.tile-blue   { background: linear-gradient(140deg, #1f3fbf, #4f8dff); color: #fff; }
.tile-violet { background: linear-gradient(135deg, #ff4f86, #ff7a3d 45%, #8b5cff); color: #fff; }
.tile-orange { background: linear-gradient(150deg, #ff7a2f, var(--accent)); color: #fff; }

/* Lede + CTA */
.lede {
  max-width: 38rem;
  margin-top: 1.5rem;
  padding: 0 1.25rem;
  font-size: clamp(1rem, 1.6vw, 1.08rem);
  line-height: 1.55;
  color: var(--ink);
}
.lede em { font-style: normal; font-weight: 600; }

.cta {
  margin-top: 1.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; padding: 0 1.6rem;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 1.02rem;
  box-shadow: 0 10px 24px -12px var(--glow);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -14px var(--accent); background: #ff6a2c; }
.cta:active { transform: translateY(0); }

/* ---------- Build section ---------- */
.build {
  padding: clamp(3rem, 7vw, 5rem) clamp(1rem, 3vw, 1.75rem) clamp(4rem, 8vw, 6rem);
  text-align: center;
}
.build h2, .foot-cta h2 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.sub {
  margin: 1rem auto 0;
  max-width: 44rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.5;
}
.tiers {
  margin-top: clamp(4rem, 8vw, 5.5rem);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 1.25rem);
}
.tier {
  position: relative;
  text-align: left;
  padding: 3.2rem 1.6rem 1.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
/* the little roof peak on top of each card */
.tier::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 62px; height: 62px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--bg);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-top-left-radius: 6px;
}
.tier::after {
  content: "";
  position: absolute;
  top: -6px; left: 50%;
  width: 10px; height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--accent);
  border-radius: 2px;
}
.tier h3 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 0.6rem; }
.tier p { color: var(--muted); line-height: 1.55; }

/* ---------- Footer ---------- */
.foot {
  border-top: 1px dashed var(--line);
  padding: clamp(3rem, 7vw, 5rem) clamp(1rem, 3vw, 1.75rem) 2rem;
  text-align: center;
}
.foot-cta { display: flex; flex-direction: column; align-items: center; }
.cta-small { height: 46px; font-size: 0.98rem; margin-top: 1.6rem; }
.foot-meta {
  margin-top: clamp(3rem, 7vw, 4.5rem);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem;
  color: var(--muted); font-size: 0.9rem;
}

/* ---------- Entrance (one orchestrated moment) ---------- */
.is-ready .word-stack .main  { animation: rise .9s cubic-bezier(.2,.8,.2,1) both; }
.is-ready .word-stack .echo  { animation: fade 1s ease .25s both; }
.is-ready .card-in           { animation: pop .7s cubic-bezier(.3,1.5,.5,1) both; animation-delay: calc(.45s + var(--i, 0) * 80ms); }
.is-ready .links             { animation: fade .8s ease 1.1s forwards; }
.is-ready .lede, .is-ready .hero .cta { animation: fade .8s ease .6s both; }

@keyframes rise { from { opacity: 0; transform: translateY(14%) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop  { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .tiers { grid-template-columns: 1fr; gap: 3rem; max-width: 30rem; margin-inline: auto; }
}

@media (max-width: 720px) {
  :root { --nav-h: 64px; }
  .menu-btn { display: inline-flex; }
  .pill { display: none; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    padding: 0.5rem 1rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }
  .nav-links.open { transform: none; opacity: 1; visibility: visible; }
  .nav-links a { padding: 0.9rem 0.25rem; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a::after { display: none; }

  .frame { border-left: 0; border-right: 0; }
  .stage { padding: 16cqw 0 18cqw; }
  .card { --cs: clamp(42px, 12.5cqw, 66px); }
  .card.opt { display: none; }
  .halftone { inset: 18% 0; }
  .lede { margin-top: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .links path { animation: none; }
  .is-ready .word-stack .main,
  .is-ready .word-stack .echo,
  .is-ready .card-in,
  .is-ready .lede,
  .is-ready .hero .cta { animation: none; }
  .links { opacity: 1; }
  .is-ready .links { animation: none; opacity: 1; }
}
