/* ==========================================================================
   James Olaitan — portfolio styles
   Sections: tokens → reset/base → typography → layout → nav → hero → work →
   experience → contact → about → reading → footer → utilities/motion →
   reduced-motion → responsive
   ========================================================================== */

/* === TOKENS ============================================================== */
:root {
  /* Color (light is the default) */
  --paper:#FAFAF9; --surface:#FFFFFF; --ink:#0E0E10; --ink-2:#4A4A50;
  --muted:#8A8A90; --hairline:#E8E8E6;
  --accent:#1E3AFF; --accent-solid:#1E3AFF; --accent-press:#1730C9;
  --accent-wash:rgba(30,58,255,0.06); --on-accent:#FFFFFF;

  /* Type */
  --font-sans:'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --font-serif:'IBM Plex Serif', Georgia, serif;

  --t-display:clamp(2.5rem, 6vw, 4rem);
  --t-h2:clamp(1.5rem, 3vw, 1.875rem);
  --t-h3:1.25rem;
  --t-body:1.0625rem;
  --t-small:0.9375rem;
  --t-meta:0.8125rem;

  /* Spacing (4px base) */
  --space-1:0.25rem; --space-2:0.5rem; --space-3:0.75rem; --space-4:1rem;
  --space-6:1.5rem; --space-8:2rem; --space-12:3rem;
  --section-pad:clamp(4rem, 10vh, 7rem);
  --gutter:clamp(1.25rem, 5vw, 2rem);

  /* Sizing */
  --maxw:760px; --maxw-wide:1080px; --nav-h:64px;
  --radius:8px; --radius-sm:6px;

  /* Motion */
  --dur:0.5s; --dur-fast:0.18s; --ease:cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --paper:#0D0D0F; --surface:#151517; --ink:#F4F4F2; --ink-2:#B5B5BC;
  --muted:#7A7A82; --hairline:#26262A;
  --accent:#6B86FF; --accent-solid:#3050FF; --accent-press:#5B79FF;
  --accent-wash:rgba(107,134,255,0.10); --on-accent:#FFFFFF;
}

/* === RESET / BASE ======================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

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

code {
  font: 400 0.9em var(--font-mono);
  color: var(--ink);
  background: var(--accent-wash);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* === TYPOGRAPHY HELPERS ================================================== */
.section__heading {
  font: 500 var(--t-h2)/1.15 var(--font-sans);
  color: var(--ink);
  margin: 0 0 var(--space-8);
  letter-spacing: -0.01em;
}

/* === LAYOUT ============================================================== */
.container {
  width: 100%;
  max-width: var(--maxw-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--maxw); }

.section { padding: var(--section-pad) 0; }

/* === NAV ================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--nav-h);
}
.nav__brand {
  margin-right: auto;
  font: 500 var(--t-body)/1 var(--font-sans);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav__brand:hover { color: var(--accent); }

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  padding: 0;
}
.nav__link {
  font: 400 var(--t-small)/1 var(--font-sans);
  color: var(--ink);
  text-decoration: none;
}
.nav__link:hover { color: var(--accent); }

.nav__actions { display: flex; align-items: center; gap: var(--space-2); }

.theme-toggle, .nav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.theme-toggle:hover, .nav__toggle:hover {
  color: var(--accent);
  background: var(--accent-wash);
}
.nav__toggle { display: none; }

/* Sun/moon swap by theme */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

/* === HERO ================================================================ */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100svh - var(--nav-h));
  padding: 4rem 0 5rem;
}
/* Cobalt wash — bottom 40% only, a whisper. */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40%;
  background: linear-gradient(to top, var(--accent-wash), transparent);
  pointer-events: none;
  z-index: 0;
}
.hero__inner { position: relative; z-index: 1; }

.hero__headline {
  font: 500 var(--t-display)/1.1 var(--font-sans);
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 20ch;
  margin-bottom: var(--space-6);
}
.name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.hero__role {
  font-size: var(--t-h2);
  color: var(--ink-2);
  max-width: 40ch;
  margin-bottom: var(--space-2);
}
.hero__supporting {
  font-size: var(--t-body);
  color: var(--ink-2);
  max-width: 48ch;
  margin-bottom: var(--space-4);
}
.hero__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font: 400 var(--t-meta)/1.4 var(--font-mono);
  color: var(--muted);
  margin-bottom: var(--space-8);
}
.hero__meta .icon-pin { color: var(--muted); flex: none; }

.hero__actions { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }

/* === BUTTONS / LINKS ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 500 var(--t-small)/1 var(--font-sans);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.btn--solid {
  background: var(--accent-solid);
  color: var(--on-accent);
  padding: 0.8rem 1.4rem;
}
.btn--solid:hover { background: var(--accent-press); }
.btn--quiet {
  color: var(--ink-2);
  padding: 0.8rem 0.25rem;
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 4px;
}
.btn--quiet:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* === WORK ================================================================ */
.work__list { display: flex; flex-direction: column; }
.project {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 42%);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 2.5rem) 0;
  border-top: 1px solid var(--hairline);
  color: inherit;
  text-decoration: none;
}
.project:last-child { border-bottom: 1px solid var(--hairline); }

.project__title {
  font: 500 var(--t-h3)/1.2 var(--font-sans);
  color: var(--ink);
  margin-bottom: var(--space-2);
}
.project:hover .project__title,
.project:focus-visible .project__title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.project__blurb {
  font-size: var(--t-body);
  color: var(--ink-2);
  max-width: 52ch;
  margin-bottom: var(--space-3);
}
.project__meta {
  display: flex;
  flex-wrap: wrap;
  font: 400 var(--t-meta)/1.5 var(--font-mono);
  color: var(--muted);
  margin-bottom: var(--space-3);
}
.project__meta-item:not(:last-child)::after {
  content: "·";
  padding: 0 0.5rem;
  color: var(--muted);
}
.project__source {
  font: 500 var(--t-meta)/1 var(--font-mono);
  color: var(--accent);
}

.project__media { position: relative; }
.project__img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
.project__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 var(--t-small)/1 var(--font-mono);
  color: var(--on-accent);
  background: color-mix(in srgb, var(--accent-solid) 86%, transparent);
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.project:hover .project__overlay,
.project:focus-visible .project__overlay { opacity: 1; }

/* === EXPERIENCE ========================================================== */
.experience__list { display: flex; flex-direction: column; }
.exp {
  padding: clamp(1.75rem, 4vw, 2.5rem) 0;
  border-top: 1px solid var(--hairline);
}
.exp:last-child { border-bottom: 1px solid var(--hairline); }

.exp__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.exp__logo { height: 30px; width: auto; }
.exp__brand-name { font: 500 var(--t-h3)/1 var(--font-sans); color: var(--ink); }
.exp__when {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
}
.exp__dates {
  font: 400 var(--t-meta)/1.3 var(--font-mono);
  color: var(--muted);
  text-align: right;
}
.pill {
  font: 500 var(--t-meta)/1 var(--font-mono);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  white-space: nowrap;
}

.exp__role { font: 500 var(--t-h3)/1.25 var(--font-sans); color: var(--ink); margin-bottom: 0.15rem; }
.exp__company { font-size: var(--t-small); color: var(--ink-2); margin-bottom: var(--space-3); }
.exp__impact { font-size: var(--t-body); color: var(--ink-2); max-width: 64ch; margin-bottom: var(--space-4); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0; }
.tag {
  font: 400 var(--t-meta)/1 var(--font-mono);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.65rem;
}

/* The one bordered-card pattern in the design. */
.artifact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  margin-top: var(--space-4);
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.artifact:hover { border-color: var(--accent); color: var(--accent); }
.artifact__icon { color: var(--accent); flex: none; }
.artifact__title { font-size: var(--t-small); font-weight: 500; }
.artifact__host { font: 400 var(--t-meta)/1 var(--font-mono); color: var(--muted); }

/* === CONTACT ============================================================= */
.contact { border-top: 1px solid var(--hairline); }
.contact__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-6);
}
.contact__line {
  font: 500 var(--t-h2)/1.3 var(--font-sans);
  color: var(--ink);
  max-width: 26ch;
}

/* === ABOUT =============================================================== */
.about__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--hairline);
  margin-bottom: var(--space-8);
}
.prose p {
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--ink-2);
  margin-bottom: var(--space-6);
}
.about__footer {
  font-style: italic;
  color: var(--ink);
  margin-top: var(--space-8);
}

/* === READING ============================================================= */
.reading-page__intro {
  font-size: var(--t-body);
  color: var(--ink-2);
  max-width: 60ch;
  margin-bottom: var(--space-12);
}
.reading-group { margin-bottom: var(--space-12); }
.reading-group__label {
  font: 500 var(--t-meta)/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: var(--space-2);
}
.reading-group__items { display: flex; flex-direction: column; }

.reading {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--hairline);
}
.reading__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}
.reading__title { font: 500 var(--t-h3)/1.3 var(--font-sans); color: var(--ink); }
.reading__link { color: var(--accent); text-decoration: none; }
.reading__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.reading__author { display: block; font-size: var(--t-small); color: var(--muted); margin-top: 0.15rem; }
.reading__source {
  font: 500 var(--t-meta)/1 var(--font-mono);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}
.reading__blurb { font-size: var(--t-body); color: var(--ink-2); max-width: 64ch; margin-top: var(--space-2); }

.thoughts { margin-top: var(--space-3); }
.thoughts__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: 500 var(--t-meta)/1 var(--font-mono);
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  width: fit-content;
}
.thoughts__toggle::-webkit-details-marker { display: none; }
.thoughts__toggle::before { content: "+"; font-weight: 500; }
.thoughts[open] .thoughts__toggle::before { content: "–"; }
.thoughts__body {
  margin-top: var(--space-3);
  padding-left: var(--space-4);
  border-left: 2px solid var(--hairline);
  font-size: var(--t-small);
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 64ch;
}
.thoughts[open] .thoughts__body { animation: reveal-in var(--dur) var(--ease); }

/* === FOOTER ============================================================== */
.site-footer { border-top: 1px solid var(--hairline); padding: var(--space-12) 0; }
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-footer__line {
  font: 400 var(--t-meta)/1.4 var(--font-mono);
  color: var(--muted);
}
.site-footer__links { display: flex; align-items: center; gap: var(--space-2); }
.site-footer__links a {
  font: 400 var(--t-meta)/1.4 var(--font-mono);
  color: var(--muted);
  text-decoration: none;
}
.site-footer__links a:hover { color: var(--accent); }
.site-footer__sep { font: 400 var(--t-meta)/1.4 var(--font-mono); color: var(--muted); }

/* === UTILITIES / MOTION ================================================== */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -3.5rem;
  z-index: 100;
  background: var(--accent-solid);
  color: var(--on-accent);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top var(--dur-fast);
}
.skip-link:focus { top: var(--space-2); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Scroll-reveal — only active when JS is present, so content is never hidden
   without it. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* === REDUCED MOTION ====================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* === RESPONSIVE ========================================================== */
@media (max-width: 720px) {
  .nav__toggle { display: inline-flex; }

  .nav__links {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    padding: var(--space-2) var(--gutter) var(--space-4);
  }
  .nav__links.is-open { display: flex; }
  .nav__link { display: block; padding: var(--space-3) 0; }

  /* Project rows stack; image below text. */
  .project { grid-template-columns: 1fr; align-items: start; }

  .reading__head { flex-direction: column; gap: var(--space-1); }
}
