/* ---------- Tokens ---------- */
:root {
  --paper: #f5f2eb;
  --paper-2: #ece7dc;
  --card: #fbf9f4;
  --ink: #15171a;
  --ink-2: #44474c;
  --muted: #74767a;
  --line: rgba(21, 23, 26, 0.12);
  --line-strong: rgba(21, 23, 26, 0.22);
  --accent: #b4441f;
  --accent-ink: #ffffff;
  --green: #1f5c4a;
  --night: #101213;
  --night-2: #1a1d1f;
  --night-ink: #efede7;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1112;
    --paper-2: #161819;
    --card: #1a1c1e;
    --ink: #ecebe6;
    --ink-2: #b9b7b1;
    --muted: #8a8a86;
    --line: rgba(236, 235, 230, 0.12);
    --line-strong: rgba(236, 235, 230, 0.24);
    --accent: #e0784f;
    --accent-ink: #15171a;
    --green: #6fbf9f;
    --night: #0a0b0c;
    --night-2: #141617;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1112;
  --paper-2: #161819;
  --card: #1a1c1e;
  --ink: #ecebe6;
  --ink-2: #b9b7b1;
  --muted: #8a8a86;
  --line: rgba(236, 235, 230, 0.12);
  --line-strong: rgba(236, 235, 230, 0.24);
  --accent: #e0784f;
  --accent-ink: #15171a;
  --green: #6fbf9f;
  --night: #0a0b0c;
  --night-2: #141617;
  color-scheme: dark;
}

/* ---------- Language switching ---------- */
html[data-lang="en"] [data-l="ms"],
html[data-lang="ms"] [data-l="en"] { display: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-weight: 400; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font-family: var(--serif); font-size: 22px; line-height: 1;
  position: relative;
}
.brand-mark::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.brand-name { font-weight: 550; letter-spacing: -0.01em; font-size: 15px; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  text-decoration: none; font-size: 14px; color: var(--ink-2);
  padding: 8px 12px; border-radius: 999px; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }

.header-tools { display: flex; align-items: center; gap: 8px; }
.lang-switch {
  display: inline-flex; padding: 3px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card);
}
.lang-switch button {
  font: 500 12px/1 var(--mono); letter-spacing: .04em;
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 10px; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
html[data-lang="en"] .lang-switch [data-set-lang="en"],
html[data-lang="ms"] .lang-switch [data-set-lang="ms"] { background: var(--ink); color: var(--paper); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--paper-2); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }

@media (max-width: 920px) {
  .menu-btn { display: grid; }
  .header-tools { margin-left: auto; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0; margin: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 4px; border-radius: 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--ink); }
  .nav a:hover { background: transparent; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
}

/* ---------- Shared type ---------- */
.eyebrow, .mono-label, .section-no, .job-date, .work-client, .work-tag, .row-meta, .post-meta, .chips li {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.section-no { color: var(--accent); margin: 0 0 14px; }
.section-title {
  font-family: var(--serif); font-size: clamp(40px, 6vw, 64px); line-height: 1; letter-spacing: -0.01em;
}
.section-sub { color: var(--ink-2); max-width: 46ch; margin: 18px 0 0; }
.sub-title { font-family: var(--serif); font-size: 32px; line-height: 1.1; margin-bottom: 24px; }
em { font-style: italic; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: 999px; text-decoration: none;
  font-size: 15px; font-weight: 500; border: 1px solid transparent;
  transition: transform .15s ease, background .15s, color .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-light { background: var(--night-ink); color: #15171a; }
.btn-light:hover { background: #fff; }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(40px, 6vw, 72px); position: relative; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 80% 20%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 80% 20%, #000 0%, transparent 70%);
  opacity: .7;
}
.hero .wrap { position: relative; }
.eyebrow { display: flex; align-items: flex-start; gap: 10px; color: var(--ink-2); margin-bottom: 28px; line-height: 1.6; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: .5em; }
.hero-title {
  font-family: var(--serif);
  font-size: clamp(44px, 8.2vw, 108px);
  line-height: .98; letter-spacing: -0.02em;
  max-width: 15ch;
  text-wrap: balance;
}
html[data-lang="ms"] .hero-title { max-width: 19ch; font-size: clamp(40px, 7vw, 92px); }
.hero-title em { color: var(--accent); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px); align-items: end; margin-top: clamp(32px, 5vw, 56px);
}
.lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2); max-width: 54ch; line-height: 1.55; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.now-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(0,0,0,.35);
}
.mono-label { display: flex; align-items: center; gap: 8px; color: var(--green); margin-bottom: 12px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--green); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }
.now-role { font-family: var(--serif); font-size: 28px; line-height: 1.1; margin-bottom: 10px; }
.now-desc { color: var(--ink-2); font-size: 15px; }
.now-meta { margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.now-meta div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.now-meta dt { color: var(--muted); }
.now-meta dd { margin: 0; text-align: right; }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
}

/* ---------- Stats ---------- */
.stats { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 28px 20px 26px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat-num { font-family: var(--serif); font-size: clamp(44px, 5vw, 64px); line-height: 1; margin-bottom: 10px; }
.stat-num span { color: var(--accent); }
.stat-num small { font-size: .42em; font-family: var(--mono); letter-spacing: .02em; margin-right: 4px; vertical-align: .9em; color: var(--muted); }
.stat-label { font-size: 14px; color: var(--ink-2); margin: 0; max-width: 20ch; }
@media (max-width: 920px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat:first-child { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--line); padding-left: 20px; }
  .stat:last-child { grid-column: 1 / -1; border-left: 0; padding-left: 0; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 10vw, 128px) 0; }
.section-alt { background: var(--paper-2); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(28px, 6vw, 96px); }
.split-head { position: sticky; top: 100px; align-self: start; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split-head { position: static; }
}
.section-head-row { display: flex; justify-content: space-between; align-items: end; gap: 24px 48px; flex-wrap: wrap; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head-row .section-sub { margin: 0; }

.prose p { color: var(--ink-2); max-width: 62ch; }
.prose .big { font-family: var(--serif); font-size: clamp(26px, 3vw, 36px); line-height: 1.2; color: var(--ink); margin-bottom: 1.1em; max-width: 30ch; }
.prose a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 0; }
.job { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; padding: 32px 0; border-top: 1px solid var(--line-strong); }
.job:first-child { border-top: 0; padding-top: 0; }
.job-date { color: var(--muted); margin: 6px 0 0; }
.job-role { font-family: var(--serif); font-size: clamp(26px, 2.6vw, 32px); line-height: 1.1; }
.job-org { font-weight: 550; color: var(--accent); margin: 6px 0 16px; }
.job ul { display: grid; gap: 10px; }
.job li { position: relative; padding-left: 20px; color: var(--ink-2); font-size: 16px; }
.job li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 1px; background: var(--ink-2); }
.job li strong { color: var(--ink); font-weight: 600; }
@media (max-width: 600px) {
  .job { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Work ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.work-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column;
  transition: border-color .2s, transform .2s;
}
.work-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.work-client { color: var(--muted); margin-bottom: 18px; }
.work-card h3 { font-family: var(--serif); font-size: clamp(28px, 2.8vw, 36px); line-height: 1.05; margin-bottom: 14px; }
.work-card p:not(.work-client):not(.work-tag) { color: var(--ink-2); }
.work-tag {
  margin: auto 0 0; align-self: flex-start;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; color: var(--ink);
}
@media (max-width: 760px) { .work-grid { grid-template-columns: 1fr; } }

.industries { margin-top: clamp(56px, 8vw, 96px); }
.industry-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; margin: 0; }
.industry-list div { padding: 16px 0; border-top: 1px solid var(--line); }
.industry-list dt { font-weight: 550; font-size: 15px; }
.industry-list dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
@media (max-width: 900px) { .industry-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .industry-list { grid-template-columns: 1fr; } }

/* ---------- ARISE/A ---------- */
.arise { background: var(--night); color: var(--night-ink); padding: clamp(64px, 10vw, 128px) 0; position: relative; overflow: hidden; }
.arise::before {
  content: ""; position: absolute; width: 900px; height: 900px; right: -300px; top: -300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224,120,79,.22), transparent 62%); pointer-events: none;
}
.arise-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(32px, 6vw, 80px); align-items: center; position: relative; }
.arise .section-no { color: #e0784f; }
.arise-title { font-family: var(--serif); font-size: clamp(64px, 10vw, 128px); line-height: .9; letter-spacing: -0.02em; margin-bottom: 18px; }
.arise-tag { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2; color: #fff; }
.arise p { color: rgba(239,237,231,.78); max-width: 52ch; }
.arise-facts { display: flex; gap: 0; margin: 28px 0 32px; border-top: 1px solid rgba(255,255,255,.14); border-bottom: 1px solid rgba(255,255,255,.14); }
.arise-facts li { flex: 1; padding: 16px 16px 16px 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: rgba(239,237,231,.65); }
.arise-facts li + li { padding-left: 16px; border-left: 1px solid rgba(255,255,255,.14); }
.arise-facts strong { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; color: #fff; }
.arise-art {
  display: block; border-radius: 18px; overflow: hidden; aspect-ratio: 3 / 2;
  border: 1px solid rgba(255,255,255,.12); background: var(--night-2);
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.8);
  transform: rotate(1.2deg); transition: transform .4s ease;
}
.arise-art:hover { transform: rotate(0deg) scale(1.01); }
.arise-art img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 860px) {
  .arise-grid { grid-template-columns: 1fr; }
  .arise-art { transform: none; order: -1; }
}

/* ---------- Writing ---------- */
.posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; }
.post { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.post-img { aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--paper-2); border: 1px solid var(--line); margin-bottom: 16px; }
.post-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.post:hover .post-img img { transform: scale(1.04); }
.post-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); margin-bottom: 8px; }
.post-lang { border: 1px solid var(--line-strong); color: var(--ink); border-radius: 6px; padding: 2px 6px; font-size: 11px; }
.post h3 { font-family: var(--serif); font-size: 26px; line-height: 1.1; margin-bottom: 10px; text-wrap: balance; }
.post:hover h3 { color: var(--accent); }
.post-excerpt { color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.more-link { margin: 40px 0 0; }
.more-link a { font-weight: 500; text-underline-offset: 4px; }
.more-link a:hover { color: var(--accent); }
@media (max-width: 900px) { .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) { .posts { grid-template-columns: 1fr; } }

/* ---------- Expertise ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line-strong); }
.skill { padding: 28px 24px 8px 0; }
.skill + .skill { padding-left: 24px; border-left: 1px solid var(--line); }
.skill h3 { font-family: var(--serif); font-size: 28px; line-height: 1.1; margin-bottom: 12px; }
.skill p { color: var(--ink-2); font-size: 15px; }
@media (max-width: 900px) {
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) {
  .skills-grid { grid-template-columns: 1fr; }
  .skill + .skill { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.chips li { border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 12px; font-size: 11px; color: var(--ink-2); background: var(--card); }

/* ---------- Recognition / Education ---------- */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(40px, 6vw, 96px); }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.list-rows { margin-top: 32px; border-top: 1px solid var(--line-strong); }
.list-rows li { padding: 20px 0; border-bottom: 1px solid var(--line); }
.row-title { font-size: 17px; font-weight: 500; margin: 0 0 6px; }
.row-meta { color: var(--muted); margin: 0; text-transform: none; letter-spacing: .01em; font-size: 13px; }

/* ---------- Contact ---------- */
.contact { padding: clamp(72px, 11vw, 144px) 0; border-top: 1px solid var(--line); }
.contact-title { font-family: var(--serif); font-size: clamp(64px, 13vw, 168px); line-height: .9; letter-spacing: -0.03em; }
.contact-sub { color: var(--ink-2); font-size: clamp(17px, 1.6vw, 20px); max-width: 48ch; margin: 24px 0 28px; }
.contact-email a {
  font-family: var(--serif); font-size: clamp(26px, 4vw, 44px); line-height: 1.1;
  text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px;
  overflow-wrap: anywhere;
}
.contact-email a:hover { color: var(--accent); }
.socials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; }
.socials a {
  display: inline-flex; gap: 10px; align-items: center; text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 10px 16px; font-size: 15px;
  transition: background .15s, color .15s, border-color .15s;
}
.socials a:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.to-top { text-decoration: none; }
.to-top:hover { color: var(--ink); }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
