/* ========= MEDSA — world-class shared styles ========= */

:root {
  /* Palette — dark forest default */
  --bg: #0c1418;
  --bg-raised: #121c21;
  --fg: #e8e3d8;
  --fg-muted: #9aa29a;
  --line: rgba(232, 227, 216, 0.12);
  --line-strong: rgba(232, 227, 216, 0.35);
  --accent: #7fb069;
  --accent-soft: #a8c99a;
  --warm: #d4a574;
  --danger: #c8503a;

  /* Type */
  --ff-display: "Fraunces", "Times New Roman", serif;
  --ff-body: "Inter Tight", "Helvetica Neue", sans-serif;
  --ff-mono: "JetBrains Mono", "Menlo", monospace;

  /* Spacing */
  --pad-x: clamp(20px, 4vw, 64px);
  --pad-y: clamp(80px, 10vw, 160px);

  /* Radii */
  --r-sm: 2px;
  --r-md: 6px;
}

/* Light mode */
[data-theme="light"] {
  --bg: #f5f1ea;
  --bg-raised: #ffffff;
  --fg: #0c1418;
  --fg-muted: #4a5549;
  --line: rgba(12, 20, 24, 0.14);
  --line-strong: rgba(12, 20, 24, 0.35);
  --accent: #2d5a3d;
  --accent-soft: #4a7859;
  --warm: #a67c3d;
}

/* Palette: forest (default) — already above */

/* Palette: navy — brand (Navy Pekat #132D54 / Gading #F2EEE3 / Emas #C9A34A) */
[data-palette="navy"] {
  --bg: #132d54;
  --bg-raised: #1a3763;
  --fg: #f2eee3;
  --fg-muted: #9fabc3;
  --line: rgba(242, 238, 227, 0.14);
  --line-strong: rgba(242, 238, 227, 0.38);
  --accent: #c9a34a;
  --accent-soft: #ddc07c;
  --warm: #c9a34a;
}
[data-palette="navy"][data-theme="light"] {
  --bg: #f2eee3;
  --bg-raised: #fbf9f2;
  --fg: #132d54;
  --fg-muted: #52617e;
  --line: rgba(19, 45, 84, 0.16);
  --line-strong: rgba(19, 45, 84, 0.42);
  --accent: #132d54;
  --accent-soft: #a8853a;
  --warm: #c9a34a;
}

/* Palette: clinical (cool teal) */
[data-palette="clinical"] {
  --bg: #0a1518;
  --bg-raised: #10242a;
  --fg: #eaf2f1;
  --fg-muted: #8fa6a6;
  --accent: #4fb3b3;
  --accent-soft: #7fcdcd;
  --warm: #e0b978;
}
[data-palette="clinical"][data-theme="light"] {
  --bg: #f1f6f6;
  --bg-raised: #ffffff;
  --fg: #0a1518;
  --fg-muted: #4c5f5f;
  --accent: #18686b;
  --accent-soft: #3a8f92;
  --warm: #9a7635;
}

/* Palette: warm (editorial cream + terracotta) */
[data-palette="warm"] {
  --bg: #1a130e;
  --bg-raised: #251a12;
  --fg: #f1e8dc;
  --fg-muted: #b29b85;
  --accent: #d08566;
  --accent-soft: #e9b39a;
  --warm: #e0b978;
}
[data-palette="warm"][data-theme="light"] {
  --bg: #f5efe5;
  --bg-raised: #ffffff;
  --fg: #1a130e;
  --fg-muted: #6b5743;
  --accent: #b85c3b;
  --accent-soft: #d08566;
}

/* Palette: ink (minimal mono) */
[data-palette="ink"] {
  --bg: #0a0a0a;
  --bg-raised: #141414;
  --fg: #ededed;
  --fg-muted: #8a8a8a;
  --accent: #e0e0e0;
  --accent-soft: #ababab;
  --warm: #e0b978;
}
[data-palette="ink"][data-theme="light"] {
  --bg: #ffffff;
  --bg-raised: #f7f7f7;
  --fg: #0a0a0a;
  --fg-muted: #555;
  --accent: #0a0a0a;
  --accent-soft: #555;
}

/* Type presets */
[data-type="instrument"] {
  --ff-display: "Instrument Serif", "Fraunces", serif;
  --ff-body: "Inter Tight", sans-serif;
}
[data-type="editorial"] {
  --ff-display: "Fraunces", serif;
  --ff-body: "Inter Tight", sans-serif;
}
[data-type="grotesk"] {
  --ff-display: "Space Grotesk", sans-serif;
  --ff-body: "Space Grotesk", sans-serif;
}
[data-type="classical"] {
  --ff-display: "Cormorant Garamond", serif;
  --ff-body: "Manrope", sans-serif;
}

/* ============ Reset / base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

/* ============ Typography ============ */
.display {
  font-family: var(--ff-display);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.035em;
}
h1.display { font-size: clamp(52px, 9vw, 168px); }
h2.display { font-size: clamp(40px, 6.5vw, 104px); }
h3.display { font-size: clamp(28px, 3.5vw, 56px); }

.eyebrow {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--fg-muted);
}
.eyebrow.no-line::before { display: none; }

.num {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

/* ============ Layout ============ */
.container {
  width: 100%;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}
.section { padding: var(--pad-y) 0; position: relative; }
.divider {
  width: 100%;
  height: 1px;
  background: var(--line);
}

/* ============ Nav ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px var(--pad-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--line);
  transition: all 0.3s ease;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-display);
  font-size: 20px;
  letter-spacing: -0.02em;
}
.nav-logo img.nav-logo-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.nav-wordmark {
  font-family: "Jost", var(--ff-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
}
.nav-logo-mark:not(img) {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  display: grid;
  place-items: center;
}
.nav-logo-mark::before, .nav-logo-mark::after {
  content: "";
  position: absolute;
  background: var(--bg);
}
.nav-logo-mark::before { width: 12px; height: 2px; }
.nav-logo-mark::after { width: 2px; height: 12px; }

.nav-links {
  display: flex;
  gap: clamp(16px, 1.7vw, 30px);
  align-items: center;
  font-size: 14px;
  white-space: nowrap;
}
.nav-links a {
  position: relative;
  padding: 4px 0;
  transition: opacity 0.2s;
}
.nav-links a:hover { opacity: 0.6; }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-right button {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-right a, .nav-cta { white-space: nowrap; }
.nav-right button:hover { background: var(--fg); color: var(--bg); }
.nav-right button.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.nav-cta {
  padding: 10px 18px !important;
  border-radius: 24px !important;
  background: var(--accent);
  color: var(--bg) !important;
  border: 1px solid var(--accent) !important;
}

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.25s ease;
}
.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  margin: 0 auto;
  background: var(--fg);
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.nav-toggle:hover { border-color: var(--accent); }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile menu overlay */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  visibility: hidden;
  transform: translateY(-12px);
  pointer-events: none;
  transition: transform 0.4s ease;
  display: flex;
  align-items: center;
}
.mobile-menu.open { visibility: visible; transform: translateY(0); pointer-events: auto; }
.mobile-menu-inner {
  width: 100%;
  padding: 120px var(--pad-x) 48px;
}
.mm-links { display: flex; flex-direction: column; }
.mm-link {
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: clamp(34px, 9vw, 60px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  transition: padding-left 0.3s ease, color 0.3s ease;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.mm-link .mm-num {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}
.mm-link:hover, .mm-link.active { color: var(--accent); padding-left: 14px; }
.mm-foot {
  margin-top: 44px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.mm-lang {
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
  cursor: pointer;
}
.mm-lang:hover { background: var(--fg); color: var(--bg); }

@media (max-width: 1024px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-cta { display: none !important; }
}
@media (max-width: 560px) {
  .nav-right .lang-inline { display: none; }
}

/* ============ Button ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 32px;
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { transform: translate(2px, -2px); box-shadow: -4px 4px 0 var(--fg); }
.btn-ghost { border-color: var(--line-strong); color: var(--fg); }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }
.btn .arr {
  width: 20px; height: 1px; background: currentColor;
  position: relative;
  transition: width 0.25s;
}
.btn .arr::after {
  content: "";
  position: absolute;
  right: -1px; top: -3px;
  width: 7px; height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
.btn:hover .arr { width: 28px; }

/* ============ Brand lockup ============ */
.brand-lockup { display: flex; align-items: center; gap: 18px; }
.brand-lockup img { height: 54px; width: auto; }
.bl-rule { width: 1px; align-self: stretch; background: var(--line-strong); }
.bl-text { display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.bl-name {
  font-family: "Jost", var(--ff-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg);
  line-height: 1;
  white-space: nowrap;
}
.bl-tag {
  font-family: "Jost", var(--ff-body);
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--warm);
  line-height: 1;
  white-space: nowrap;
}

/* ============ Footer ============ */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 80px var(--pad-x) 32px;
  position: relative;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 80px;
}
.footer-grid h4 {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 16px;
  font-weight: 400;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; font-size: 14px; }
.footer-grid li a:hover { color: var(--accent); }
.footer-giant {
  font-family: var(--ff-display);
  font-size: clamp(80px, 16vw, 240px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 60px 0 40px;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  text-transform: uppercase;
}
@media (max-width: 1100px) {
  /* Lockup slightly smaller so it never crowds its column on tablets */
  .brand-lockup img { height: 44px; }
  .bl-name { font-size: 13px; }
  .bl-tag { font-size: 8px; }
}
@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  /* Brand column takes the full row — no more collision with Navigate */
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 12px; }
}

/* ============ Reusable blocks ============ */
.hero-label-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.page-hero {
  padding: 180px var(--pad-x) 80px;
  border-bottom: 1px solid var(--line);
}
.page-hero h1 {
  font-family: var(--ff-display);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-size: clamp(56px, 10vw, 180px);
  margin: 24px 0 0;
}
.page-hero .lead {
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.45;
  max-width: 720px;
  margin-top: 32px;
  color: var(--fg);
}
.page-hero .lead.muted { color: var(--fg-muted); }

/* Selection */
::selection { background: var(--accent); color: var(--bg); }

/* Scroll reveal helpers */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Tweaks Panel ============ */
.tweaks-panel {
  position: fixed;
  right: 20px; bottom: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 18px;
  width: 260px;
  z-index: 200;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: none;
}
.tweaks-panel.open { display: block; }
.tweaks-panel h5 {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 400;
}
.tweaks-panel-title {
  font-family: var(--ff-display);
  font-size: 18px;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.tweaks-group { margin-bottom: 14px; }
.tweaks-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.tweaks-row button {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}
.tweaks-row button.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.swatches { display: flex; gap: 8px; margin-top: 6px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  position: relative;
}
.swatch.active { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ============ Accessibility ============ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 14px 22px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip-link:focus { left: 8px; top: 8px; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.form input:focus-visible, .form textarea:focus-visible, .form select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
  .fade-up { opacity: 1 !important; transform: none !important; }
  .marquee-track { animation: none !important; }
}

/* ============ Mobile hardening (≤640px) ============ */
@media (max-width: 640px) {
  /* About: team grids — base rule wins over page media by source order; force collapse */
  .team-grid { grid-template-columns: 1fr !important; }
  .team-grid.team-grid-4 { grid-template-columns: 1fr 1fr !important; }
  /* Clients: sector cards too narrow at 2-up */
  .sector-grid { grid-template-columns: 1fr !important; }
  /* iOS: inputs under 16px trigger auto-zoom on focus */
  input, select, textarea { font-size: 16px !important; }
  /* Breathing room on small screens */
  :root { --pad-y: clamp(56px, 14vw, 80px); }
  .footer-grid { gap: 32px; row-gap: 40px; }
  /* Clear the fixed music pill so copyright stays readable */
  .footer { padding-bottom: 130px; }
  /* Lockup compact + allowed to wrap on very narrow phones */
  .brand-lockup { flex-wrap: wrap; gap: 14px; }
  .brand-lockup img { height: 40px; }
  .bl-name { font-size: 12px; letter-spacing: 0.2em; }
  .bl-tag { font-size: 8px; letter-spacing: 0.28em; }
}
