/* ==========================================================================
   Muhammad Nuril Huda — Portfolio
   Dark cinematic, warm copper accent. System font stack, no external deps.
   ========================================================================== */

:root {
  --bg: #050507;
  --surface: #0e0e11;
  --card: #141417;
  --card-border: rgba(255, 255, 255, 0.07);
  --card-border-hover: rgba(224, 164, 96, 0.35);
  --text: #f5f5f7;
  --text-2: rgba(255, 255, 255, 0.72);
  --text-3: rgba(255, 255, 255, 0.5);
  --accent: #e0a460;
  --accent-strong: #f0c48a;
  --accent-deep: #c87f3a;
  --accent-ink: #1a1006;
  --light-bg: #f5f5f7;
  --light-card: #ffffff;
  --light-text: #1d1d1f;
  --light-text-2: #515154;
  --light-accent: #a05e1a;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1140px;
  --radius: 18px;
  --ease: cubic-bezier(0.22, 0.7, 0.25, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }

a { color: var(--accent); }

::selection { background: rgba(224, 164, 96, 0.35); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 18px;
  border-radius: 0 0 12px 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}
.container.narrow { max-width: 860px; }
.center { text-align: center; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 5, 7, 0.72);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.main-nav { margin-left: auto; }

.nav-list {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: block;
  padding: 8px 12px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  border-radius: 999px;
  transition: color 180ms var(--ease), background 180ms var(--ease);
}
.nav-list a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
}
.nav-toggle-bar {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 220ms var(--ease), top 220ms var(--ease);
}
.nav-toggle-bar:nth-child(1) { top: 18px; }
.nav-toggle-bar:nth-child(2) { top: 25px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { top: 21px; transform: rotate(-45deg); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 3px;
}

.lang-btn {
  border: 0;
  background: none;
  color: var(--text-3);
  font: 600 12px/1 var(--font-mono);
  letter-spacing: 0.06em;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 180ms var(--ease), background 180ms var(--ease);
}
.lang-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.btn-small { min-height: 36px; padding: 6px 16px; font-size: 13px; }
.btn-large { min-height: 52px; padding: 14px 30px; font-size: 17px; }

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 180ms var(--ease);
  padding: 4px 2px;
}
.text-link:hover { border-bottom-color: var(--accent); }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  overflow: clip;
  padding: clamp(72px, 12vh, 140px) 0 clamp(56px, 8vh, 100px);
}

.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 72% 40%, rgba(200, 127, 58, 0.16), transparent 65%),
    radial-gradient(ellipse 50% 40% at 18% 88%, rgba(224, 164, 96, 0.07), transparent 70%);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.eyebrow {
  font: 600 13px/1.4 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(44px, 7.2vw, 88px);
  font-weight: 700;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #ffffff 55%, rgba(255, 255, 255, 0.62));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ffffff;
}

.hero-headline {
  margin-top: 26px;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  max-width: 21em;
  text-wrap: balance;
}

.hero-sub {
  margin-top: 16px;
  font-size: clamp(16px, 1.9vw, 19px);
  color: var(--text-2);
  max-width: 34em;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}
.cta-row.center { justify-content: center; }

.proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
}

.proof-row li {
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--text-2);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  padding: 7px 14px;
  white-space: nowrap;
}

.hero-photo {
  margin: 0;
  position: relative;
  max-width: 460px;
  justify-self: end;
  width: 100%;
}

.hero-photo::before {
  content: "";
  position: absolute;
  inset: -8%;
  background: radial-gradient(ellipse at center, rgba(200, 127, 58, 0.22), transparent 68%);
  filter: blur(30px);
  z-index: 0;
}

.hero-photo img {
  position: relative;
  z-index: 1;
  border-radius: 28px;
  -webkit-mask-image: radial-gradient(140% 140% at 50% 42%, #000 55%, transparent 98%);
  mask-image: radial-gradient(140% 140% at 50% 42%, #000 55%, transparent 98%);
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  position: relative;
  padding: clamp(80px, 12vh, 136px) 0;
}

.section h2 {
  font-size: clamp(32px, 4.6vw, 54px);
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 18em;
}

.section-sub {
  margin-top: 18px;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--text-2);
  max-width: 38em;
}
.center .section-sub { margin-inline: auto; }

.section-elevated {
  background: linear-gradient(180deg, var(--surface), var(--bg));
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ---------- About ---------- */

.about-body {
  margin-top: 30px;
  display: grid;
  gap: 20px;
}
.about-body p {
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.55;
  color: var(--text-2);
  letter-spacing: -0.01em;
}
.about-body p::first-letter { color: var(--text); }

/* ---------- Cards / grids ---------- */

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 48px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px 24px;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--card-border-hover); }

.card h3 {
  font-size: 18px;
  font-weight: 650;
  margin-bottom: 10px;
  letter-spacing: -0.015em;
}

.card p { font-size: 15px; color: var(--text-2); }

.card-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  color: var(--accent);
}
.card-icon svg { width: 100%; height: 100%; }

.card-span { grid-column: 1 / -1; }
.card-span-2 { grid-column: span 2; }

.card-highlight {
  background:
    radial-gradient(ellipse 75% 110% at 92% 0%, rgba(200, 127, 58, 0.13), transparent 62%),
    var(--card);
  border-color: rgba(224, 164, 96, 0.22);
}

.card-note {
  margin-bottom: 14px;
  color: var(--text-2);
  font-size: 15px;
  max-width: 46em;
}

/* ---------- Featured work ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 48px;
}

.work-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease);
}
.work-card:hover { transform: translateY(-3px); border-color: var(--card-border-hover); }

.work-wide { grid-column: 1 / -1; }

.work-wide {
  background:
    radial-gradient(ellipse 70% 90% at 90% 10%, rgba(200, 127, 58, 0.1), transparent 60%),
    var(--card);
}

.work-tag {
  font: 600 12px/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.work-card h3 {
  font-size: clamp(21px, 2.6vw, 28px);
  font-weight: 650;
  letter-spacing: -0.02em;
}
.work-card h3 span { color: var(--text-2); font-weight: 550; }

.work-card > p:not(.work-tag) {
  font-size: 15.5px;
  color: var(--text-2);
  max-width: 62em;
}

.stack-row, .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}

.stack-row li, .tag-row li {
  font: 500 12px/1.4 var(--font-mono);
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 11px;
}

.work-note {
  margin-top: 28px;
  font-size: 14px;
  color: var(--text-3);
}

/* ---------- Timeline ---------- */

.timeline {
  list-style: none;
  margin: 48px 0 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent-deep), rgba(255, 255, 255, 0.08));
}

.timeline li {
  position: relative;
  padding: 0 0 40px 36px;
}
.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.tl-period {
  font: 600 12.5px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.timeline h3 {
  font-size: 19px;
  font-weight: 650;
  margin-bottom: 6px;
}

.timeline p:not(.tl-period) {
  font-size: 15.5px;
  color: var(--text-2);
  max-width: 46em;
}

/* ---------- Research (light section) ---------- */

.section-light {
  background: var(--light-bg);
  color: var(--light-text);
}

.section-light .eyebrow { color: var(--light-accent); }
.section-light h2 { color: var(--light-text); }
.section-light ::selection { background: rgba(160, 94, 26, 0.25); }

.research-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px;
  margin-top: 48px;
}

.light-card {
  background: var(--light-card);
  border-radius: var(--radius);
  padding: 30px 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.05);
}

.light-card h3 {
  font-size: 20px;
  font-weight: 650;
  color: var(--light-text);
  margin: 8px 0 6px;
  letter-spacing: -0.015em;
}

.light-card p { color: var(--light-text-2); font-size: 15.5px; }

.light-card .work-tag { color: var(--light-accent); }

.research-main { display: flex; flex-direction: column; gap: 10px; }
.research-main h3 { font-size: clamp(21px, 2.6vw, 27px); max-width: 22em; }

.stat { margin: 8px 0 2px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.stat-number {
  font-size: clamp(44px, 6vw, 68px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-deep), #8a4a12);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-deep);
}

.stat span:last-child { color: var(--light-text-2); font-size: 15px; }

.research-side { display: grid; gap: 16px; align-content: start; }

.section-light .text-link { color: var(--light-accent); margin-top: 8px; align-self: start; }
.section-light .text-link:hover { border-bottom-color: var(--light-accent); }
.section-light :focus-visible { outline-color: var(--light-accent); }

/* ---------- Contact ---------- */

.contact {
  background:
    radial-gradient(ellipse 55% 50% at 50% 100%, rgba(200, 127, 58, 0.13), transparent 70%),
    var(--bg);
}

.contact .cta-row + .cta-row { margin-top: 20px; }

.contact-email {
  margin-top: 44px;
  font: 500 14px/1.4 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-3);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer p { font-size: 13px; color: var(--text-3); }

/* ==========================================================================
   Chat widget
   ========================================================================== */

.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 110;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: var(--accent-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(200, 127, 58, 0.35);
  transition: transform 180ms var(--ease);
}
.chat-fab:hover { transform: scale(1.06); }
.chat-fab:active { transform: scale(0.96); }
.chat-fab svg { width: 26px; height: 26px; }

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 90px;
  z-index: 110;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: #101013;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.chat-title { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.chat-sub { font: 500 11px/1.4 var(--font-mono); color: var(--accent); margin: 2px 0 0; }
.chat-close {
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.chat-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chat-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: var(--accent-ink);
  border-bottom-right-radius: 6px;
}
.chat-msg-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.chat-pending { color: var(--text-3); }

.chat-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 16px 10px;
}
.chat-chip {
  border: 1px solid rgba(224, 164, 96, 0.35);
  background: none;
  color: var(--accent);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms var(--ease);
}
.chat-chip:hover { background: rgba(224, 164, 96, 0.12); }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: 14px/1.45 var(--font-sans);
  padding: 10px 12px;
  max-height: 140px;
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send {
  align-self: flex-end;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 650;
  padding: 10px 16px;
  min-height: 42px;
  cursor: pointer;
}
.chat-send:active { transform: scale(0.97); }

@media (max-width: 480px) {
  .chat-panel { right: 16px; bottom: 84px; }
  .chat-fab { right: 16px; bottom: 16px; }
}

/* ==========================================================================
   Reveal animation
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 640ms var(--ease), transform 640ms var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

.grid-4 .reveal:nth-child(2), .grid-3 .reveal:nth-child(2) { transition-delay: 70ms; }
.grid-4 .reveal:nth-child(3), .grid-3 .reveal:nth-child(3) { transition-delay: 140ms; }
.grid-4 .reveal:nth-child(4), .grid-3 .reveal:nth-child(4) { transition-delay: 210ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .work-card, .btn { transition: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo {
    order: -1;
    max-width: 330px;
    justify-self: center;
  }
  .hero-copy { text-align: left; }

  .work-grid { grid-template-columns: 1fr; }
  .research-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: block; }
  .nav-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(5, 5, 7, 0.96);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 16px 16px;
  }
  .nav-list.open { display: flex; }
  .nav-list a { padding: 13px 12px; font-size: 16px; }
}

@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .card-span-2 { grid-column: auto; }
  .header-actions .btn { display: none; }
  .container { padding-inline: 20px; }
  .proof-row li { white-space: normal; }
}
