/* ============================================================
   nospecialcharacters — Global Stylesheet
   Dark-mode first. CSS custom properties for all tokens.
   ============================================================ */

/* Fonts (Fraunces, Lora, Special Elite) are loaded via <link> in each page's <head>, not @import. */

/* --- Design Tokens --- */
:root {
  /* Dark mode (default) */
  --bg:          #0C0C0C;
  --bg-surface:  #141414;
  --bg-raised:   #1C1C1C;
  --bg-hover:    #222222;
  --text:        #EDE8DE;
  --text-muted:  #8A8480;
  --text-faint:  #4A4744;
  --accent:      #E8A838;
  --accent-dim:  rgba(232, 168, 56, 0.12);
  --accent-text: #E8A838;
  --border:      #242220;
  --border-mid:  #2E2B28;
  --code-bg:     #161614;
  --code-text:   #D4CEC4;
  --selection:   rgba(232, 168, 56, 0.25);

  /* Syntax tokens */
  --syn-kw:      #CF8DFF;  /* keyword */
  --syn-fn:      #7DD3FC;  /* function */
  --syn-str:     #86EFAC;  /* string */
  --syn-cm:      #6B7280;  /* comment */
  --syn-num:     #FB923C;  /* number */
  --syn-op:      #94A3B8;  /* operator / punctuation */
  --syn-type:    #F9A8D4;  /* type / class */
  --syn-attr:    #FDE68A;  /* attribute / property */

  /* Spacing scale */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  2rem;
  --space-xl:  4rem;
  --space-2xl: 8rem;

  /* Typography */
  --font-display:     'Fraunces', Georgia, 'Times New Roman', serif;
  --font-typewriter:  'Special Elite', 'Courier New', Courier, monospace;
  --font-body:    'Lora', Georgia, 'Times New Roman', serif;
  --font-mono:    'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Layout */
  --max-width:      1140px;
  --prose-width:    68ch;
  --nav-height:     64px;
  --radius:         3px;
  --radius-lg:      8px;

  /* Transitions */
  --transition:     150ms ease;
  --transition-slow: 300ms ease;
}

[data-theme="light"] {
  --bg:          #F7F4EE;
  --bg-surface:  #FFFFFF;
  --bg-raised:   #EDE9E1;
  --bg-hover:    #E8E3D8;
  --text:        #1A1714;
  --text-muted:  #6B655C;
  --text-faint:  #A09890;
  --accent:      #B8741A;
  --accent-dim:  rgba(184, 116, 26, 0.10);
  --accent-text: #9A5F10;
  --border:      #DDD8CF;
  --border-mid:  #CBC5BA;
  --code-bg:     #EEEAE2;
  --code-text:   #2E2A26;
  --selection:   rgba(184, 116, 26, 0.20);

  --syn-kw:      #7C3AED;
  --syn-fn:      #0369A1;
  --syn-str:     #166534;
  --syn-cm:      #9CA3AF;
  --syn-num:     #C2410C;
  --syn-op:      #6B7280;
  --syn-type:    #BE185D;
  --syn-attr:    #92400E;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

::selection {
  background: var(--selection);
  color: var(--text);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

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

h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 300; font-style: italic; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 400; }
h3 { font-size: 1.25rem; font-weight: 600; }

p {
  margin-bottom: 1.5em;
  color: var(--text);
}

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

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}

a:hover { opacity: 0.75; }

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

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

blockquote {
  border-left: 2px solid var(--accent);
  margin: var(--space-lg) 0;
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-muted);
  font-style: italic;
}

blockquote p { margin-bottom: 0; }

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

ul, ol {
  padding-left: 1.5em;
  margin-bottom: 1.5em;
}

li { margin-bottom: 0.4em; }

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
  position: relative;
}

pre code {
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  line-height: 1.65;
  display: block;
  color: var(--code-text);
}

/* Syntax highlight tokens */
.kw   { color: var(--syn-kw); }
.fn   { color: var(--syn-fn); }
.str  { color: var(--syn-str); }
.cm   { color: var(--syn-cm); font-style: italic; }
.num  { color: var(--syn-num); }
.op   { color: var(--syn-op); }
.tp   { color: var(--syn-type); }
.at   { color: var(--syn-attr); }

/* Language label on code blocks */
pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: var(--space-sm);
  right: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

main {
  flex: 1;
  padding-top: var(--nav-height);
}

/* --- Navigation --- */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-slow), border-color var(--transition-slow);
}

[data-theme="light"] #site-header {
  background: rgba(247, 244, 238, 0.92);
}

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

.nav-brand {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 400;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-brand:hover { color: var(--accent-text); opacity: 1; }

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
  padding: 0;
  margin: 0;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition);
  letter-spacing: 0.01em;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  opacity: 1;
}

.nav-links a.active {
  color: var(--accent-text);
}

/* About page photo */
.about-intro-header {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.about-photo {
  width: 120px;
  height: 120px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border-mid);
  flex-shrink: 0;
  transition: border-color var(--transition-slow);
}

.about-photo:hover {
  border-color: var(--accent);
}

@media (max-width: 480px) {
  .about-intro-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
}

/* Theme Toggle */
#theme-toggle {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  flex-shrink: 0;
}

#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-dim);
}

#theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transition: transform var(--transition-slow);
}

#theme-toggle:hover svg {
  transform: rotate(20deg);
}

/* --- Footer --- */
#site-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-2xl);
  padding: var(--space-xl) 0;
  background: var(--bg-surface);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: -0.02em;
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--accent-text);
  opacity: 1;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0;
}

/* --- Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Stagger delays for sibling reveals */
.reveal:nth-child(1) { transition-delay: 0ms; }
.reveal:nth-child(2) { transition-delay: 80ms; }
.reveal:nth-child(3) { transition-delay: 160ms; }
.reveal:nth-child(4) { transition-delay: 240ms; }
.reveal:nth-child(5) { transition-delay: 320ms; }
.reveal:nth-child(6) { transition-delay: 400ms; }

/* --- Hero (index.html) --- */
.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding: var(--space-2xl) 0 var(--space-xl);
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-lg);
  right: var(--space-lg);
  height: 1px;
  background: var(--border);
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  width: 100%;
}


.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: var(--space-lg);
  display: block;
}

.hero-name {
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 400;
  font-style: normal;
  font-family: var(--font-typewriter);
  line-height: 1.0;
  letter-spacing: 0.01em;
  margin-bottom: var(--space-lg);
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 52ch;
  line-height: 1.6;
  margin-bottom: var(--space-xl);
  font-family: var(--font-body);
  font-style: italic;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6em 1.4em;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0C0C0C;
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-mid);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
  opacity: 1;
}

/* --- Recent Posts (index.html) --- */
.recent-posts {
  padding: var(--space-2xl) 0;
}

.recent-posts-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  gap: var(--space-lg);
}

.section-header h2 {
  font-weight: 300;
  font-style: italic;
}

.section-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.section-link:hover { color: var(--accent-text); opacity: 1; }

/* Post card (used on index and blog listing) */
.post-card {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--border);
  padding: var(--space-xl) 0;
  gap: var(--space-sm);
  transition: all var(--transition);
}

.post-card:last-child { border-bottom: 1px solid var(--border); }

.post-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.post-card-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.post-card-title {
  font-family: var(--font-typewriter);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 400;
  line-height: 1.25;
  margin: var(--space-sm) 0;
  letter-spacing: -0.02em;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size var(--transition-slow), color var(--transition);
}

.post-card-title a:hover {
  color: var(--text);
  opacity: 1;
  background-size: 100% 1px;
}

.post-card-summary {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 65ch;
  margin-bottom: 0;
}

/* Tag chips */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.2em 0.65em;
  border-radius: 2px;
  background: var(--bg-raised);
  color: var(--text-faint);
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: default;
}

.tag.clickable {
  cursor: pointer;
}

/* Filter chips are <button>s — reset native button styling so they match the spans */
button.tag {
  appearance: none;
  line-height: inherit;
  margin: 0;
}

.tag.clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tag.clickable:hover,
.tag.active {
  background: var(--accent-dim);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* --- Blog Listing Page --- */
.page-header {
  padding: var(--space-2xl) 0 var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.page-header h1 {
  font-family: var(--font-typewriter);
  font-weight: 400;
  font-style: normal;
  margin-bottom: var(--space-lg);
}

.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.posts-list {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-2xl);
}

.no-posts {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  font-style: italic;
}

/* --- Post Page --- */
.post-main {
  max-width: calc(var(--prose-width) + var(--space-lg) * 2);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.post-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.post-header-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.post-header h1 {
  font-family: var(--font-typewriter);
  font-weight: 400;
  font-style: normal;
  margin-top: var(--space-md);
}

/* Post body prose */
.post-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body h2 {
  margin: var(--space-xl) 0 var(--space-md);
  font-size: 1.5rem;
  font-weight: 400;
}

.post-body h3 {
  margin: var(--space-lg) 0 var(--space-sm);
  font-size: 1.15rem;
}

.post-body p {
  margin-bottom: 1.6em;
}

.post-body a {
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 3px;
}

.post-body a:hover {
  text-decoration-color: var(--accent);
  opacity: 1;
  color: var(--accent-text);
}

.post-body ul,
.post-body ol {
  margin-bottom: 1.6em;
}

/* Post footer nav */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.post-nav-item.next { text-align: right; }

.post-nav-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.post-nav-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.35;
  transition: color var(--transition);
}

.post-nav-item a:hover .post-nav-title { color: var(--text); opacity: 1; }

/* --- About Page --- */
.about-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.about-intro {
  max-width: var(--prose-width);
  margin-bottom: var(--space-2xl);
}

.about-intro h1 {
  font-family: var(--font-typewriter);
  font-weight: 400;
  font-style: normal;
  margin-bottom: var(--space-lg);
}

.about-section-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-mid);
}

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

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

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-xl));
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  transform: translateX(-3px);
}

.timeline-role {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.timeline-company {
  color: var(--accent-text);
  font-size: 0.9rem;
}

.timeline-dates {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-sm);
}

.timeline-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  max-width: 55ch;
  margin-bottom: 0;
}

/* Skills grid */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-2xl);
}

.skill-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35em 0.8em;
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
  transition: all var(--transition);
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-dim);
}

/* --- Loading state --- */
.loading {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-faint);
  font-size: 0.875rem;
  font-style: italic;
  padding: var(--space-xl) 0;
}

.loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Error state --- */
.error-msg {
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-left: 3px solid #E05252;
  padding: var(--space-lg);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root {
    --space-xl: 2.5rem;
    --space-2xl: 5rem;
  }

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

  .nav-brand {
    font-size: 0.8rem;
  }

  .hero {
    min-height: 55vh;
    padding: var(--space-xl) 0;
  }

  .section-header {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-item.next { text-align: left; }

  .timeline {
    padding-left: var(--space-lg);
  }
}

@media (max-width: 480px) {
  html { font-size: 16px; }

  .nav-links a { font-size: 0.8rem; }

  .hero-actions { flex-direction: column; }

  .btn { width: 100%; justify-content: center; }
}

/* --- Print --- */
@media print {
  #site-header, #theme-toggle, .post-nav { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; }
}
