/* ==========================================================================
   Muhammad Fikri Abdul Zaki — portfolio design system
   Palette: cream #faece7 · maroon #922724 · white #ffffff
   ========================================================================== */

:root {
  --bg: #faece7;
  --surface: #ffffff;
  --accent: #922724;
  --accent-strong: #7d1f1c;
  --ink: #1f1512;
  --ink-soft: #4a3a33;
  --muted: #6e5a52;
  --line: #e7d0c2;
  --line-soft: #f0ddd0;
  --tint: #fdf4ee;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1160px;
  --radius: 6px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 16px;
  font-weight: 500;
}
.skip-link:focus { left: 8px; top: 8px; }

.wrap { max-width: var(--maxw); margin: 0 auto; }
section[id], div[id] { scroll-margin-top: 24px; }

/* ---------- Header ---------- */
.site-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  padding: 24px 0;
  font-size: 15px;
}
.site-head .brand {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-head .brand:hover { color: var(--accent); }
.site-head nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-head nav a { color: var(--muted); text-decoration: none; }
.site-head nav a:hover { color: var(--accent); }
.site-head nav a[aria-current="page"] { color: var(--accent); font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px 0 56px;
}
.hero-main { display: flex; flex-direction: column; gap: 20px; }
.hero h1 {
  font-size: clamp(44px, 8vw, 100px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  padding-top: 10px;
}
.hero .role {
  font-size: clamp(20px, 2.4vw, 28px);
  color: var(--ink-soft);
  font-weight: 500;
}
.hero .lede {
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--ink-soft);
  max-width: 640px;
  margin-top: 4px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  line-height: 1.2;
}
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--tint); }
.btn-on-accent { background: transparent; color: #ffffff; border-color: #ffffff; }
.btn-on-accent:hover { background: rgba(255, 255, 255, 0.14); }
.btn-on-accent.solid { background: #ffffff; color: var(--accent); }
.btn-on-accent.solid:hover { background: var(--tint); border-color: var(--tint); }

/* ---------- Scroll cue ---------- */
.cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}
.cue span { display: inline-block; animation: nudge 1.8s ease-in-out infinite; }
.cue:hover { color: var(--accent); }

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
@keyframes rise {
  from { opacity: 0.2; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@supports (animation-timeline: view()) {
  .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
}
@media (prefers-reduced-motion: reduce) {
  .cue span { animation: none; }
  .reveal { animation: none; }
}

/* ---------- Generic section ---------- */
.section { display: flex; flex-direction: column; gap: 20px; padding: 24px 0 72px; }
.section.tight { padding-bottom: 48px; }

.sec-head { display: flex; flex-direction: column; gap: 6px; }
.sec-head h2 { font-size: clamp(26px, 3vw, 32px); font-weight: 600; }
.sec-head p { color: var(--muted); max-width: 640px; }

.eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; margin-bottom: 64px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.kpi .l { font-size: 14px; color: var(--muted); }
.kpi .v {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi .v .arrow { color: var(--accent); }
.kpi .s { font-size: 13px; color: var(--muted); }

/* ---------- Data table ---------- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow-x: auto;
}
table.data { width: 100%; border-collapse: collapse; }
table.data { min-width: 680px; }
.data th {
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--tint);
  white-space: nowrap;
}
.data td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  font-size: 15px;
}
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: var(--tint); }
.data td.n { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data td.n .arrow { color: var(--accent); }
.data .proj { font-weight: 600; }
.data .proj a { color: var(--ink); text-decoration: none; }
.data .proj a:hover { color: var(--accent); text-decoration: underline; }
.data .period { color: var(--muted); white-space: nowrap; }

/* ---------- Featured case study ---------- */
.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 40px;
}
.feature-text { display: flex; flex-direction: column; gap: 16px; }
.feature-text h3 { font-size: clamp(22px, 2.4vw, 26px); font-weight: 600; }
.feature-text p { color: var(--ink-soft); max-width: 56ch; }
.feature-link { font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.feature-link:hover { text-decoration: underline; }
.feature-figs { display: grid; grid-template-columns: 1fr; gap: 12px; }
.feature-figs .shot { max-width: 380px; margin-left: auto; }
@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; }
}

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(146, 39, 36, 0.08); }
.card .thumb { aspect-ratio: 16 / 9; background: var(--bg); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 18px; font-weight: 600; }
.card .meta { font-size: 13px; color: var(--muted); }
.card .res { font-size: 15px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.card .go { font-size: 14px; font-weight: 500; color: var(--accent); margin-top: auto; padding-top: 8px; }

/* ---------- Figures / screenshots ---------- */
figure { margin: 0; }
.shot {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.shot img { width: 100%; height: 100%; object-fit: contain; }
figcaption { font-size: 14px; color: var(--muted); line-height: 1.5; padding-top: 10px; }

.ratio-4x3 { aspect-ratio: 4/3; }
.ratio-16x9 { aspect-ratio: 16/9; }
.ratio-3x2 { aspect-ratio: 3/2; }
.ratio-1x1 { aspect-ratio: 1/1; }
.ratio-5x3 { aspect-ratio: 5/3; }
.ratio-2x1 { aspect-ratio: 2/1; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.figures.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.figures figure { margin: 0; }
.figures figcaption { padding: 10px 4px 0; }

/* ---------- About / skills ---------- */
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 48px; }
.about-block { display: flex; flex-direction: column; gap: 16px; }
.about-block h3 { font-size: 20px; font-weight: 600; }
.about-block p { color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 14px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
}

.list-reset { list-style: none; margin: 0; padding: 0; }
.fact-list { display: flex; flex-direction: column; gap: 14px; }
.fact-list .fact { display: flex; flex-direction: column; gap: 2px; }
.fact-list .fact .k { font-size: 13px; color: var(--muted); }
.fact-list .fact .v { font-size: 15px; }

/* ---------- Case study pages ---------- */
.case-head {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 72px 0 64px;
  max-width: 820px;
}
.case-head h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 600; letter-spacing: -0.02em; }
.case-head .sub { font-size: clamp(17px, 1.8vw, 19px); color: var(--ink-soft); max-width: 640px; }

.back { font-size: 15px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.back:hover { text-decoration: underline; }

.case-layout { display: flex; flex-wrap: wrap; gap: 48px 56px; align-items: flex-start; }
.case-main { flex: 1 1 560px; min-width: 0; max-width: 760px; display: flex; flex-direction: column; gap: 64px; }
.case-aside {
  flex: 0 0 260px;
  min-width: 0;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
@media (max-width: 920px) {
  .case-aside { position: static; flex-basis: 100%; }
}

.sec { display: flex; flex-direction: column; gap: 20px; }
.sec h2 { font-size: 24px; font-weight: 600; }
.sec p { color: var(--ink-soft); max-width: 68ch; }

.case-aside dl {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px 6px;
}
.case-aside dt { font-size: 13px; color: var(--muted); }
.case-aside dd { margin: 0 0 14px; font-size: 15px; }

.toc { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.toc .label { font-size: 13px; color: var(--muted); }
.toc a { text-decoration: none; color: var(--ink); }
.toc a:hover { color: var(--accent); }

/* ---------- CTA band ---------- */
.cta {
  background: var(--accent);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 44px 48px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.cta h2 { font-size: clamp(24px, 3vw, 30px); letter-spacing: -0.02em; }
.cta p { color: rgba(255, 255, 255, 0.95); max-width: 52ch; margin-top: 8px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 80px 0 64px;
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px 48px;
}
.footer-brand h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.footer-brand p {
  color: var(--muted);
  font-size: 15px;
  max-width: 320px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}
.footer-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
.footer-links a:hover {
  color: var(--accent);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 32px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero { min-height: 60vh; padding: 32px 0 48px; }
  .cta { padding: 32px 28px; }
  .section { padding: 16px 0 56px; }
  .case-head { padding: 48px 0 48px; }
  .kpis { margin-bottom: 48px; }
  .case-main { gap: 48px; }
  .feature { padding: 24px; gap: 28px; }
  .footer-top { flex-direction: column; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ---------- Edge gutters below desktop width ---------- */
/* .wrap itself carries no horizontal padding so content gets the full
   max-width on desktop; these gutters keep content off the screen edge
   at every smaller width (nav, footer, and every .wrap section). */
@media (max-width: 1199px) {
  .site-head,
  .site-footer,
  .wrap { padding-left: 24px; padding-right: 24px; }
}
