/*
 * Personal Site - Editorial Minimalism
 * Inspired by paulgraham.com, karpathy.ai
 * Pure CSS, no frameworks
 */

/* ========== FONTS ========== */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
  /* Colors - warm, readable, restrained */
  --bg: #FAFAF7;
  --bg-alt: #F3F2EE;
  --text: #1C1C1C;
  --text-muted: #666663;
  --link: #8B4049;
  --link-hover: #6A2F36;
  --link-visited: #5E4346;
  --border: #E2E0D8;
  --accent-subtle: #F7F5F0;

  /* Typography */
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* Layout */
  --max-width: 640px;
  --nav-height: 3.5rem;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xs);
}

p {
  margin-bottom: var(--space-sm);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

/* ========== LINKS ========== */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
}

a:visited {
  color: var(--link-visited);
}

/* Content area links get underlines */
.content a,
article a {
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

.content a:hover,
article a:hover {
  text-decoration-color: var(--link-hover);
}

/* ========== NAVIGATION ========== */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.site-name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-name:visited {
  color: var(--text);
}

.site-name:hover {
  color: var(--link);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  list-style: none;
  justify-content: flex-end;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: lowercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 0.25rem 0;
}

.nav-links a:visited {
  color: var(--text-muted);
}

.nav-links a:hover {
  color: var(--link);
}

.nav-links a.active {
  color: var(--text);
  font-weight: 500;
}

/* ========== PAGE LAYOUT ========== */
.page-layout {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-2xl);
}

main {
  flex: 0 1 var(--max-width);
  max-width: var(--max-width);
  min-width: 0;
}

/* Page container for sub-pages (centers content like homepage) */
.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-2xl);
}

/* ========== JOURNEY SIDEBAR ========== */
.journey-sidebar {
  flex: 0 0 200px;
}

.journey-sidebar .section-label {
  margin-bottom: var(--space-sm);
}

.journey-sidebar .timeline {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin-left: 0.25rem;
}

.journey-sidebar .timeline-item {
  margin-bottom: var(--space-md);
  padding-bottom: 0;
}

.journey-sidebar .timeline-item::before {
  left: calc(-1rem - 4px);
  width: 6px;
  height: 6px;
}

.journey-sidebar .timeline-header {
  flex-direction: column;
  gap: 0;
}

.journey-sidebar .timeline-company {
  font-size: var(--text-xs);
}

.journey-sidebar .timeline-dates {
  font-size: 0.65rem;
}

.journey-sidebar .timeline-role {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.journey-sidebar .timeline-bullets {
  display: none;
}

/* ========== PAGE HEADER ========== */
.page-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin-bottom: var(--space-xs);
}

.page-header .subtitle {
  font-size: var(--text-base);
  color: var(--text-muted);
  font-style: italic;
}

/* ========== HOMEPAGE ========== */
.home-intro {
  margin-bottom: var(--space-2xl);
}

.home-intro p {
  font-size: var(--text-lg);
  line-height: 1.8;
}

.home-intro p + p {
  margin-top: var(--space-sm);
}

.section-index {
  margin-bottom: var(--space-xl);
}

.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 400;
}

.section-index ul {
  list-style: none;
}

.section-index li {
  margin-bottom: var(--space-xs);
}

.section-index li a {
  font-size: var(--text-lg);
  line-height: 1.5;
}

.section-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: 0.5rem;
}

/* ========== READS & POSTS LISTS ========== */
.reads-list,
.posts-list {
  list-style: none;
}

.reads-list li,
.posts-list li {
  margin-bottom: var(--space-md);
}

.reads-list li:last-child,
.posts-list li:last-child {
  margin-bottom: 0;
}

.read-title,
.post-title {
  font-size: var(--text-lg);
  line-height: 1.4;
  display: block;
  margin-bottom: 0.2rem;
}

.read-summary {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  display: inline;
}

.post-summary {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.reads-list .read-more {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.reads-list .read-more:hover {
  color: var(--link);
}

/* ========== ITEM LISTS (Blog, Projects) ========== */
.item-list {
  list-style: none;
}

.item-list > li {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.item-list > li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.item-title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.35rem;
  display: block;
}

.item-title a {
  color: var(--text);
}

.item-title a:visited {
  color: var(--text);
}

.item-title a:hover {
  color: var(--link);
}

.item-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  letter-spacing: 0.01em;
}

.item-desc {
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.65;
}

/* ========== WORK EXPERIENCE ========== */
.work-list {
  list-style: none;
}

.work-item {
  margin-bottom: var(--space-xl);
}

.work-item:last-child {
  margin-bottom: 0;
}

.work-header {
  margin-bottom: var(--space-xs);
}

.work-header h3 {
  font-size: var(--text-lg);
  margin: 0 0 0.2rem 0;
}

.work-company {
  color: var(--text);
}

.work-role {
  font-weight: 400;
  color: var(--text-muted);
}

.work-dates {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.work-item p {
  font-size: var(--text-base);
  line-height: 1.65;
}

.work-item ul {
  margin-top: var(--space-xs);
  padding-left: var(--space-md);
}

.work-item li {
  margin-bottom: 0.35rem;
  font-size: var(--text-base);
  line-height: 1.6;
}

/* ========== IDEAS / UNFINISHED PROJECTS ========== */
.idea-list {
  list-style: none;
}

.idea-item {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-alt);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.idea-item h3 {
  font-size: var(--text-base);
  margin: 0 0 var(--space-xs) 0;
}

.idea-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: var(--space-xs);
}

.idea-status.unstarted {
  background: #E8E6E1;
  color: #6B6965;
}

.idea-status.in-progress {
  background: #E1EBE3;
  color: #3B6B42;
}

.idea-status.stalled {
  background: #EDE8E1;
  color: #7D6540;
}

.idea-status.exploring {
  background: #E3E6EB;
  color: #4A5568;
}

.idea-item p {
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: 0;
}

/* ========== EDUCATION ========== */
.content .education-list,
.education-list {
  list-style: none;
  padding-left: 0;
}

.education-item {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.education-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.education-school {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.education-degree {
  font-size: var(--text-base);
  color: var(--text);
  margin-bottom: 0.15rem;
}

.education-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ========== ARTICLE / BLOG POST ========== */
article {
  max-width: 100%;
}

article header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

article header h1 {
  margin-bottom: var(--space-xs);
}

article .post-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

article .content {
  font-size: var(--text-base);
  line-height: 1.75;
}

article .content p {
  margin-bottom: var(--space-md);
}

article .content h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

article .content h3 {
  margin-top: var(--space-lg);
}

article .content ul,
article .content ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-md);
}

article .content li {
  margin-bottom: 0.4rem;
  line-height: 1.7;
}

article .content blockquote {
  border-left: 3px solid var(--border);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-style: italic;
}

article .content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

article .content pre {
  background: var(--bg-alt);
  padding: var(--space-md);
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin: var(--space-md) 0;
}

article .content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: var(--text-sm);
}

article .content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

article .content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: var(--space-md) 0;
}

/* Back link at end of posts */
.back-link {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.back-link a {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.back-link a:hover {
  color: var(--link);
}

/* ========== FOOTER ========== */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid var(--border);
}

footer p {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0;
}

footer a {
  color: var(--text-muted);
}

footer a:hover {
  color: var(--link);
}

/* ========== UTILITY CLASSES ========== */
.content ul,
.content ol {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
}

.content li {
  margin-bottom: 0.3rem;
}

.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;
}

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

.text-sm {
  font-size: var(--text-sm);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

/* ========== JOURNEY TIMELINE ========== */
.journey {
  margin-bottom: var(--space-2xl);
}

.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin-left: 0.25rem;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
}

.timeline-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1.5rem - 4px);
  top: 0.35rem;
  width: 8px;
  height: 8px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 50%;
}

.timeline-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}

.timeline-company {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.timeline-dates {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timeline-role {
  font-size: var(--text-base);
  color: var(--text);
  margin-bottom: 0.25rem;
}

.timeline-bullets {
  list-style: none;
  padding-left: 0;
}

.timeline-bullets li {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.timeline-bullets li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* ========== SECTION BADGES ========== */
.section-badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-weight: 400;
}

.section-badge.built {
  background: #E1EBE3;
  color: #3B6B42;
}

.section-badge.ideation {
  background: #E3E6EB;
  color: #4A5568;
}

/* Additional idea status variants for projects */
.idea-status.shipped {
  background: #E1EBE3;
  color: #3B6B42;
}

.idea-status.active {
  background: #E8F4E8;
  color: #2D5A2D;
}

/* ========== CONTENT INDENTATION ========== */
.content-indent {
  padding-left: var(--space-md);
  border-left: 2px solid var(--border);
}

/* Nested list styling for work items */
.work-item ul ul {
  margin-top: var(--space-xs);
  margin-left: var(--space-sm);
  padding-left: var(--space-sm);
  /* list-style: none; */
}

.work-item ul ul li {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ========== TYPOGRAPHY REFINEMENTS ========== */
.page-header h1 {
  letter-spacing: -0.03em;
}

.page-header .subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-style: normal;
}

/* Content h2 styling (inherit section-label treatment) */
.content h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.content h2:first-child {
  margin-top: 0;
}

/* ========== VISUAL HIERARCHY & SPACING ========== */
/* Work item spacing improvements */
.work-item {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.work-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ========== INTERACTIVE STATES ========== */
/* Item list hover states */
.item-list > li {
  padding: var(--space-sm);
  margin-left: calc(-1 * var(--space-sm));
  margin-right: calc(-1 * var(--space-sm));
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.item-list > li:hover {
  background-color: var(--bg-alt);
}

/* Idea item hover states */
.idea-item {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.idea-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Link transitions */
a {
  transition: color 0.15s ease, background-color 0.15s ease;
}

/* Active nav link enhancement */
.nav-links a.active {
  color: var(--text);
  font-weight: 500;
  position: relative;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text);
}

/* ========== RESPONSIVE ========== */

/* Tablet: Sidebar collapses, journey moves after intro */
@media (max-width: 900px) {
  .page-layout {
    flex-direction: column;
    max-width: var(--max-width);
    align-items: stretch;
  }

  .page-layout main {
    display: contents;
  }

  .home-intro {
    order: 1;
    width: 100%;
  }

  .journey-sidebar {
    order: 2;
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
    margin-bottom: var(--space-xl);
  }

  main > .section-index {
    order: 3;
    width: 100%;
  }

  .journey-sidebar .timeline-bullets {
    display: block;
  }

  .journey-sidebar .timeline-role {
    color: var(--text);
  }
}

/* Mobile: Typography adjustments */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .nav-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .nav-links {
    gap: var(--space-xs) var(--space-sm);
  }

  main {
    padding: var(--space-lg) var(--space-sm) var(--space-xl);
  }

  .page-container {
    padding: var(--space-lg) var(--space-md) var(--space-xl);
  }

  /* Work header mobile stacking */
  .work-header h3 {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .work-header h3 .work-role {
    font-size: var(--text-sm);
  }

  .work-separator {
    display: none;
  }

  h1 {
    font-size: var(--text-xl);
  }

  h2 {
    font-size: var(--text-lg);
  }

  .home-intro p {
    font-size: var(--text-base);
  }

  .section-index li a {
    font-size: var(--text-base);
  }

  .idea-item {
    padding: var(--space-sm);
  }

  /* Timeline mobile */
  .timeline {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  .timeline-item::before {
    display: none;
  }

  .timeline-item {
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
  }

  .timeline-item:last-child {
    border-bottom: none;
  }

  .home-intro {
    margin-bottom: var(--space-md);
  }
}

/* ========== PRINT STYLES ========== */
@media print {
  nav, footer {
    display: none;
  }

  main {
    max-width: 100%;
    padding: 0;
  }

  a {
    color: var(--text);
    text-decoration: underline;
  }

  .page-header, article header {
    border-bottom: 1px solid #ccc;
  }
}
