:root {
  --bg: #ffffff;
  --bg-alt: #f5f8fa;
  --text: #2b3a42;
  --muted: #667781;
  --border: #e1e8ec;
  --accent: #356a80;
  --accent-ink: #ffffff;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #0f171b;
  --bg-alt: #162026;
  --text: #dbe5ea;
  --muted: #8da0aa;
  --border: #25333b;
  --accent: #6fb3cf;
  --accent-ink: #0f171b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.7 var(--sans);
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }
.small { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .75rem; font-weight: 500; }
.muted { color: var(--muted); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font: 700 1.2rem var(--mono); color: var(--text); }
.logo span { color: var(--accent); }
.nav nav { display: flex; align-items: center; gap: 20px; font-size: .9rem; }
.nav nav a { color: var(--muted); }
.nav nav a:hover { color: var(--text); text-decoration: none; }
#theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem;
}
#theme-toggle:hover { border-color: var(--accent); }

/* hero */
.hero { padding: 110px 20px 80px; }
.eyebrow { color: var(--accent); font-size: .9rem; margin: 0 0 12px; }
h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); line-height: 1.1; margin: 0 0 20px; letter-spacing: -.02em; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }

/* sections */
section.wrap { padding-top: 56px; padding-bottom: 56px; }
h2 { font-size: 1.7rem; margin: 0 0 28px; letter-spacing: -.01em; }
h2 .mono { color: var(--accent); font-size: 1rem; font-weight: 500; margin-right: 6px; }
h3 { margin: 0 0 6px; font-size: 1.05rem; }

/* buttons */
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 8px;
  border: 1px solid var(--border); color: var(--text); font-weight: 500; font-size: .95rem;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { opacity: .9; }

/* about */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.chips li {
  font: 400 .8rem var(--mono); padding: 4px 12px; border-radius: 999px;
  background: var(--bg-alt); border: 1px solid var(--border);
}
.chips em { color: var(--muted); }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 4px; padding: 20px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.card h3 { font-family: var(--mono); color: var(--accent); }
.card p { margin: 0 0 12px; font-size: .92rem; color: var(--muted); line-height: 1.55; flex: 1; }
.meta { font-size: .75rem; color: var(--muted); }
.more { margin-top: 24px; font-size: .95rem; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { display: grid; grid-template-columns: 170px 1fr; gap: 16px; padding: 0 0 28px 24px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
}
.when { font-size: .8rem; color: var(--muted); padding-top: 4px; }
.timeline p { margin: 0; color: var(--muted); font-size: .95rem; }

/* footer */
.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-top: 28px; padding-bottom: 40px; border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--muted);
}

@media (max-width: 680px) {
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  .hero { padding-top: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* timeline bullets */
.timeline ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.timeline ul li { display: list-item; padding: 0 0 4px; grid-template-columns: none; position: static; }
.timeline ul li::before { content: none; }
.chips + .small { margin-top: 20px; }

/* about / story page + language toggle */
html[data-lang="en"] [lang="ta"],
html[data-lang="ta"] [lang="en"] { display: none; }
html[data-lang="ta"] body { font-family: "Noto Sans Tamil", var(--sans); }
.pill {
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; font: 500 .85rem var(--sans);
}
.pill:hover { border-color: var(--accent); }
.nav nav a[aria-current="page"] { color: var(--text); }
.story { padding-top: 90px; padding-bottom: 60px; }
.story h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); }
.steps { list-style: none; margin: 40px 0 0; padding: 0 0 0 0; border-left: 2px solid var(--border); }
.steps > li { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 0 0 32px 24px; position: relative; }
.steps > li::before {
  content: ""; position: absolute; left: -9px; top: 0px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
}
.steps h2 { font-size: 1.15rem; margin: 0 0 6px; }
.steps p { margin: 0; color: var(--muted); }
@media (max-width: 680px) {
  .steps > li { grid-template-columns: 1fr; gap: 0; }
}

.family { margin-top: 32px; padding: 20px 24px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; }
.family h2 { font-size: 1.15rem; margin: 0 0 8px; }
.family p { margin: 0; color: var(--muted); }
.steps figure { margin: 16px 0 0; }
.steps img { width: 100%; max-width: 520px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.steps figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.note {
  position: relative; margin: 48px 0 0; padding: 44px 36px 28px;
  background: linear-gradient(135deg, var(--bg-alt), color-mix(in srgb, var(--accent) 10%, var(--bg-alt)));
  border: 1px solid var(--border); border-left: 5px solid var(--accent); border-radius: 14px;
}
.note::before {
  content: "\201C"; position: absolute; top: -6px; left: 22px;
  font: 700 5.5rem/1 Georgia, "Times New Roman", serif; color: var(--accent); opacity: .35;
}
.note p { margin: 0; font-size: 1.2rem; line-height: 1.7; font-style: italic; color: var(--text); }
.note cite { display: block; margin-top: 18px; font: 500 .9rem var(--mono); font-style: normal; color: var(--accent); }
.note cite::before { content: "\2014\00a0"; }

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; max-width: 640px; }
.gallery figure { margin: 0; }
.gallery img { max-width: none; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.steps .cap { font-size: .82rem; margin-top: 6px; }
.steps figure.tall img { max-width: 340px; }
@media (max-width: 680px) { .gallery { grid-template-columns: 1fr; } }

/* company logos in timeline */
.role-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.role-head h3 { margin: 0; }
.co-logo {
  height: 44px; width: auto; max-width: 96px; flex: none; object-fit: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
}

.gallery.g3 img { aspect-ratio: 3 / 4; object-position: center 25%; }
.gallery.g3 figure:nth-child(3) { grid-column: 1 / -1; }
.gallery.g3 figure:nth-child(3) img { aspect-ratio: 4 / 3; object-position: center; }

.video { position: relative; aspect-ratio: 16 / 9; max-width: 640px; margin-top: 16px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-alt); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* banner */
.banner { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); margin-bottom: 36px; }
.hero { padding-top: 40px; }
.story { padding-top: 40px; }

/* keep header stable when switching language */
.nav, .nav nav { font-family: var(--sans); }
.pill { min-width: 84px; text-align: center; font-family: var(--sans); }

/* ---- scroll animations ---- */
.steps, .timeline { position: relative; --p: 0; }
.steps::after, .timeline::after {
  content: ""; position: absolute; left: -2px; top: 0; width: 2px;
  height: calc(var(--p) * 100%); background: var(--accent); border-radius: 2px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.js .steps > li, .js .timeline > li, .js .card, .js .family, .js .note,
.js .about-grid > *, .js section.wrap > h2 {
  opacity: 0; transform: translateY(26px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
}
.js .steps > li.in, .js .timeline > li.in, .js .card.in, .js .family.in, .js .note.in,
.js .about-grid > .in, .js section.wrap > h2.in { opacity: 1; transform: none; }
.js .card.in { transition: transform .15s, border-color .15s, opacity .6s ease; }
.js .card.in:hover { transform: translateY(-3px); }

/* timeline dots pop in */
.js .steps > li::before, .js .timeline > li::before { transform: scale(0); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1) .15s; }
.js .steps > li.in::before, .js .timeline > li.in::before { transform: scale(1); }

/* hero entrance */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.hero > *, .story > .banner, .story > .eyebrow, .story > h1, .story > div[lang] { animation: fadeUp .8s cubic-bezier(.2, .7, .2, 1) both; }
.hero > :nth-child(2) { animation-delay: .08s; } .hero > :nth-child(3) { animation-delay: .16s; }
.hero > :nth-child(4) { animation-delay: .24s; } .hero > :nth-child(5) { animation-delay: .32s; }

@media (prefers-reduced-motion: reduce) {
  .js .steps > li, .js .timeline > li, .js .card, .js .family, .js .note,
  .js .about-grid > *, .js section.wrap > h2 { opacity: 1; transform: none; }
  .js .steps > li::before, .js .timeline > li::before { transform: none; }
  .hero > *, .story > * { animation: none; }
  .steps::after, .timeline::after { transition: none; }
}

/* ---- mild diamond lattice background (fixed, doesn't scroll) ---- */
:root {
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='134' height='134'%3E%3Cpath d='M67 6 128 67 67 128 6 67Z' fill='none' stroke='%23356a80' stroke-opacity='.09'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='134' height='134'%3E%3Cpath d='M67 6 128 67 67 128 6 67Z' fill='none' stroke='%236fb3cf' stroke-opacity='.045'/%3E%3C/svg%3E");
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--pattern);
}

/* ---- social links ---- */
.socials { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.socials a {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px; font-size: .92rem; font-weight: 500;
  color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  transition: border-color .15s, transform .15s, color .15s;
}
.socials a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.socials.mini { margin: 0; gap: 8px; }
.socials.mini a { width: 36px; height: 36px; padding: 0; justify-content: center; }
.socials.mini svg { width: 16px; height: 16px; }

/* social links, grouped by handle (one line on desktop) */
.socials.groups { flex-wrap: wrap; gap: 12px; }
.socials.groups li {
  display: flex; align-items: center; gap: 6px; padding: 5px 16px 5px 5px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
}
.socials.groups .ic {
  width: 34px; height: 34px; padding: 0; justify-content: center; gap: 0;
  background: transparent; border: 1px solid var(--border); border-radius: 50%;
}
.socials.groups .ic:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.socials.groups .handle { margin-left: 6px; font-size: .92rem; font-weight: 500; color: var(--text); white-space: nowrap; }

/* pull-quote inside a journey step */
.steps .pull {
  position: relative; margin: 16px 0 0; padding: 14px 18px 14px 26px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-alt));
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  font-style: italic; color: var(--text); line-height: 1.6;
}
.steps .pull::before {
  content: "\201C"; position: absolute; left: 6px; top: -2px;
  font: 700 2.2rem/1 Georgia, serif; color: var(--accent); opacity: .5; font-style: normal;
}
.steps .pull[lang="ta"] { font-style: normal; font-weight: 500; }

/* ---- mobile menu ---- */
.nav nav .links { display: flex; align-items: center; gap: 20px; }
.menu-btn {
  display: none; place-items: center; width: 34px; height: 34px; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 50%; color: var(--text);
}
.menu-btn:hover { border-color: var(--accent); }
@media (max-width: 680px) {
  .menu-btn { display: grid; }
  .nav nav { gap: 10px; }
  .nav nav .links {
    display: none; position: absolute; top: 56px; left: 0; right: 0; z-index: 20;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px 20px 14px;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: 0 14px 30px rgba(0, 0, 0, .18);
  }
  .nav.open nav .links { display: flex; }
  .nav nav .links a { padding: 13px 4px; font-size: 1rem; color: var(--text); border-bottom: 1px solid var(--border); }
  .nav nav .links a:last-child { border-bottom: 0; }
}

/* footer keeps its own font in both languages */
.foot, .foot a { font-family: var(--sans); }
