/* Pallayi Foundry global styles.
   Themes: dark (default), light, bi-tonal.
   Type: Sofia Sans (body and display), Instrument Serif italic accents, JetBrains Mono for small utility labels. */

/* Metric-matched local fallback for Sofia Sans (web font loads with display=swap).
   Keeps text from reflowing when the real font arrives. Local font only, no request. */
@font-face {
  font-family: "Sofia Sans Fallback";
  src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  font-weight: 300 500;
  size-adjust: 96.2%;
  ascent-override: 93.6%;
  descent-override: 31.2%;
  line-gap-override: 0%;
}

:root {
  /* Default = dark theme */
  --bg: #0a0b0d;
  --bg-elev: #111317;
  --bg-strip: #0c0e12;
  --ink: #e8eaee;
  --ink-2: #94a3b8;
  --ink-3: #5b6470;
  --hair: rgba(148, 163, 184, 0.10);
  --hair-2: rgba(148, 163, 184, 0.18);
  --hair-strong: rgba(148, 163, 184, 0.32);
  --accent: oklch(0.80 0.13 215);
  --accent-ink: oklch(0.86 0.13 215);
  --accent-soft: oklch(0.80 0.13 215 / 0.12);
  --accent-glow: oklch(0.80 0.13 215 / 0.35);

  --font-display: "Sofia Sans", "Sofia Sans Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Sofia Sans", "Sofia Sans Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;
  --display-weight: 300;
  --display-italic: normal;
  --display-tracking: -0.03em;

  --maxw: 1440px;
  --frame-w: 1280px;
  --pad-x: clamp(20px, 4vw, 56px);
  /* Shared logo size: header and footer logos both use .brand-mark, so they cannot drift. */
  --logo-size: 44px;
}

[data-theme="light"] {
  --bg: #fafaf9;
  --bg-elev: #ffffff;
  --bg-strip: #f4f4f2;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #94a3b8;
  --hair: rgba(15, 23, 42, 0.08);
  --hair-2: rgba(15, 23, 42, 0.14);
  --hair-strong: rgba(15, 23, 42, 0.32);
  --accent: oklch(0.55 0.13 230);
  --accent-ink: oklch(0.45 0.14 230);
  --accent-soft: oklch(0.55 0.13 230 / 0.10);
  --accent-glow: oklch(0.55 0.13 230 / 0.18);
}

/* Bi-tonal: a section can opt into the light palette with data-tone. */
[data-tone="light"] {
  --bg: #fafaf9;
  --bg-elev: #ffffff;
  --bg-strip: #f4f4f2;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #94a3b8;
  --hair: rgba(15, 23, 42, 0.08);
  --hair-2: rgba(15, 23, 42, 0.14);
  --hair-strong: rgba(15, 23, 42, 0.32);
  --accent: oklch(0.55 0.13 230);
  --accent-ink: oklch(0.45 0.14 230);
  --accent-soft: oklch(0.55 0.13 230 / 0.10);
  --accent-glow: oklch(0.55 0.13 230 / 0.18);
}

[data-font="grotesk"] {
  --font-display: "Sofia Sans", "Sofia Sans Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Sofia Sans", "Sofia Sans Fallback", ui-sans-serif, system-ui, sans-serif;
  --display-weight: 300;
  --display-italic: normal;
  --display-tracking: -0.03em;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-glow); color: var(--ink); }

/* Layout: one column */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad-x); }

main, .footer, .portal-foot { width: 100%; max-width: var(--frame-w); margin-inline: auto; }
.section {
  background: var(--bg);
  color: var(--ink);
  position: relative;
}
.section + .section { border-top: 1px solid var(--hair-2); }

/* Side rails, only where the column sits inside the viewport. */
@media (min-width: 1321px) {
  main, .footer, .portal-foot { border-inline: 1px solid var(--hair-2); }
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair-2);
}
.nav-inner {
  max-width: var(--frame-w); margin: 0 auto;
  display: flex; align-items: stretch;
}
@media (min-width: 1321px) { .nav-inner { border-inline: 1px solid var(--hair-2); } }
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-size: 13px;
  text-transform: uppercase;
}
.nav-brand { padding: 14px 22px; border-right: 1px solid var(--hair-2); }
.brand-mark {
  width: var(--logo-size); height: var(--logo-size);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--ink);
}
.brand-mark svg { width: 100%; height: 100%; display: block; overflow: visible; }

.nav-links {
  display: flex; align-items: stretch;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.nav-links a {
  display: flex; align-items: center;
  padding: 0 18px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--accent-soft); }

.nav-actions { display: flex; align-items: stretch; margin-left: auto; }
.nav-actions .btn { height: auto; border-width: 0 0 0 1px; border-color: var(--hair-2); padding: 0 22px; }
.nav-actions .btn-primary { border-color: var(--accent); }

/* Theme toggle: cycles system, dark, light. */
.nav-actions .theme-toggle { align-self: center; margin: 0 16px; }
.theme-toggle {
  appearance: none;
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--hair-strong);
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
.theme-toggle .tt-icon { display: none; align-items: center; justify-content: center; }
.theme-toggle[data-mode="system"] .tt-icon.system,
.theme-toggle[data-mode="dark"]   .tt-icon.dark,
.theme-toggle[data-mode="light"]  .tt-icon.light {
  display: inline-flex;
}
.theme-toggle[data-mode="dark"],
.theme-toggle[data-mode="light"] { color: var(--accent-ink); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px;
  font-family: var(--font-body);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--hair-strong);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: var(--bg);
}
.btn .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.btn-lg { height: 48px; padding: 0 22px; justify-content: center; }


/* Typography */
.h1 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: clamp(54px, 7.4vw, 112px);
  line-height: 0.95;
  letter-spacing: var(--display-tracking);
  margin: 0 0 32px;
  color: var(--ink);
  text-wrap: balance;
}
.h1 em {
  font-style: italic;
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
  font-weight: 400;
  color: var(--accent-ink);
}
.h1 em, .foot-cta h2 em { padding-left: 0.12em; }
.lead {
  font-family: var(--font-body);
  font-size: clamp(16px, 1.3vw, 20px);
  line-height: 1.6;
  max-width: 52ch;
  color: var(--ink-2);
  font-weight: 400;
  margin: 0;
}
.textlink {
  font-size: 15px;
  color: var(--ink-2);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
  transition: color 0.2s ease;
}
.textlink:hover { color: var(--accent-ink); }


.not-found { padding: clamp(80px, 12vw, 160px) var(--pad-x); }

/* Hero */
.hero { position: relative; }
.hero-body {
  position: relative;
  display: grid; grid-template-columns: 1.55fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  padding: clamp(56px, 9vw, 128px) var(--pad-x) clamp(48px, 6vw, 88px);
}
.hero-links { display: flex; flex-wrap: wrap; gap: 14px 32px; margin-top: 40px; }
.hero-mark {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%; max-width: 420px; justify-self: end;
  /* No frame or card: the mark sits directly in the hero glow, which fades
     to transparent before it reaches the edge of the box. */
  background: radial-gradient(ellipse 70% 70% at 50% 50%, var(--accent-soft), transparent 70%);
  display: grid; place-items: center;
  color: var(--ink);
}
.hero-mark-glyph { position: relative; width: 56%; aspect-ratio: 1; }
.hero-mark-glyph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.hero-facts {
  position: relative;
  margin: 0;
  padding: 0 var(--pad-x) clamp(48px, 6vw, 88px);
  max-width: calc(68ch + 2 * var(--pad-x));
  font-size: 16px; line-height: 1.6;
  color: var(--ink-2);
}

/* Contiguous cells (no doubled borders at any column count) */
.cells { overflow: hidden; }
.cells-grid { display: grid; margin: 0 0 -1px -1px; }
.cells-grid > * {
  border-left: 1px solid var(--hair-2);
  border-bottom: 1px solid var(--hair-2);
  background: var(--bg);
  display: flex; flex-direction: column;
  min-width: 0;
  transition: background 0.3s ease;
}
.cells-grid > *:hover { background: var(--bg-strip); }
.card-body { padding: 24px 20px 28px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-body h3, .card-body h4, .card-body h5 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}
.card-body p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* Practice: four disciplines, set in type only */
.practice { grid-template-columns: repeat(4, 1fr); }
.pcard .card-body { padding-top: 40px; padding-bottom: 48px; }
.pcard h3 { font-size: clamp(24px, 2.1vw, 30px); text-wrap: balance; }
.pcard .card-body p { max-width: 38ch; }

.sec-title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1;
  letter-spacing: var(--display-tracking);
  margin: 0;
  padding: clamp(48px, 7vw, 96px) var(--pad-x) clamp(24px, 3vw, 40px);
}

/* Section heads */
.sec-head {
  display: grid; grid-template-columns: 1.6fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: end;
  padding: clamp(56px, 8vw, 112px) var(--pad-x) clamp(40px, 5vw, 64px);
}
.sec-head h2 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: clamp(36px, 5.2vw, 76px);
  line-height: 1;
  letter-spacing: var(--display-tracking);
  margin: 0;
  text-wrap: balance;
}
.sec-head h2 em {
  font-family: "Instrument Serif", serif;
  font-style: italic; font-weight: 400;
  color: var(--accent-ink);
}
.sec-head-side { display: flex; flex-direction: column; gap: 16px; }
.sec-head-side p { font-size: 16px; line-height: 1.6; color: var(--ink-2); margin: 0; max-width: 56ch; }
.sec-head-side .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* Shipped work */
.portfolio { grid-template-columns: repeat(3, 1fr); }
.port-card h4 { font-size: 22px; }
.port-card .card-body { gap: 10px; }
.port-sector, .port-role { margin: 0; font-size: 14px; line-height: 1.4; }
.port-card .card-body .port-sector { color: var(--ink-3); font-size: 14px; }
.port-card .card-body .port-role { color: var(--accent-ink); font-size: 14px; }
.port-card .card-body .tags { margin: auto 0 0; padding-top: 10px; font-size: 14px; color: var(--ink-3); }
.port-note {
  margin: 0;
  padding: 16px var(--pad-x);
  border-top: 1px solid var(--hair-2);
  font-size: 14px;
  color: var(--ink-3);
}

/* Why Pallayi: principles */
.pillars { grid-template-columns: repeat(3, 1fr); }
.pillar .card-body { padding-top: 56px; padding-bottom: 44px; }
.pillar h4 { font-size: clamp(22px, 2vw, 28px); }
.pillar p { font-size: 15.5px; }

/* Process: four phases */
.process { grid-template-columns: repeat(4, 1fr); }
.proc-step .card-body { padding-top: 40px; padding-bottom: 44px; }
.proc-step h5 { font-size: 24px; }
.proc-step p { max-width: 32ch; }

.foot-base {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--hair);
  font-size: 14px;
  color: var(--ink-3);
  gap: 12px;
  flex-wrap: wrap;
}
.made {
  display: inline-flex; align-items: center; gap: 8px;
}
.heart {
  display: inline-block;
  color: oklch(0.65 0.20 25);
  font-size: 13px;
  transform-origin: center;
  animation: heartbeat 2.4s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  18% { transform: scale(1.22); }
  30% { transform: scale(0.97); }
  44% { transform: scale(1.14); }
  58% { transform: scale(1); }
}

/* Footer: closing CTA plus link columns */
.footer {
  position: relative;
  background: var(--bg);
  border-top: 1px solid var(--hair-2);
  font-size: 12.5px;
  color: var(--ink-3);
}
.foot-cta {
  position: relative;
  display: grid; grid-template-columns: 1.6fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: end;
  padding: clamp(72px, 9vw, 128px) var(--pad-x) clamp(64px, 8vw, 104px);
}
.foot-cta h2 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: clamp(44px, 7vw, 104px);
  line-height: 0.95;
  letter-spacing: var(--display-tracking);
  margin: 0;
  text-wrap: balance;
}
.foot-cta h2 em { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; color: var(--accent-ink); }
.foot-cta-side { display: flex; flex-direction: column; gap: 24px; font-size: 15.5px; color: var(--ink-2); }
.foot-cta-side p { margin: 0; }
.foot-cta-side .actions { display: flex; flex-wrap: wrap; gap: 12px; }

.footer .foot-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 0;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}
.foot-col {
  padding: 32px 28px 36px;
  margin-left: -1px;
  border-left: 1px solid var(--hair-2);
  border-top: 1px solid var(--hair-2);
  min-width: 0;
}
.foot-col h6 {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 400; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 18px;
}
.foot-col a { display: block; color: var(--ink-2); padding: 4px 0; transition: color 0.2s ease; }
.foot-col a:hover { color: var(--ink); }
.foot-brand .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.foot-brand .brand-wordmark { font-size: 13px; }
.foot-brand p { margin: 14px 0 0; max-width: 32ch; font-size: 14px; line-height: 1.6; }
.foot-base-left { display: inline-flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer .foot-base { padding: 20px var(--pad-x); position: relative; background: var(--bg); }

/* Fade in on load */
.fade-up { opacity: 0; transform: translateY(12px); animation: fadeUp 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.fade-up.d1 { animation-delay: 0.05s; }
.fade-up.d2 { animation-delay: 0.18s; }
.fade-up.d3 { animation-delay: 0.30s; }
.fade-up.d4 { animation-delay: 0.42s; }
.fade-up.d5 { animation-delay: 0.54s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 1100px) {
  .nav-inner { flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; border-top: 1px solid var(--hair-2); min-height: 44px; }
  .nav-brand { border-right: 0; }
}
@media (max-width: 980px) {
  .hero-body { grid-template-columns: 1fr; }
  .hero-mark { display: none; }
  .practice, .process { grid-template-columns: repeat(2, 1fr); }
  .portfolio { grid-template-columns: repeat(2, 1fr); }
  .pillars { grid-template-columns: 1fr; }
  .sec-head, .foot-cta { grid-template-columns: 1fr; }
  .sec-head { align-items: start; }
  .footer .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  :root { --logo-size: 36px; }
  .practice, .process, .portfolio { grid-template-columns: 1fr; }
  .footer .foot-grid { grid-template-columns: 1fr; }
  .card-body { padding-inline: var(--pad-x); }
  .foot-col { padding-inline: var(--pad-x); }
}

/* Production accessibility and narrow-screen navigation. */
.skip-link { position: absolute; top: -80px; left: 20px; z-index: 100; background: var(--bg); color: var(--ink); padding: 12px; }
.skip-link:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .fade-up { opacity: 1; transform: none; }
}
@media (max-width: 420px) {
  .nav-brand { padding-inline: var(--pad-x); }
  .nav-actions .theme-toggle { margin: 0 10px; }
  .nav-actions .btn { padding-inline: 14px; font-size: 10px; }
}
