/* ==========================================
   DESIGN TOKENS & SYSTEM VARIABLES
   ========================================== */
:root {
  color-scheme: light;
  
  /* Handwritten/Cursive Fonts (fountain blue & edit red) */
  --font-cursive: "Caveat", cursive;
  --color-ink-blue: #2b4c7e;
  --color-ink-red: #b54242;

  /* Substack Editorial Colors */
  --color-sub-bg: #fffcf6;
  --color-sub-header: #faf6ec;
  --color-sub-ink: #3c3c33;
  --color-sub-muted: #65655c;
  --color-sub-soft: #8d8d80;
  --color-sub-line: #e8e4d9;
  --color-sub-line-strong: #d0caba;
  
  --color-sub-accent: #b84d2b;       /* deep terracotta/rust */
  --color-sub-accent-light: #fffcf6; /* default body background */

  /* Tier 2: Semantic Colors (Substack inspired) */
  --bg: var(--color-sub-bg);
  --card: #ffffff;
  --paper: var(--color-sub-header);
  --ink: var(--color-sub-ink);
  --muted: var(--color-sub-muted);
  --soft: var(--color-sub-soft);
  --line: var(--color-sub-line);
  --line-strong: var(--color-sub-line-strong);
  --accent: var(--color-sub-accent);
  --accent-dark: var(--color-sub-accent);
  
  /* Typography */
  --font-serif: "EB Garamond", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  
  /* Layout */
  --max-width: 640px;
  --header-height: 74px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-speed: 0.2s;
}

/* ==========================================
   RESET & FOUNDATIONS
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

p {
  color: var(--muted);
  font-size: 1.05rem;
  text-wrap: pretty;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--soft);
}

/* ==========================================
   MINIMAL CONTAINER (Single Narrow Column)
   ========================================== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 32px);
}

/* ==========================================
   HEADER
   ========================================== */
.site-header {
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.header-inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  transition: color var(--transition-speed) ease;
}

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

.header-action {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-dark);
  transition: color var(--transition-speed) ease;
}

.header-action:hover {
  color: var(--accent);
}

/* ==========================================
   HERO SECTION (MINIMALIST BIO PORTRAIT)
   ========================================== */
.home-hero {
  padding-block: 60px 40px;
  width: 100%;
}

.hero-minimal {
  display: flex;
  align-items: center;
  gap: 32px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(45, 38, 30, 0.08);
  border: 1px solid var(--line-strong);
}

.hero-text-block {
  flex-grow: 1;
}

.hero-kicker {
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.hero-display-name {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.hero-deck {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.text-cta {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  transition: color var(--transition-speed) ease;
}

.text-cta:hover {
  color: var(--accent);
}

.secondary-cta {
  color: var(--soft);
}

.secondary-cta:hover {
  color: var(--ink);
}

/* ==========================================
   SECTIONS & TYPOGRAPHY
   ========================================== */
.section {
  padding-block: 56px;
  width: 100%;
  border-top: 1px solid var(--line);
}

.section-header {
  margin-bottom: 24px;
}

.section-label {
  color: var(--soft);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 1.02rem;
  color: var(--muted);
  margin-top: 8px;
}

.prose-content p:not(:last-child) {
  margin-bottom: 16px;
}

/* Simple stacked focus areas */
.signal-simple-list {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signal-item {
  font-size: 1rem;
  color: var(--muted);
}

.signal-item span {
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 8px;
}

.signal-item strong {
  color: var(--ink);
  font-weight: 600;
}

/* ==========================================
   WRITING SECTION (EDITORIAL LIST)
   ========================================== */
.essay-simple-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-block: 20px 24px;
}

.essay-row {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding-block: 4px;
  transition: opacity var(--transition-speed) ease;
}

.essay-row:hover {
  opacity: 0.85;
}

.essay-date {
  color: var(--soft);
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 76px;
  flex-shrink: 0;
}

.essay-title-text {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.essay-row:hover .essay-title-text {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
}

.section-footer-link {
  margin-top: 12px;
}

/* ==========================================
   TOPIC EXPLAINERS
   ========================================== */
.topic-simple-list,
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-block: 20px 24px;
}

.topic-row {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-block: 16px 2px;
  transition: opacity var(--transition-speed) ease;
}

.topic-row:hover {
  opacity: 0.85;
}

.topic-row span,
.answer-list span {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topic-row strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.35;
}

.answer-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 20px;
}

.answer-list div {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.answer-list strong,
.faq-item h3 {
  color: var(--ink);
  display: block;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.35;
  margin-block: 4px 6px;
}

.faq-item {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.back-link {
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 18px;
}

/* ==========================================
   PROJECTS SECTION (SIMPLE VERTICAL LIST)
   ========================================== */
.project-simple-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 24px;
}

.project-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-row-header h3 {
  font-size: 1.35rem;
  font-weight: 600;
  font-family: var(--font-serif);
}

.project-desc {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--soft);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 2px 8px;
  background: var(--paper);
}

/* ==========================================
   CONNECT & SOCIALS SECTION (LIGHT & MINIMAL)
   ========================================== */
.connect-section {
  background: var(--bg);
}

.social-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-block: 20px 28px;
}

.social-link-item {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: all var(--transition-speed) ease;
}

.social-link-item:hover {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.email-box-minimal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}

.email-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

#email-address {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 600;
}

.copy-button {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 12px;
  transition: all var(--transition-speed) ease;
}

.copy-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--color-accent-light);
}

/* Toast alert styling */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1000;
  transform: translate(-50%, 40px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
  opacity: 0;
  padding: 10px 18px;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================
   FOOTER
   ========================================== */
.site-footer {
  padding-block: 40px 60px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.9rem;
}

.site-footer p {
  color: var(--soft);
  font-size: 0.9rem;
}

.site-footer a {
  font-weight: 600;
  border-bottom: 1px solid var(--line-strong);
}

.site-footer a:hover {
  color: var(--accent-dark);
  border-color: var(--accent);
}

/* ==========================================
   NOTEBOOK HANDWRITTEN ANNOTATIONS & DOODLES
   ========================================== */
.handwritten-text {
  font-family: var(--font-cursive);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--color-ink-blue);
  letter-spacing: 0;
  line-height: 1.1;
  display: inline-block;
  transform: rotate(-3deg);
  user-select: none;
}

.hero-annotation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: 8px;
}

.scribble-arrow-left {
  width: 28px;
  height: 20px;
  color: var(--accent);
  transform: rotate(-5deg);
}

.hero-annotation .handwritten-text {
  color: var(--accent);
  font-size: 1.25rem;
  transform: rotate(-4deg);
}

/* Circle highlight */
.scribble-circle-mark {
  position: relative;
  display: inline-block;
  padding-inline: 4px;
}

.scribble-circle-mark::after {
  content: "";
  position: absolute;
  inset: -4px -6px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 30" fill="none" preserveAspectRatio="none"><path d="M5,15 C5,5 95,2 95,15 C95,28 3,28 10,18" stroke="%23b54242" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0.85;
  z-index: -1;
}

/* Underline mark */
.scribble-underline-mark {
  position: relative;
  display: inline-block;
}

.scribble-underline-mark::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 6px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 10" preserveAspectRatio="none"><path d="M0,5 Q30,2 60,6 T100,4" stroke="%23b54242" stroke-width="2" fill="none" stroke-linecap="round"/></svg>');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Margin scribble */
.margin-scribble {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.intro-scribble {
  bottom: -32px;
  right: 16px;
  color: var(--color-ink-blue);
}

.scribble-arrow-up {
  width: 18px;
  height: 24px;
  color: var(--color-ink-blue);
  transform: rotate(-5deg);
}

.intro-scribble .handwritten-text {
  font-size: 1.15rem;
}

/* Substack card overlay note */
.card-scribble-note {
  position: absolute;
  top: 14px;
  right: 14px;
  transform: rotate(5deg);
  background: hsla(19, 100%, 55%, 0.08);
  border: 1px dashed hsla(19, 100%, 55%, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 5;
}

.card-scribble-note .handwritten-text {
  color: var(--color-accent-dark);
  font-size: 1.15rem;
  font-weight: 700;
  transform: none;
}

.inline-scribble {
  font-size: 1.1rem;
  margin-left: 8px;
  color: var(--accent-dark);
}

/* Project Status checklist / star markings */
.project-status-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.handwritten-doodle {
  font-family: var(--font-cursive);
  font-weight: bold;
  font-size: 1.5rem;
  line-height: 1;
  user-select: none;
  display: inline-block;
}

.check-doodle {
  color: var(--color-ink-blue);
}

.star-doodle {
  color: var(--accent);
  transform: rotate(10deg);
}

/* Social email scribble annotation */
.email-annotation {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  pointer-events: none;
}

.scribble-loop-arrow {
  width: 28px;
  height: 16px;
  color: var(--accent-dark);
  transform: scaleX(-1) rotate(15deg); /* Point left-up */
}

.email-annotation .handwritten-text {
  color: var(--accent-dark);
  font-size: 1.15rem;
  transform: rotate(-2deg);
}

/* About page margin notes */
.current-focus-item {
  position: relative;
}

.signal-scribble-note {
  position: absolute;
  top: -12px;
  right: 0;
  transform: rotate(6deg);
  background: hsla(220, 85%, 55%, 0.06);
  border: 1px dashed hsla(220, 85%, 55%, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

.signal-scribble-note .handwritten-text {
  color: var(--color-ink-blue);
  font-size: 1.05rem;
  transform: none;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 600px) {
  .header-inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px 18px;
    min-height: auto;
    padding-block: 14px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    gap: 18px;
  }

  .header-action {
    margin-left: auto;
  }

  .hero-minimal {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  
  .profile-avatar {
    width: 96px;
    height: 96px;
  }
  
  .hero-display-name {
    font-size: 2rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .hero-annotation {
    display: none;
  }
  
  .essay-row {
    flex-direction: column;
    gap: 4px;
  }

  .topic-row strong,
  .answer-list strong,
  .faq-item h3 {
    font-size: 1.12rem;
  }
  
  .essay-date {
    min-width: auto;
  }
  
  .email-box-minimal {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .email-annotation {
    display: none;
  }
  
  .intro-scribble {
    display: none;
  }
}

/* ==========================================
   REDUCED MOTION SUPPORT
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
