/* =====================================================================
   yuelinou.com
   Shared stylesheet for all pages.
   Visual system: warm cream paper · Playfair Display serif headers ·
   Source Sans 3 body · JetBrains Mono for metadata · single-column,
   editorial rhythm.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Design tokens
   --------------------------------------------------------------------- */

:root {
  /* Color */
  --paper:        #faf9f7;
  --paper-card:   #fdfcf8;
  --warm:         #f5f0eb;
  --ink:          #1c1c1a;
  --muted:        #585853;
  --muted-soft:   #8a877f;
  --divider:      #d4d0cb;
  --divider-soft: #e6e1d9;
  --accent:       #2c5f6e;
  --accent-soft:  #e8eff2;

  /* Typography */
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Type scale */
  --text-xs:   0.7rem;
  --text-sm:   0.85rem;
  --text-base: 1.0625rem;
  --text-md:   1.125rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-3xl:  2.5rem;
  --text-4xl:  3.25rem;

  /* Spacing (8px base) */
  --space-1:  0.5rem;
  --space-2:  1rem;
  --space-3:  1.5rem;
  --space-4:  2rem;
  --space-5:  2.5rem;
  --space-6:  3rem;
  --space-8:  4rem;
  --space-10: 5rem;
  --space-12: 6rem;
  --space-16: 8rem;

  /* Layout */
  --container:        1060px;
  --container-narrow: 760px;
}

/* ---------------------------------------------------------------------
   Reset and base
   --------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-md);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}
a:hover { color: var(--ink); }

::selection { background: var(--accent-soft); color: var(--ink); }

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

/* Subtle paper texture */
.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Visually hidden (for accessibility) */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------
   Layout containers
   --------------------------------------------------------------------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ---------------------------------------------------------------------
   Site navigation (top of every page)
   --------------------------------------------------------------------- */

.site-nav {
  padding: var(--space-4) 0 var(--space-3);
}

.site-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.site-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.site-name a { color: var(--ink); }
.site-name a:hover { color: var(--accent); }

.site-nav-links {
  display: flex;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.site-nav-links a {
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.site-nav-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.site-nav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------------
   Typography utilities
   --------------------------------------------------------------------- */

.label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

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

/* Status badges — typographic, not pills */
.status-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.status-badge.in-prep { color: var(--muted-soft); }
.status-badge.live    { color: var(--accent); }

/* ---------------------------------------------------------------------
   Page intro (interior pages: writing, about, project detail)
   --------------------------------------------------------------------- */

.page-intro {
  padding: var(--space-6) 0 var(--space-5);
}

.page-intro .page-eyebrow {
  display: block;
  margin-bottom: var(--space-2);
}

.page-intro h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 4.5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--space-2);
}

.page-intro .page-tagline {
  font-size: var(--text-lg);
  color: var(--muted);
  line-height: 1.5;
  font-weight: 400;
  max-width: 36em;
}

/* ---------------------------------------------------------------------
   Hero (home only)
   --------------------------------------------------------------------- */

.hero {
  padding: var(--space-4) 0 var(--space-8);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-8);
  align-items: center;
}

.hero-rule {
  width: 48px;
  height: 2px;
  background: var(--accent);
  margin-bottom: var(--space-3);
  animation: expand-rule 0.7s ease-out forwards;
}

@keyframes expand-rule { from { width: 0; } to { width: 48px; } }

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--space-3);
}

.hero-tagline {
  font-size: var(--text-lg);
  color: var(--muted);
  line-height: 1.55;
  font-weight: 400;
  max-width: 38em;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink);
  padding: 11px 22px;
  border: 1px solid var(--divider);
  border-radius: 4px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.hero-cta:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.hero-cta-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}
.hero-cta:hover .hero-cta-arrow {
  transform: translateX(3px);
}

.hero-photo img {
  width: 240px;
  height: 300px;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 4px;
  box-shadow: 0 10px 32px rgba(28, 28, 26, 0.10), 0 2px 8px rgba(28, 28, 26, 0.05);
}

/* ---------------------------------------------------------------------
   Generic content section
   --------------------------------------------------------------------- */

.section {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--divider);
}

.section-eyebrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.section-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.section-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------------
   Project grid (home)
   --------------------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: var(--space-4);
  color: inherit;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  height: 100%;
  text-decoration: none;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(28, 28, 26, 0.06);
  color: inherit;
}

.project-card-status {
  margin-bottom: var(--space-2);
}

.project-card h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: var(--space-1);
  color: var(--ink);
}

.project-card-tagline {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: var(--space-3);
  flex-grow: 1;
}

.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-3);
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 3px;
}

.project-card-cta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  border-top: 1px solid var(--divider-soft);
  padding-top: var(--space-2);
  margin-top: auto;
}

/* ---------------------------------------------------------------------
   Now block (home)
   --------------------------------------------------------------------- */

.now-block {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-5);
  align-items: start;
}

.now-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  line-height: 1.9;
}

.now-meta .now-meta-label {
  color: var(--accent);
  display: block;
  margin-bottom: var(--space-1);
}

.now-text p {
  font-size: var(--text-md);
  color: var(--ink);
  line-height: 1.7;
  margin-bottom: var(--space-2);
  max-width: 38em;
}
.now-text p:last-child { margin-bottom: 0; }

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

.writing-list {
  display: flex;
  flex-direction: column;
}

.writing-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--divider-soft);
}
.writing-item:first-child { padding-top: 0; }
.writing-item:last-child { border-bottom: none; padding-bottom: 0; }

.writing-status {
  margin-bottom: var(--space-1);
}

.writing-item h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.25;
  margin-bottom: var(--space-2);
  color: var(--ink);
  max-width: 32em;
}

.writing-item-abstract {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: 1.65;
  max-width: 38em;
}

/* On the dedicated /writing page, give items a touch more breathing room */
.writing-page .writing-item {
  padding: var(--space-4) 0;
}

/* ---------------------------------------------------------------------
   Project detail page
   --------------------------------------------------------------------- */

.project-detail {
  padding: var(--space-4) 0 var(--space-10);
}

.project-detail-header {
  margin-bottom: var(--space-6);
}

.project-detail-header .project-status {
  margin-bottom: var(--space-2);
}

.project-detail-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 4.5vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--space-2);
}

.project-detail-header .project-tagline {
  font-size: var(--text-lg);
  color: var(--muted);
  line-height: 1.5;
  font-weight: 400;
  max-width: 36em;
}

.project-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--divider-soft);
}

.project-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.project-section h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.prose p {
  font-size: 1.1875rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: var(--space-3);
  max-width: 38em;
}
.prose p:last-child { margin-bottom: 0; }

.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--accent);
  background: var(--warm);
  padding: 1px 6px;
  border-radius: 3px;
}

/* Lists in prose: clean, separator-style */
.prose ul {
  list-style: none;
  padding: 0;
  max-width: 38em;
  margin: var(--space-2) 0 var(--space-3);
}
.prose li {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  padding: 10px 0 10px 22px;
  position: relative;
  border-bottom: 1px solid var(--divider-soft);
}
.prose li:last-child { border-bottom: none; }
.prose li::before {
  content: '';
  position: absolute;
  left: 0; top: 20px;
  width: 10px; height: 1px;
  background: var(--accent);
}
.prose li strong { color: var(--accent); font-weight: 600; }

/* Video embed (16:9 responsive) */
.video-embed {
  position: relative;
  width: 100%;
  max-width: 48em;
  aspect-ratio: 16 / 9;
  margin: 0 0 var(--space-3) 0;
  border: 1px solid var(--divider);
  border-radius: 4px;
  overflow: hidden;
  background: #000;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-caption {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: calc(-1 * var(--space-2));
  margin-bottom: var(--space-3);
  max-width: 38em;
}

/* Pull-quote / callout */
.prose .callout {
  border-left: 2px solid var(--accent);
  padding: var(--space-1) 0 var(--space-1) var(--space-3);
  margin: var(--space-3) 0;
  font-size: 1.125rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
  max-width: 36em;
}

/* Data table (used for the dedup decision matrix etc.) */
.prose .data-table {
  width: 100%;
  max-width: 40em;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: var(--text-base);
  background: var(--paper-card);
  border: 1px solid var(--divider);
  border-radius: 4px;
  overflow: hidden;
}
.prose .data-table th,
.prose .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider-soft);
  vertical-align: top;
}
.prose .data-table th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: var(--warm);
}
.prose .data-table tr:last-child td { border-bottom: none; }
.prose .data-table td code {
  background: transparent;
  padding: 0;
  color: var(--accent);
}

/* Code-snippet block */
.prose pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--warm);
  color: var(--ink);
  padding: var(--space-3);
  border-radius: 4px;
  overflow-x: auto;
  margin: var(--space-3) 0;
  max-width: 42em;
  border: 1px solid var(--divider-soft);
}

/* Meta list (status, links footer) */
.meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
  max-width: 38em;
}
.meta-list a { color: var(--accent); }
.meta-list a:hover {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
}

/* Other-projects footer on project pages */
.other-projects {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--divider);
}

.other-projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.other-project-link {
  display: block;
  padding: var(--space-3);
  background: var(--paper-card);
  border: 1px solid var(--divider);
  border-radius: 4px;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.other-project-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  color: inherit;
}
.other-project-link .label-small {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.other-project-link .name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
}

/* ---------------------------------------------------------------------
   About page
   --------------------------------------------------------------------- */

.about-bio p {
  font-size: 1.1875rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: var(--space-3);
  max-width: 38em;
}
.about-bio p:last-child { margin-bottom: 0; }

.about-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--divider-soft);
}

.about-section h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.entry {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--divider-soft);
}
.entry:first-child { padding-top: 0; }
.entry:last-child { border-bottom: none; padding-bottom: 0; }

.entry-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin-bottom: 4px;
  color: var(--ink);
}

.entry-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 6px;
}

.entry-detail {
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--muted);
  max-width: 38em;
}

/* ---------------------------------------------------------------------
   Contact links
   --------------------------------------------------------------------- */

.contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: var(--space-2);
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  padding: 10px 18px;
  border: 1px solid var(--divider);
  border-radius: 4px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.contact-link svg {
  width: 14px; height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */

.site-footer {
  padding: var(--space-6) 0 var(--space-5);
  margin-top: var(--space-8);
  border-top: 1px solid var(--divider);
}

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-soft);
}
.site-footer a { color: var(--muted-soft); }
.site-footer a:hover { color: var(--accent); }

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

@media (max-width: 900px) {
  .project-grid { grid-template-columns: 1fr 1fr; }
  .now-block { grid-template-columns: 1fr; gap: var(--space-2); }
  .hero-inner { grid-template-columns: 1fr; gap: var(--space-5); }
  .hero-photo { order: -1; justify-self: start; }
  .hero-photo img { width: 200px; height: 250px; }
  .other-projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container, .container-narrow { padding: 0 var(--space-3); }
  .project-grid { grid-template-columns: 1fr; }
  .site-nav { padding: var(--space-3) 0; }
  .site-nav-inner { gap: var(--space-2); }
  .site-nav-links { gap: var(--space-3); }
  .hero { padding: var(--space-3) 0 var(--space-6); }
  .hero h1 { font-size: 2.25rem; }
  .hero-tagline { font-size: var(--text-md); }
  .section { padding: var(--space-5) 0; }
  .prose p,
  .about-bio p { font-size: 1.0625rem; line-height: 1.7; }
  .project-section .prose p { font-size: 1.0625rem; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; gap: var(--space-1); }
  .page-intro { padding: var(--space-4) 0 var(--space-3); }
  .page-intro h1 { font-size: 2rem; }
}
