/* ============================================================
   Azhan Latif — Portfolio
   Editorial minimal · Newsreader + Space Grotesk · terracotta
   ============================================================ */

:root {
  --bg:       #f6f3ee;
  --bg-2:     #efeae1;
  --surface:  #fffdf9;
  --ink:      #1a1814;
  --ink-2:    #56514a;
  --ink-3:    #8a8378;
  --line:     #e1dacf;
  --line-2:   #d3cabb;
  --accent:   #cf552a;
  --accent-2: #b8461f;
  --shadow:   0 1px 2px rgba(26,24,20,.05), 0 12px 32px -16px rgba(26,24,20,.18);
  --serif: 'Newsreader', Georgia, serif;
  --sans:  'Space Grotesk', system-ui, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, monospace;
  --maxw: 1180px;
  --pad: clamp(20px, 5vw, 64px);
}

html[data-theme="dark"] {
  --bg:       #131210;
  --bg-2:     #191713;
  --surface:  #1c1a16;
  --ink:      #efeae1;
  --ink-2:    #b1a99d;
  --ink-3:    #7e776b;
  --line:     #2b2922;
  --line-2:   #38352c;
  --accent:   #e8693a;
  --accent-2: #f0825a;
  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 18px 40px -20px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
}

::selection { background: var(--accent); color: #fff; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

.kicker {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.kicker::before {
  content: "";
  width: 22px; height: 1.5px;
  background: var(--accent);
  display: inline-block;
}

.serif-i { font-style: italic; color: var(--accent); }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 16px var(--pad);
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.brand .dot { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { font-size: 15px; color: var(--ink-2); transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-tools { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
  transition: border-color .2s, transform .2s;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(12deg); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

/* resume popover */
.resume-wrap { position: relative; }
.btn {
  font-family: var(--sans); font-size: 14.5px; font-weight: 500;
  padding: 10px 20px; border-radius: 100px; cursor: pointer; border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); transition: opacity .2s, transform .2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.popover {
  position: absolute; right: 0; top: calc(100% + 10px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px; min-width: 230px;
  box-shadow: var(--shadow); opacity: 0; visibility: hidden;
  transform: translateY(-6px); transition: all .2s; z-index: 60;
}
.resume-wrap.open .popover { opacity: 1; visibility: visible; transform: translateY(0); }
.popover a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-radius: 9px; font-size: 14.5px; color: var(--ink);
}
.popover a:hover { background: var(--bg-2); color: var(--accent); }
.popover a span { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* ---------- HERO ---------- */
.hero { padding: clamp(70px, 12vh, 140px) 0 70px; }
.hero h1 {
  font-size: clamp(40px, 6.6vw, 88px);
  line-height: 1.02; margin: 26px 0 0; max-width: 14ch;
}
.hero p.lead {
  font-size: clamp(18px, 2vw, 21px); color: var(--ink-2);
  max-width: 58ch; margin: 34px 0 0; line-height: 1.62;
}
.hero-cta { display: flex; gap: 16px; align-items: center; margin-top: 42px; flex-wrap: wrap; }
.text-link {
  font-size: 15px; border-bottom: 1.5px solid var(--ink); padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.text-link:hover { color: var(--accent); border-color: var(--accent); }

.hero-products {
  display: flex; flex-wrap: wrap; gap: 14px 40px; margin-top: 64px;
  padding-top: 30px; border-top: 1px solid var(--line);
  font-size: 14.5px; color: var(--ink-3); font-family: var(--mono);
}
.hero-products b { color: var(--ink); font-family: var(--sans); font-weight: 500; }

/* ---------- SECTION SHELL ---------- */
section { padding: clamp(64px, 10vh, 110px) 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 52px; }
.sec-head h2 { font-size: clamp(30px, 4vw, 46px); margin: 14px 0 0; line-height: 1.05; }
.sec-head .meta { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }

/* ---------- PROJECTS ---------- */
.projects { display: flex; flex-direction: column; gap: 34px; }
.project {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; overflow: hidden; transition: border-color .25s, transform .25s, box-shadow .25s;
}
.project:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.project:nth-child(even) .p-media { order: 2; }
.p-media { position: relative; min-height: 340px; background: var(--bg-2); }
.p-media image-slot { width: 100%; height: 100%; display: block; }
.p-tag-url {
  position: absolute; left: 16px; bottom: 16px; z-index: 3;
  font-family: var(--mono); font-size: 12px; background: var(--ink); color: var(--bg);
  padding: 5px 11px; border-radius: 7px; pointer-events: none;
}
.p-body { padding: clamp(28px, 3.5vw, 46px); display: flex; flex-direction: column; }
.p-eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); display: flex; gap: 14px; }
.p-eyebrow .live { color: var(--accent); }
.p-body h3 { font-size: clamp(26px, 3vw, 34px); margin: 16px 0 0; line-height: 1.08; }
.p-role { font-size: 14.5px; color: var(--accent); margin-top: 8px; font-weight: 500; }
.p-desc { color: var(--ink-2); margin: 18px 0 0; font-size: 16px; line-height: 1.62; }
.p-tech { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 26px; }
.chip {
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 100px; padding: 5px 12px; background: var(--bg);
}
.p-link { margin-top: 22px; font-size: 14.5px; display: inline-flex; align-items: center; gap: 7px; color: var(--ink); transition: gap .2s, color .2s; width: fit-content; }
.project:hover .p-link { color: var(--accent); gap: 11px; }

/* ---------- EXPERIENCE ---------- */
.exp-list { display: flex; flex-direction: column; }
.exp {
  display: grid; grid-template-columns: 200px 1fr; gap: 40px;
  padding: 34px 0; border-top: 1px solid var(--line);
}
.exp:last-child { border-bottom: 1px solid var(--line); }
.exp-when { font-family: var(--mono); font-size: 13px; color: var(--ink-3); padding-top: 6px; }
.exp-when .now { color: var(--accent); }
.exp h3 { font-size: 24px; margin: 0; font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; }
.exp .co { color: var(--accent); font-weight: 500; }
.exp ul { margin: 16px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.exp li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.exp li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

/* ---------- SKILLS + CERTS GRID ---------- */
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: start; }
.skill-group { padding: 20px 0; border-top: 1px solid var(--line); }
.skill-group:first-child { border-top: none; padding-top: 0; }
.skill-group h4 { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 14px; font-weight: 500; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.cert-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px; margin-bottom: 16px;
}
.cert-card .badge {
  width: 44px; height: 44px; border-radius: 11px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px; margin-bottom: 16px;
}
.cert-card h4 { font-family: var(--sans); font-size: 19px; font-weight: 600; margin: 0; }
.cert-card p { color: var(--ink-2); font-size: 14.5px; margin: 8px 0 0; }
.cert-certs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.cert-certs span { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 9px; color: var(--ink-2); }
.cert-link { font-size: 13.5px; color: var(--accent); margin-top: 16px; display: inline-block; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.cert-more { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; }
.cert-more li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.cert-more li:first-child { border-top: none; }
.cert-more .cm-org { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- WRITING ---------- */
.writing-list { display: flex; flex-direction: column; }
.post {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 28px; align-items: baseline;
  padding: 26px 0; border-top: 1px solid var(--line); cursor: pointer;
  transition: padding-left .25s;
}
.post:last-child { border-bottom: 1px solid var(--line); }
.post:hover { padding-left: 10px; }
.post-date { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.post-main h3 { font-family: var(--sans); font-size: 21px; font-weight: 600; margin: 0; transition: color .2s; }
.post:hover .post-main h3 { color: var(--accent); }
.post-main p { color: var(--ink-2); font-size: 15px; margin: 7px 0 0; max-width: 60ch; }
.post-tags { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.post-tags span { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.post-read { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.post .arrow { color: var(--accent); opacity: 0; transition: opacity .2s; }
.post:hover .arrow { opacity: 1; }

/* reader modal */
.reader { position: fixed; inset: 0; z-index: 100; display: none; }
.reader.open { display: block; }
.reader-scrim { position: absolute; inset: 0; background: rgba(20,18,14,.5); backdrop-filter: blur(3px); }
.reader-panel {
  position: absolute; right: 0; top: 0; height: 100%; width: min(720px, 100%);
  background: var(--bg); overflow-y: auto; box-shadow: -20px 0 60px -20px rgba(0,0,0,.4);
  transform: translateX(40px); opacity: 0; transition: transform .35s ease, opacity .35s ease;
}
.reader.open .reader-panel { transform: translateX(0); opacity: 1; }
.reader-inner { padding: clamp(30px, 5vw, 64px); }
.reader-close {
  position: sticky; top: 20px; float: right; margin-right: 6px;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; font-size: 18px;
}
.reader-inner h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.1; margin: 18px 0 0; }
.reader-meta { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); margin-top: 18px; display: flex; gap: 16px; }
.reader-body { margin-top: 36px; }
.reader-body p { color: var(--ink-2); margin: 0 0 18px; }
.reader-body h2 { font-family: var(--sans); font-size: 21px; font-weight: 600; margin: 34px 0 14px; color: var(--ink); }
.reader-body ul { color: var(--ink-2); padding-left: 22px; margin: 0 0 18px; }
.reader-body li { margin-bottom: 8px; }
.reader-body code {
  font-family: var(--mono); font-size: 13.5px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--accent-2);
}
.reader-body pre {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; overflow-x: auto; margin: 0 0 22px;
}
.reader-body pre code { background: none; border: none; padding: 0; color: var(--ink); font-size: 13px; line-height: 1.7; }

/* ---------- ABOUT ---------- */
.about { display: grid; grid-template-columns: 280px 1fr; gap: 56px; align-items: start; }
.about-photo {
  width: 100%; aspect-ratio: 250/270; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); filter: grayscale(1) contrast(1.05);
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about-bio p { font-size: 18px; color: var(--ink-2); line-height: 1.65; margin: 0 0 18px; max-width: 62ch; }
.about-bio p strong { color: var(--ink); font-weight: 600; }
.about-edu { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.about-edu .e-school { font-weight: 600; font-size: 16px; }
.about-edu .e-detail { font-size: 14.5px; color: var(--ink-3); margin-top: 4px; font-family: var(--mono); }

/* ---------- CONTACT ---------- */
.contact { background: var(--bg-2); border-top: 1px solid var(--line); }
.contact-inner { text-align: center; padding: clamp(70px, 12vh, 130px) 0; }
.contact h2 { font-size: clamp(34px, 6vw, 72px); margin: 18px auto 0; max-width: 16ch; line-height: 1.04; }
.contact .email-link {
  display: inline-block; margin-top: 36px; font-family: var(--serif); font-style: italic;
  font-size: clamp(22px, 3vw, 32px); color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 4px;
}
.contact-socials { display: flex; justify-content: center; gap: 12px; margin-top: 44px; flex-wrap: wrap; }

/* ---------- FOOTER ---------- */
.footer { padding: 34px 0; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }

/* ---------- REVEAL ANIM ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .p-media { order: 0; }
  .p-media { min-height: 220px; }
  .grid-2 { grid-template-columns: 1fr; gap: 40px; }
  .exp { grid-template-columns: 1fr; gap: 12px; }
  .about { grid-template-columns: 1fr; gap: 32px; }
  .about-photo { max-width: 220px; }
  .post { grid-template-columns: 1fr; gap: 6px; }
  .post-read, .post .arrow { display: none; }
  .post-date { order: -1; }
}
