/*
  ============================================================
  STYLES: colors, fonts & spacing live in the :root variables
  below. Change a variable here and it updates the whole site.
  You usually won't need to touch anything past the variables
  section unless you want to change the layout itself.
  ============================================================

  TYPE SYSTEM
  Two fonts, two jobs:
  - Crimson Pro (serif) is for anything the visitor actually reads:
    the hero name/bio, article titles and body copy, card/list
    titles that link to writing, pull-quotes.
  - Inter (sans) is for interface chrome: navigation, buttons,
    badges/flairs, meta lines, form controls, section dividers,
    and structured data (the resume timeline).
  A single --text-* scale is shared by both, so every element's
  size is chosen from the same ladder instead of one-off values.
*/

:root {
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Type scale — each step has one job. Nothing meant to be read as a
     full sentence sits below 16px; badges/labels/meta can go to 14px. */
  --text-2xs: 0.75rem;   /* 12px — rarely used micro text */
  --text-xs:  0.875rem;  /* 14px — badges, flairs, meta, captions, form labels */
  --text-sm:  1rem;      /* 16px — buttons, nav, card/list titles, form inputs */
  --text-md:  1.125rem;  /* 18px — reading paragraphs (bio, article body) */
  --text-lg:  1.375rem;  /* 22px — dek, pull-quotes, in-article h3 */
  --text-xl:  1.75rem;   /* 28px — section labels, in-article h2 */
  --text-2xl: 2.125rem;  /* 34px — unused headroom for future headings */
  --text-3xl: 2.625rem;  /* 42px — hero name / article title, mobile */
  --text-4xl: 3.375rem;  /* 54px — hero name / article title, desktop */

  /* Palette — core blues, impressionist undertones, warm accents, warm neutrals */
  --color-indigo: #2C3E66;    /* deep indigo — headings, dark base */
  --color-cerulean: #3E7CB1;  /* primary brand blue */
  --color-sky: #A9C9DD;       /* soft sky — large surfaces, soft tints */
  --color-lavender: #B8A9C9;  /* lavender mist — shadows, subtle gradients */
  --color-sage: #8FA998;      /* sage green — secondary UI elements */
  --color-ochre: #D9A441;     /* golden ochre — CTAs, buttons, links-as-action */
  --color-coral: #E8A87C;     /* soft coral — secondary accent */
  --color-warm-white: #F7F4EE;
  --color-charcoal: #334155;
  --color-charcoal-faded: #7c8593;

  /* Semantic aliases used throughout the site */
  --color-bg: var(--color-warm-white);
  --color-text-heading: var(--color-indigo);
  --color-text-body: var(--color-charcoal);
  --color-text-body-faded: var(--color-charcoal-faded);
  --color-border: #E4DECF;
  --color-accent: var(--color-cerulean);
  --color-accent-strong: #2C5E85;  /* darker cerulean, for text set on light tints */
  --color-accent-soft: var(--color-sky);
  --color-cta: var(--color-ochre);
  --color-surface-soft: #EDF3F8;       /* light cerulean/sky tint — panels, tracks */
  --color-surface-soft-hover: #DCEAF3;
  --badge-gradient: linear-gradient(to right, var(--color-cerulean), var(--color-sky));

  /* Decorative background blobs — soft, overlapping color fields (dappled
     light, the way an impressionist canvas blends several hues in one
     brushed area rather than a single flat tint). */
  --blob-top-gradient: radial-gradient(circle at 32% 28%, rgba(217,164,65,0.20), rgba(62,124,177,0.22) 45%, rgba(184,169,201,0.15) 78%, transparent 100%);
  --blob-bottom-gradient: radial-gradient(circle at 68% 72%, rgba(143,169,152,0.22), rgba(169,201,221,0.26) 45%, rgba(232,168,124,0.14) 78%, transparent 100%);
  --blob-mid-gradient: radial-gradient(circle at 50% 50%, rgba(184,169,201,0.16), rgba(232,168,124,0.12) 55%, transparent 80%);
  --blob-accent1-gradient: radial-gradient(circle at 35% 35%, rgba(143,169,152,0.24), rgba(169,201,221,0.16) 60%, transparent 100%);
  --blob-accent2-gradient: radial-gradient(circle at 65% 65%, rgba(232,168,124,0.24), rgba(217,164,65,0.16) 60%, transparent 100%);

  --shadow-sm: 0 1px 2px rgba(44,62,102,0.06);
  --shadow-md: 0 4px 12px rgba(44,62,102,0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--font-sans);
}

h1, h2, h3, h4 { font-weight: 700; margin: 0; }

/* Default hyperlink color for plain <a> tags in prose (article body, bio,
   callouts, etc.) — matches the accent blue used by nav links, card
   titles, and timeline markers elsewhere on the site. Class-based link
   styles (.article-back, .main-nav-link, .link-card, .social-link, ...)
   are more specific and take precedence over this, unaffected. */
a {
  color: var(--color-accent);
}
a:hover {
  color: var(--color-accent-strong);
}

.page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

/* Decorative gradient blurs, fixed to the viewport so they read as a
   background layer the page content scrolls over. Each one drifts on
   scroll and on mouse movement (see js/background.js), at a different
   rate/direction, for a soft parallax depth effect. Organic (non-circular)
   radii keep them from reading as neat geometric discs — closer to a
   soft, brushed bloom of color. */
.blob {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 58% 42% 53% 47% / 48% 60% 40% 52%;
  filter: blur(95px);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.15s ease-out;
  will-change: transform;
}
.blob-top {
  top: 0;
  right: 0;
  background: var(--blob-top-gradient);
}
.blob-bottom {
  bottom: 0;
  left: 0;
  background: var(--blob-bottom-gradient);
}

/* Third, quieter color bloom drifting through the middle of the canvas */
.blob-mid {
  top: 30%;
  left: 50%;
  width: 28rem;
  height: 28rem;
  transform: translate(-50%, -50%);
  border-radius: 45% 55% 60% 40% / 55% 45% 55% 45%;
  background: var(--blob-mid-gradient);
  filter: blur(100px);
}

/* Two more, smaller blooms in the remaining corners, so the color field
   reads as several small particles instead of two big washes */
.blob-accent1 {
  top: 0;
  left: 0;
  width: 18rem;
  height: 18rem;
  border-radius: 52% 48% 60% 40% / 40% 55% 45% 60%;
  background: var(--blob-accent1-gradient);
  filter: blur(85px);
}
.blob-accent2 {
  bottom: 0;
  right: 0;
  width: 18rem;
  height: 18rem;
  border-radius: 44% 56% 40% 60% / 58% 42% 60% 40%;
  background: var(--blob-accent2-gradient);
  filter: blur(85px);
}

/* Fine canvas-grain texture over the whole page, like tooth in painted
   canvas catching soft light. Self-contained SVG noise, no image request. */
.page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container {
  position: relative;
  z-index: 1;
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
@media (min-width: 768px) {
  .container { padding: 4.5rem 1.5rem; }
}

/* Homepage font and atmosphere overrides leave standalone article styling intact. */
.home-page {
  --font-serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --color-text-body-faded: #626D7C;
}
.home-page .blob { opacity: 0.45; }
.home-page .page::after { opacity: 0.025; }

.home-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "profile navigation" "profile content";
  column-gap: clamp(2rem, 4.5vw, 4rem);
  row-gap: 2rem;
  align-items: start;
  max-width: 72rem;
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}
.home-profile { grid-area: profile; min-width: 0; }
.home-content { grid-area: content; min-width: 0; container-type: inline-size; }
.home-profile .social-section { margin-top: 2rem; }
.home-profile .section-label { font-size: var(--text-xs); font-weight: 500; }
.content-heading {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--color-text-heading);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.content-heading:focus { outline: none; }
.section-label.journey-label { margin: 2.5rem 0 1.25rem; font-size: var(--text-sm); font-weight: 600; }
.empty-section { font-family: var(--font-serif); }

:focus-visible {
  outline: 3px solid var(--color-accent-strong);
  outline-offset: 4px;
}

/* Hero */
.hero-photo {
  display: block;
  width: 6.5rem;
  height: 6.5rem;
  margin-bottom: 1.25rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.hero-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: var(--color-text-body);
  margin: 0 0 1.25rem;
}
.hero-subtitle span:last-child { flex-basis: 100%; color: var(--color-text-body-faded); font-weight: 400; }

.hero-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text-heading);
  margin-bottom: 0.75rem;
}

.bio { display: flex; flex-direction: column; gap: 0.75rem; }
.bio p {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--color-text-body);
  margin: 0;
}

/* Word-flip typewriter target in the bio (see js/word-flip.js) */
.flip-word {
  color: var(--color-accent-strong);
  font-weight: 700;
}
.flip-word::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: currentColor;
  vertical-align: -0.15em;
  animation: flip-word-cursor 1s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .flip-word::after { animation: none; }
}
@keyframes flip-word-cursor {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* Section labels */
.section-label {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
  margin-bottom: 0.75rem;
}

/* Highlight boxes (nested inside timeline entries) */
.highlight-card {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
}
.highlight-stat {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent-strong);
  margin-bottom: 0.25rem;
}
.highlight-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-body);
}

/* Timeline — structured resume data, kept in the sans/UI voice */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; align-items: flex-start; }
.timeline-year {
  flex-shrink: 0;
  width: 4.5rem;
  padding-top: 0.25rem;
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-accent);
}
.timeline-content {
  flex-grow: 1;
  min-width: 0;
  border-left: 2px solid var(--color-border);
  padding: 0 0 1.75rem 1.25rem;
  transition: border-color 0.2s ease;
}
.timeline-item:last-child .timeline-content { padding-bottom: 0; }
.timeline-item:hover .timeline-content { border-color: var(--color-accent-soft); }
.timeline-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-text-heading);
  margin-bottom: 0.375rem;
}
.timeline-role {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-body-faded);
  margin: 0 0 0.75rem;
}
.timeline-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.75rem;
}

/* About me */
.about-intro { max-width: 65ch; }
.about-intro p {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--text-md);
  line-height: 1.65;
  color: var(--color-text-body);
  margin: 0 0 1rem;
}
.about-intro p:last-child { margin-bottom: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .page *, .page *::before, .page *::after { transition: none; }
}

/* Main section navigation */
.main-nav {
  grid-area: navigation;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem clamp(0.75rem, 2.5vw, 2rem);
  border-bottom: 1px solid var(--color-border);
}
.main-nav-link {
  border-bottom: 2px solid transparent;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-body);
  padding: 0.75rem 0;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.main-nav-link:hover { color: var(--color-text-heading); }
.main-nav-link[aria-current="page"] {
  color: var(--color-accent-strong);
  border-bottom-color: var(--color-accent-strong);
}

/* Article and project cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.link-card {
  display: block;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.link-card:hover {
  border-color: var(--color-accent-soft);
  box-shadow: var(--shadow-sm);
}
.link-card-thumb-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--badge-gradient);
}
.link-card-thumb {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--badge-gradient);
}
.link-card-body { padding: 1.25rem; }
.link-card-flair {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}
.link-card-flair.flair-c0 { background: #E3EEF6; color: #2C5E85; } /* cerulean */
.link-card-flair.flair-c1 { background: #E8EFE9; color: #4F6B58; } /* sage */
.link-card-flair.flair-c2 { background: #FBF0DC; color: #8C6423; } /* ochre */
.link-card-flair.flair-c3 { background: #FBEEE4; color: #A15A34; } /* coral */
.link-card-flair.flair-c4 { background: #EFEAF3; color: #6B5480; } /* lavender */
.link-card-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-heading);
  margin: 0;
}
.link-card-subtitle {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-body-faded);
  margin: 0.625rem 0 0;
}
.link-card-reads {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--color-text-body-faded);
  margin: 0.5rem 0 0;
}

/* Featured card — the first article or project */
.link-card-featured {
  grid-column: 1 / -1;
}
@container (min-width: 36rem) {
  .link-card-featured {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
  }
  .link-card-featured .link-card-thumb-frame { min-height: 14rem; height: 100%; aspect-ratio: auto; }
}
.link-card-featured .link-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.link-card-featured .link-card-title { font-size: var(--text-xl); line-height: 1.2; }

/* Recommendations list (grouped by topic, with favicons) */
.rec-groups { display: flex; flex-direction: column; gap: 2rem; }
.rec-group-title {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  margin: 0 0 0.625rem;
}
.rec-list { display: flex; flex-direction: column; gap: 0.5rem; }
.rec-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.625rem;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.rec-item:hover {
  border-color: var(--color-accent-soft);
  box-shadow: var(--shadow-sm);
}
.rec-favicon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
}
.rec-item-body { min-width: 0; }
.rec-item-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-heading);
  margin: 0;
}
.rec-item-meta {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-body-faded);
  line-height: 1.5;
  margin: 0.375rem 0 0;
}

/* Social links */
.social-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-body);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, box-shadow 0.2s ease;
  text-decoration: none;
}
.social-link:hover {
  color: var(--color-accent-strong);
  background: var(--color-surface-soft);
  box-shadow: var(--shadow-md);
}
.social-link svg {
  color: inherit;
  transition: color 0.3s ease;
}

/* Put navigation first and stack the profile above content on smaller screens. */
@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "navigation" "profile" "content";
    max-width: 44rem;
    padding: 1.5rem 1.5rem 3rem;
    row-gap: 2rem;
  }
  .main-nav { justify-content: space-between; column-gap: 0.5rem; }
  .hero { display: grid; grid-template-columns: 5rem minmax(0, 1fr); column-gap: 1.25rem; }
  .hero-photo { width: 5rem; height: 5rem; grid-row: 1 / 3; margin: 0; }
  .hero-name { grid-column: 2; font-size: var(--text-xl); align-self: end; }
  .hero-subtitle { grid-column: 2; margin-bottom: 0; }
  .bio { grid-column: 1 / -1; margin-top: 1.25rem; }
  .home-profile .social-section { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.25rem; }
  .home-profile .section-label { margin: 0; }
  .home-profile { padding-bottom: 2rem; border-bottom: 1px solid var(--color-border); }
}
@media (max-width: 480px) {
  .home-layout { padding: 1rem 1.25rem 3rem; }
  .hero { column-gap: 1rem; }
  .hero-subtitle { font-size: var(--text-2xs); }
  .cards-grid { grid-template-columns: minmax(0, 1fr); }
  .timeline-item { flex-direction: column; }
  .timeline-year { width: auto; margin-bottom: 0.25rem; }
  .timeline-content { border-left: none; border-top: 2px solid var(--color-border); padding: 1rem 0 1.5rem 0; }
}
@media (max-width: 380px) {
  .main-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
}
