/* Azlan Othman — portfolio site
   One display face (Instrument Serif), one text face (Archivo),
   one accent (clay), one radius family (2px / pill). */

:root {
  --paper: #f2eee6;
  --paper-2: #e9e3d7;
  --ink: #17140f;
  --muted: #665f54;
  --rule: #d6cec0;
  --clay: #a8492a;
  --clay-soft: #e0a98e;
  --ink-muted: #b3ab9d;
  --ink-rule: #37322a;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 72px);
  --section: clamp(88px, 12vw, 176px);
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
p, li, blockquote { text-wrap: pretty; }
h2, h3 { text-wrap: balance; }

::selection { background: var(--clay); color: var(--paper); }

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

.wrap {
  width: min(100% - 2 * var(--gutter), 1320px);
  margin-inline: auto;
}

.skip {
  position: absolute; left: var(--gutter); top: -80px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 2px;
}
.skip:focus { top: 12px; }

/* ---------- Type ---------- */

.label {
  font-family: var(--sans);
  font-stretch: 125%;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--muted);
}

.display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 0.98;
}

h2.display { font-size: clamp(2.5rem, 6vw, 5rem); }

.lede { font-size: clamp(1.125rem, 1.5vw, 1.3125rem); line-height: 1.55; }

.muted { color: var(--muted); }

/* ---------- Nav ---------- */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background 0.3s, box-shadow 0.3s;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--rule);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px;
}
.brand { display: block; width: 156px; }
.brand img { width: 100%; height: auto; transform: translateY(9px); }

.nav-links { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 36px); }
.nav-links a {
  font-stretch: 125%; font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  padding: 8px 0; position: relative;
}
.nav-links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav-links a:not(.btn):hover::after { transform: scaleX(1); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-stretch: 125%; font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  padding: 13px 22px; border: 1px solid var(--ink); border-radius: 999px;
  transition: background 0.25s, color 0.25s;
}
.nav-links .btn { padding: 11px 20px; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn .arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

.menu-btn {
  display: none; background: none; border: 1px solid var(--ink); border-radius: 999px;
  font: inherit; font-stretch: 125%; font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink);
  padding: 11px 18px; cursor: pointer;
}

/* ---------- Hero ---------- */

.hero { padding-top: clamp(132px, 15vw, 196px); }

.hero h1 {
  font-size: clamp(2.5rem, 11vw, 9.25rem);
  line-height: 0.94;
  margin-top: clamp(20px, 2.4vw, 32px);
  margin-left: -0.04em;
}
.hero h1 em { font-style: italic; position: relative; white-space: nowrap; display: inline-block; }
.hero h1 .stroke {
  position: absolute; left: -1%; bottom: -0.02em; width: 103%; height: 0.16em;
  overflow: visible; pointer-events: none;
}
.hero h1 .stroke path {
  fill: none; stroke: var(--clay); stroke-width: 3.4; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 1.5s var(--ease) 0.5s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero-photo { margin-top: clamp(40px, 6vw, 80px); }
.hero-photo .frame { overflow: hidden; border-radius: 2px; background: var(--paper-2); aspect-ratio: 2200 / 1162; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 50%; }
.hero-photo figcaption { margin-top: 14px; }

.hero-foot {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px;
  margin-top: clamp(48px, 7vw, 96px);
}
.hero-foot .lede { grid-column: 1 / span 5; }
.stats {
  grid-column: 7 / -1;
  display: grid; grid-template-columns: repeat(4, 1fr); column-gap: 24px;
}
.stat { border-top: 1px solid var(--ink); padding-top: 16px; }
.stat b {
  display: block; font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.5rem, 4.4vw, 4rem); line-height: 1; letter-spacing: -0.02em;
}
.stat span { display: block; margin-top: 10px; font-size: 0.9375rem; line-height: 1.4; color: var(--muted); }

/* ---------- Sections ---------- */

.section { padding-top: var(--section); }
.section-head {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: end;
  padding-bottom: clamp(32px, 4vw, 56px);
}
.section-head .label { grid-column: 1 / span 3; padding-bottom: 0.9em; }
.section-head .label i { font-style: normal; color: var(--clay); margin-right: 10px; }
.section-head h2 { grid-column: 4 / -1; }

/* ---------- Profile ---------- */

.profile { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 48px; }
.profile-photo { grid-column: 1 / span 3; align-self: start; }
.profile-photo .frame { background: var(--paper-2); border-radius: 2px; overflow: hidden; }
.profile-photo img { width: 100%; filter: grayscale(1) contrast(1.04); mix-blend-mode: multiply; }
.profile-photo figcaption { margin-top: 14px; }
.profile-body { grid-column: 4 / span 8; }
.profile-body .statement {
  font-family: var(--serif); font-size: clamp(1.75rem, 3.3vw, 2.875rem);
  line-height: 1.12; letter-spacing: -0.01em; max-width: 22em;
}
.profile-body .statement em { color: var(--clay); }
.profile-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px 48px;
  margin-top: clamp(32px, 4vw, 56px); max-width: 56em;
}
.roles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.roles li {
  border: 1px solid var(--rule); border-radius: 999px; padding: 8px 16px;
  font-size: 0.875rem; line-height: 1.3;
}

/* ---------- Work ---------- */

.work-list { border-top: 1px solid var(--ink); }
.work-item {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: baseline;
  padding: clamp(24px, 3vw, 40px) 0; border-bottom: 1px solid var(--rule);
  position: relative; transition: padding 0.4s var(--ease);
}
.work-item::before {
  content: ""; position: absolute; inset: 0 calc(-1 * var(--gutter) / 2); background: var(--paper-2);
  opacity: 0; transition: opacity 0.3s; z-index: -1; border-radius: 2px;
}
.work-item:hover::before { opacity: 1; }
.work-item .num {
  grid-column: 1 / span 1; font-stretch: 125%; font-weight: 600; font-size: 0.75rem;
  letter-spacing: 0.14em; color: var(--muted); transition: color 0.3s;
}
.work-item:hover .num { color: var(--clay); }
.work-item h3 {
  grid-column: 2 / span 5; font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.75rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -0.01em;
}
.work-item .detail { grid-column: 8 / -1; }
.work-item .detail .label { margin-bottom: 10px; }
.work-item .detail p:last-child { max-width: 34em; }

/* ---------- Journey ---------- */

.journey { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.timeline { grid-column: 4 / -1; position: relative; --progress: 0; }
.timeline::before, .timeline::after {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px; background: var(--rule);
}
.timeline::after {
  background: var(--clay); width: 2px; left: -0.5px;
  transform: scaleY(var(--progress)); transform-origin: top;
}
.timeline li {
  display: grid; grid-template-columns: minmax(120px, 2fr) 7fr; column-gap: 24px; align-items: baseline;
  padding: 0 0 clamp(28px, 3.4vw, 44px) clamp(24px, 3vw, 40px); position: relative;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 0.75em; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--muted); z-index: 1;
  transition: background 0.3s, border-color 0.3s;
}
.timeline li.is-passed::before { background: var(--clay); border-color: var(--clay); }
.timeline .year {
  font-family: var(--serif); font-size: clamp(1.625rem, 2.6vw, 2.25rem); line-height: 1.1; letter-spacing: -0.01em;
}
.timeline p { max-width: 34em; }
.timeline p b { font-weight: 600; }

.eras { grid-column: 4 / -1; display: grid; grid-template-columns: 8fr 13fr 9fr; column-gap: 24px; margin-bottom: clamp(40px, 5vw, 64px); }
.eras li { border-top: 1px solid var(--ink); padding-top: 14px; }
.eras li:nth-child(2) { border-top-color: var(--clay); }
.eras b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(1.375rem, 2.2vw, 1.875rem); line-height: 1.15; margin-top: 8px; letter-spacing: -0.01em; }
.eras li > span:last-child { display: block; margin-top: 4px; font-size: 0.9375rem; color: var(--muted); }

/* ---------- Partners ---------- */

.partners { border-top: 1px solid var(--ink); }
.partners li {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: baseline;
  padding: 18px 0; border-bottom: 1px solid var(--rule);
}
.partners .place { grid-column: 1 / span 3; }
.partners .who { grid-column: 4 / span 4; font-weight: 600; }
.partners .what { grid-column: 8 / -1; color: var(--muted); }

.partners.record .who { font-family: var(--serif); font-weight: 400; font-size: clamp(1.375rem, 2.2vw, 1.875rem); line-height: 1.15; letter-spacing: -0.01em; }
.partners.record .place { font-variant-numeric: tabular-nums; color: var(--muted); }
.partners.record li { padding: 16px 0; }

/* ---------- Teaching ---------- */

.teach { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; row-gap: 56px; }
.teach-intro { grid-column: 4 / span 8; }
.teach-intro .lede { max-width: 34em; }
.topics { grid-column: 4 / span 8; border-top: 1px solid var(--ink); }
.topics li {
  display: flex; gap: 24px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--rule);
  font-family: var(--serif); font-size: clamp(1.375rem, 2.2vw, 1.875rem); line-height: 1.15;
}
.topics li span { font-family: var(--sans); min-width: 2.5em; }
.cred { grid-column: 4 / span 8; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.cred h3 { margin-bottom: 16px; }
.cred li { padding: 12px 0; border-top: 1px solid var(--rule); }
.cred li b { display: block; font-weight: 600; }
.cred li span { display: block; color: var(--muted); font-size: 0.9375rem; }

.ledgers { grid-column: 4 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(48px, 5vw, 72px) 48px; }
.ledger h3 { margin-bottom: 16px; color: var(--ink); }
.ledger li { display: grid; grid-template-columns: 6.75em 1fr; column-gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.ledger li:last-child { border-bottom: 1px solid var(--rule); }
.ledger .yr { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Running (dark) ---------- */

.dark { background: var(--ink); color: var(--paper); margin-top: var(--section); padding: var(--section) 0; }
.dark .label { color: var(--ink-muted); }
.dark .label i { color: var(--clay-soft); }
.run { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: center; row-gap: 56px; }
.run-text { grid-column: 1 / span 6; }
.run-text h2 { margin-top: 24px; font-size: clamp(2.75rem, 7vw, 6rem); }
.run-text h2 em { color: var(--clay-soft); }
.run-text .lede { margin-top: 32px; max-width: 30em; color: #ddd6c9; }
.run-stats { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; max-width: 30em; }
.run-stats li { border-top: 1px solid var(--ink-rule); padding-top: 16px; }
.run-stats b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(2.5rem, 4.4vw, 4rem); line-height: 1; letter-spacing: -0.02em; color: var(--clay-soft); }
.run-stats span { display: block; margin-top: 10px; font-size: 0.9375rem; line-height: 1.4; color: var(--ink-muted); }
.route { grid-column: 9 / span 4; }
.route svg { width: 100%; height: auto; overflow: visible; }
.route path {
  fill: none; stroke: var(--clay-soft); stroke-width: 4.5; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 4.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.route.is-in path { stroke-dashoffset: 0; }
.route circle { fill: var(--paper); }
.route figcaption { margin-top: 20px; }

/* ---------- Writing ---------- */

.writing { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.essay-card { grid-column: 4 / -1; border-top: 1px solid var(--ink); padding-top: clamp(28px, 3vw, 40px); }
.essay-card blockquote {
  font-family: var(--serif); font-size: clamp(1.875rem, 4vw, 3.5rem); line-height: 1.06; letter-spacing: -0.012em;
  max-width: 19em; text-wrap: balance;
}
.essay-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; margin-top: clamp(32px, 4vw, 48px); }
.essay-meta p b { display: block; font-weight: 600; }

.media { grid-column: 4 / -1; margin-top: clamp(48px, 6vw, 80px); max-width: 44em; }
.media h3 { margin-bottom: 12px; color: var(--ink); }

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

.contact { padding: var(--section) 0 clamp(64px, 8vw, 112px); }
.contact h2 { font-size: clamp(2.5rem, 7.4vw, 6.5rem); max-width: 12em; margin-top: 24px; text-wrap: balance; }
.contact h2 em { color: var(--clay); }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; margin-top: clamp(36px, 4vw, 56px); }
.contact .btn { padding: 17px 28px; font-size: 0.8125rem; }

.footer { border-top: 1px solid var(--rule); padding: 40px 0 48px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 32px; }
.footer .sig { width: clamp(180px, 22vw, 280px); }
.footer p { font-size: 0.875rem; color: var(--muted); text-align: right; }

/* ---------- Essay page ---------- */

.article { padding-top: clamp(132px, 15vw, 196px); }
.article-head { max-width: 900px; }
.article-head h1 { font-size: clamp(2.5rem, 8vw, 6rem); margin-top: 24px; text-wrap: balance; }
.article-head .byline { margin-top: 28px; color: var(--muted); }
.article-body { max-width: 680px; margin-top: clamp(48px, 7vw, 88px); margin-left: auto; margin-right: auto; }
.article-body p { font-size: 1.1875rem; line-height: 1.7; }
.article-body p + p { margin-top: 1.4em; }
.article-body p:first-child::first-letter {
  font-family: var(--serif); font-size: 4.6em; line-height: 0.8; float: left; padding: 0.08em 0.1em 0 0; color: var(--clay);
}
.article-foot { max-width: 680px; margin: clamp(48px, 6vw, 80px) auto 0; padding-top: 32px; border-top: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.article-foot .sig { width: 170px; }
.back { padding: var(--section) 0 clamp(64px, 8vw, 112px); text-align: center; }

/* ---------- Reveal ---------- */

.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .hero-foot .lede { grid-column: 1 / -1; max-width: 34em; }
  .stats { grid-column: 1 / -1; margin-top: 48px; }
  .section-head .label { grid-column: 1 / -1; padding-bottom: 16px; }
  .section-head h2 { grid-column: 1 / -1; }
  .profile-photo { grid-column: 1 / span 4; }
  .profile-body { grid-column: 5 / -1; }
  .profile-cols { grid-template-columns: 1fr; }
  .work-item h3 { grid-column: 2 / span 11; }
  .work-item .detail { grid-column: 2 / -1; margin-top: 16px; }
  .timeline, .teach-intro, .topics, .cred, .essay-card, .eras, .ledgers, .media { grid-column: 1 / -1; }
  .timeline { margin-left: 5px; }
  .partners .place { grid-column: 1 / span 4; }
  .partners .who { grid-column: 5 / -1; }
  .partners .what { grid-column: 5 / -1; margin-top: 4px; }
  .run-text { grid-column: 1 / span 7; }
  .route { grid-column: 9 / span 4; }
}

@media (max-width: 960px) {
  .menu-btn { display: block; }
  .nav-links {
    position: fixed; inset: 0; background: var(--paper); flex-direction: column; justify-content: center;
    align-items: flex-start; gap: 6px; padding: 0 var(--gutter);
    opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
  }
  .nav-links a:not(.btn) {
    font-family: var(--serif); font-stretch: 100%; font-weight: 400; font-size: 2.75rem;
    letter-spacing: -0.01em; text-transform: none; line-height: 1.15; padding: 4px 0;
  }
  .nav-links .btn { margin-top: 28px; }
  .nav.is-open .nav-links { opacity: 1; visibility: visible; }
  .nav.is-open { background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .brand, .menu-btn { position: relative; z-index: 2; }
}

@media (max-width: 760px) {
  .hero-photo .frame { aspect-ratio: 4 / 3.4; }
  .stats { grid-template-columns: 1fr 1fr; row-gap: 32px; }
  .profile-photo { grid-column: 1 / span 6; }
  .profile-body { grid-column: 1 / -1; }
  .work-item .num { grid-column: 1 / -1; margin-bottom: 8px; }
  .work-item h3, .work-item .detail { grid-column: 1 / -1; }
  .timeline li { grid-template-columns: 1fr; row-gap: 6px; }
  .partners .place { grid-column: 1 / -1; font-size: 0.875rem; color: var(--muted); }
  .partners .who, .partners .what { grid-column: 1 / -1; }
  .cred, .ledgers { grid-template-columns: 1fr; }
  .eras { grid-template-columns: 1fr; row-gap: 20px; }
  .ledger li { grid-template-columns: 5.75em 1fr; column-gap: 12px; }
  .run-text { grid-column: 1 / -1; }
  .route { grid-column: 3 / span 8; }
  .essay-meta { align-items: flex-start; flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer p { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .hero h1 .stroke path { animation: none; stroke-dashoffset: 0; }
  .route path { transition: none; stroke-dashoffset: 0; }
}
