/* Albert Rweyemamu — personal site
   Type: Instrument Serif (display) + Geist (body) + JetBrains Mono (meta)
   Colors: near-black bg, warm off-white fg, deep gold accent */

:root {
  --bg: #0a0a0a;
  --bg-elev: #141414;
  --bg-paper: #1a1a1a;
  --fg: #f3efe7;
  --fg-dim: #a8a39a;
  --fg-mute: #6b6761;
  --rule: #2a2824;
  --gold: #b8862f;
  --gold-soft: #8a6624;
  --warn: #c94a3a;

  --serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --sans: 'Geist', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --max: 1440px;
  --gutter: clamp(20px, 4vw, 64px);
}

/* LIGHT MODE (warm paper) */
[data-theme="light"] {
  --bg: #efeae0;
  --bg-elev: #e6e1d6;
  --bg-paper: #ded8cb;
  --fg: #1a1815;
  --fg-dim: #5c5850;
  --fg-mute: #8a857b;
  --rule: #cec7b8;
  --gold: #8a6624;
  --gold-soft: #b8862f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body { min-height: 100vh; }

/* --- Typography --- */
.display {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-style: normal;
}
.display.italic { font-style: italic; }
.italic { font-style: italic; }

h1.display { font-size: clamp(64px, 11vw, 180px); }
h2.display { font-size: clamp(48px, 7.5vw, 112px); }
h3.display { font-size: clamp(32px, 4vw, 64px); }

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-mute);
  font-weight: 400;
}

.lead {
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1.35;
  color: var(--fg);
  font-style: italic;
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  width: 100%;
}

/* --- Layout --- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- Nav --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.nav.scrolled { border-bottom-color: var(--rule); }

.nav-brand {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.nav-brand .mark {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--gold);
  border-radius: 50%;
  transform: translateY(-2px);
}

.nav-links {
  display: flex;
  gap: 36px;
  align-items: center;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--fg); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0; right: 0;
  height: 1px;
  background: var(--gold);
}

.nav-cta {
  padding: 10px 18px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg);
  text-decoration: none;
  transition: all 0.2s;
  background: transparent;
  cursor: pointer;
}
.nav-cta:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.nav-cta.gold { border-color: var(--gold); color: var(--gold); }
.nav-cta.gold:hover { background: var(--gold); color: var(--bg); border-color: var(--gold); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--fg);
  transition: all 0.2s ease;
}
.btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary { background: var(--gold); color: #0a0a0a; border-color: var(--gold); }
.btn.primary:hover { background: #d4a244; border-color: #d4a244; color: #0a0a0a; }
.btn .arrow { transition: transform 0.2s; }
.btn:hover .arrow { transform: translateX(4px); }

/* --- Sections --- */
section { padding: 120px 0; position: relative; }
section + section { border-top: 1px solid var(--rule); }

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}
.section-label .dot {
  width: 6px; height: 6px; background: var(--gold); border-radius: 50%;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--rule);
  padding: 80px var(--gutter) 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 80px;
}
.footer-grid h4 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-mute);
  margin-bottom: 20px;
  font-weight: 400;
}
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 10px; }
.footer-grid a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.footer-grid a:hover { color: var(--gold); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 30px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.footer-mark {
  font-family: var(--serif);
  font-size: 80px;
  line-height: 1;
  color: var(--fg);
  font-style: italic;
  margin-bottom: 24px;
}

/* --- Utility --- */
.link-underline {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s;
  padding-bottom: 2px;
}
.link-underline:hover { background-size: 100% 2px; }

/* entrance anims */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(.2,.7,.2,1), transform 0.8s cubic-bezier(.2,.7,.2,1);
}
.fade-up.in { opacity: 1; transform: translateY(0); }

.slide-left {
  opacity: 0;
  transform: translateX(-44px);
  transition: opacity 0.9s cubic-bezier(.2,.7,.2,1), transform 0.9s cubic-bezier(.2,.7,.2,1);
}
.slide-left.in { opacity: 1; transform: translateX(0); }

.slide-right {
  opacity: 0;
  transform: translateX(44px);
  transition: opacity 0.9s cubic-bezier(.2,.7,.2,1), transform 0.9s cubic-bezier(.2,.7,.2,1);
}
.slide-right.in { opacity: 1; transform: translateX(0); }

/* Keyboard focus — visible for all interactive elements */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .fade-up, .slide-left, .slide-right { transition: opacity 0.3s; transform: none !important; }
}

.char {
  display: inline-block;
  opacity: 0;
  transform: translateY(40%);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(.2,.7,.2,1);
}
.char.in { opacity: 1; transform: translateY(0); }

/* --- Portrait photo --- */
.portrait-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
}

/* --- Topographic canvas --- */
.topo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.66;
}

/* --- Loader --- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s;
}
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-name {
  font-family: var(--serif);
  font-size: clamp(48px, 9vw, 140px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--fg);
}
.loader-meta {
  position: absolute;
  bottom: 40px; left: 40px; right: 40px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.loader-progress {
  width: 120px;
  height: 1px;
  background: var(--rule);
  margin-top: 32px;
  overflow: hidden;
}
.loader-progress-bar {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 0.1s linear;
}

/* Hide scrollbar during loader */
body.loading { overflow: hidden; }

/* Mobile nav */
@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav { padding: 16px var(--gutter); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  section { padding: 80px 0; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; align-items: flex-start; }
}
