/* ============================================================
   Stitch Design System v2 — Refined Editorial
   Obsidian & Amber luxury theme
   Pure CSS (no Tailwind)
   ============================================================ */

:root {
  /* Background hierarchy */
  --bg: #131315;
  --surface: #131315;
  --surface-deep: #0e0e10;
  --surface-low: #1c1b1d;
  --surface-container: #201f22;
  --surface-high: #2a2a2c;
  --surface-highest: #353437;

  /* Text hierarchy */
  --text-primary: #e5e1e4;
  --text-body: #d4c4b7;
  --text-muted: #9c8e82;
  --text-outline: #50453b;

  /* Accent */
  --accent: #d4a574;
  --accent-dim: rgba(212, 165, 116, 0.15);
  --accent-glow: rgba(212, 165, 116, 0.08);
  --accent-primary: #f2c08d;
  --accent-secondary: #dcc2a9;

  /* Selection */
  --selection-bg: #d4a574;
  --selection-text: #131315;

  /* Typography */
  --font-sans: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", "Monaco", monospace;

  /* Layout */
  --content-width: 640px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ── Reset & Base ────────────────────────────────── */

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

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

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: -0.02em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  opacity: 0;
  animation: pageIn 0.6s ease forwards;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Selection ───────────────────────────────────── */

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

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

/* ── Links ───────────────────────────────────────── */

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ── Reading Progress Bar ────────────────────────── */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #e8c49a);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ── Glass Nav ───────────────────────────────────── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(19, 19, 21, 0.80);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 80px;
}

.nav__logo {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.05em;
  text-decoration: none;
  transition: opacity var(--transition-base);
}

.nav__logo:hover {
  text-decoration: none;
  opacity: 0.8;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav__link {
  font-size: 14px;
  color: var(--text-body);
  opacity: 0.7;
  text-decoration: none;
  transition: opacity var(--transition-base);
  letter-spacing: -0.01em;
}

.nav__link:hover {
  opacity: 1;
  text-decoration: none;
}

.nav__link--active {
  color: var(--accent);
  opacity: 1;
  font-weight: 500;
}

/* ── Shell / Layout ──────────────────────────────── */

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  padding-top: 120px;
  padding-bottom: 96px;
}

/* ── Footer ──────────────────────────────────────── */

.footer {
  width: 100%;
  padding: 80px 24px;
  background: var(--bg);
}

.footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer__links {
  display: flex;
  gap: 32px;
  margin-bottom: 16px;
}

.footer__link {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-body);
  opacity: 0.4;
  text-decoration: none;
  transition: opacity var(--transition-base);
}

.footer__link:hover {
  opacity: 1;
  text-decoration: none;
}

.footer__copy {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-body);
  opacity: 0.4;
}

.footer__tagline {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-body);
  opacity: 0.2;
  letter-spacing: -0.02em;
  margin-top: 8px;
}

/* ── Hero Section (Homepage) ─────────────────────── */

.hero {
  margin-bottom: 128px;
  padding: 64px 0 0;
  max-width: var(--content-width);
}

.hero__badge {
  display: inline-block;
  padding: 6px 12px;
  background: var(--surface-high);
  border: 1px solid rgba(80, 69, 59, 0.15);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero__statement {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 32px;
  word-break: keep-all;
}

.hero__accent {
  color: var(--accent);
}

.hero__subtitle {
  font-size: 18px;
  color: var(--text-body);
  line-height: 1.8;
  max-width: 540px;
  letter-spacing: -0.02em;
}

/* ── Post List (Homepage) ────────────────────────── */

.post-list {
  list-style: none;
  max-width: var(--content-width);
}

.post-item {
  padding: 0;
  margin-bottom: 80px;
  cursor: pointer;
  transition: transform var(--transition-slow);
}

.post-item:hover {
  transform: translateY(-4px);
}

.post-item__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.post-number {
  display: none;
}

.post-date {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.8;
}

.post-reading-time {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.8;
}

.post-reading-time::before {
  content: "";
  display: inline-block;
  width: 32px;
  height: 1px;
  background: rgba(80, 69, 59, 0.3);
  margin-right: 16px;
  vertical-align: middle;
}

.post-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 16px;
}

.post-title a {
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.post-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-excerpt {
  font-size: 16px;
  color: rgba(212, 196, 183, 0.8);
  line-height: 1.8;
  margin-bottom: 16px;
}

.post-tags {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.post-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid rgba(80, 69, 59, 0.15);
  transition: all var(--transition-fast);
}

.post-tag:hover {
  border-color: rgba(212, 165, 116, 0.3);
  color: var(--accent);
}

/* ── Single Post Header ──────────────────────────── */

.post-header {
  margin-bottom: 48px;
  padding-top: 16px;
}

.post-header__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.post-header__date,
.post-header__reading-time,
.post-header__wordcount {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.15em;
}

.post-header__separator {
  color: var(--text-outline);
  opacity: 0.3;
}

.post-header h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 24px;
  word-break: keep-all;
  color: var(--text-primary);
}

.post-header__desc {
  font-size: 18px;
  color: var(--text-body);
  line-height: 1.8;
  font-weight: 500;
}

/* ── Featured Image ──────────────────────────────── */

.post-featured {
  margin-bottom: 48px;
}

.post-featured img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.8;
}

.post-featured figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: 11px;
  color: rgba(202, 177, 153, 0.6);
  letter-spacing: -0.01em;
}

/* ── Article Layout with TOC Sidebar ─────────────── */

.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 960px;
  margin: 0 auto;
  gap: 0;
  position: relative;
}

@media (min-width: 1100px) {
  .article-layout {
    grid-template-columns: 640px 1fr;
    gap: 48px;
  }
}

.article-main {
  max-width: 640px;
  width: 100%;
}

.toc-sidebar {
  display: none;
}

@media (min-width: 1100px) {
  .toc-sidebar {
    display: block;
    position: sticky;
    top: 120px;
    height: fit-content;
    padding-top: 80px;
  }
  .toc-sidebar__title {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-outline);
    margin-bottom: 16px;
  }
  .toc-sidebar #TableOfContents {
    font-size: 13px;
    line-height: 1.8;
  }
  .toc-sidebar #TableOfContents ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .toc-sidebar #TableOfContents li {
    margin-bottom: 8px;
  }
  .toc-sidebar #TableOfContents a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
  }
  .toc-sidebar #TableOfContents a:hover {
    color: var(--accent);
  }
  .toc-sidebar #TableOfContents ul ul {
    padding-left: 16px;
    margin-top: 4px;
  }
  .toc-sidebar #TableOfContents ul ul a {
    font-size: 12px;
  }
}

/* ── Post Body ───────────────────────────────────── */

.post-body {
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: -0.02em;
  word-break: keep-all;
  color: var(--text-body);
}

.post-body h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 64px 0 20px;
  line-height: 1.3;
  color: var(--text-primary);
}

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

.post-body h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 48px 0 14px;
  line-height: 1.3;
  color: var(--text-primary);
}

.post-body h4 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
  color: var(--text-body);
}

.post-body p {
  margin-bottom: 24px;
}

.post-body ul, .post-body ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.post-body li {
  margin-bottom: 8px;
  line-height: 1.8;
}

.post-body li::marker {
  color: var(--text-outline);
}

/* ── Blockquote (Editorial Style with amber border + deep bg) ── */

.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding: 32px 24px;
  margin: 40px 0;
  background: rgba(14, 14, 16, 0.5);
  color: var(--text-primary);
  font-style: italic;
  font-size: 18px;
  line-height: 1.7;
}

.post-body blockquote p {
  margin-bottom: 0;
}

.post-body blockquote p + p {
  margin-top: 12px;
}

/* ── Code (with filename header + left amber border) ── */

.post-body code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface-deep);
  padding: 3px 7px;
  border-radius: 3px;
  color: #e8c49a;
}

.post-body pre {
  background: var(--surface-deep);
  border-left: 2px solid var(--accent);
  border-radius: 0;
  padding: 24px;
  overflow-x: auto;
  margin: 32px 0;
}

.post-body pre code {
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-body);
}

/* Hugo syntax highlighting overrides */
.post-body .highlight {
  margin: 32px 0;
  background: var(--surface-deep);
  border-left: 2px solid var(--accent);
  overflow: hidden;
}

.post-body .highlight pre {
  margin: 0;
  border-left: none;
  background: transparent;
}

/* ── Emphasis / Strong ───────────────────────────── */

.post-body strong {
  font-weight: 700;
  color: var(--text-primary);
}

.post-body em {
  font-style: italic;
  color: var(--text-body);
}

/* ── Images ──────────────────────────────────────── */

.post-body img {
  max-width: 100%;
  margin: 32px 0;
}

.post-body figure {
  margin: 40px 0;
}

.post-body figure img {
  margin: 0;
  width: 100%;
}

.post-body figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: 11px;
  color: rgba(202, 177, 153, 0.6);
  letter-spacing: -0.01em;
}

/* ── Tables (zebra stripes with surface layers) ──── */

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  font-size: 14px;
  font-family: var(--font-mono);
  border: 1px solid rgba(80, 69, 59, 0.15);
  overflow: hidden;
}

.post-body thead {
  background: var(--surface-high);
}

.post-body th {
  padding: 16px;
  font-weight: 500;
  font-size: 10px;
  color: var(--accent);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.post-body td {
  padding: 16px;
  color: var(--text-body);
  line-height: 1.6;
}

.post-body tbody tr:nth-child(odd) {
  background: var(--surface-deep);
}

.post-body tbody tr:nth-child(even) {
  background: var(--surface);
}

.post-body tr + tr {
  border-top: 1px solid rgba(80, 69, 59, 0.1);
}

/* ── Horizontal Rule ─────────────────────────────── */

.post-body hr {
  border: none;
  margin: 56px auto;
  max-width: 80px;
  display: flex;
  justify-content: center;
  height: auto;
}

.post-body hr::after {
  content: "...";
  display: block;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 8px;
  color: var(--accent);
  opacity: 0.4;
}

/* ── Post Footer / Back Link ─────────────────────── */

.post-footer {
  margin-top: 72px;
  padding-top: 32px;
}

.post-footer__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--transition-fast), transform var(--transition-base);
  font-family: var(--font-sans);
}

.post-footer__back:hover {
  color: var(--accent);
  text-decoration: none;
  transform: translateX(-4px);
}

.post-footer__back-arrow {
  transition: transform var(--transition-fast);
  font-size: 16px;
}

.post-footer__back:hover .post-footer__back-arrow {
  transform: translateX(-3px);
}

/* ── Comments ────────────────────────────────────── */

.comments {
  margin-top: 72px;
  padding-top: 36px;
}

.comments__title {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 24px;
  font-family: var(--font-mono);
}

/* ── About Page ──────────────────────────────────── */

.about {
  padding-top: 32px;
}

.about__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 16px;
}

.about__title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 48px;
  word-break: keep-all;
}

.about__body {
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: -0.02em;
  word-break: keep-all;
  color: var(--text-body);
}

.about__body h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 48px 0 16px;
  line-height: 1.3;
  color: var(--text-primary);
}

.about__body h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 36px 0 12px;
  line-height: 1.3;
  color: var(--text-primary);
}

.about__body p {
  margin-bottom: 24px;
}

.about__body ul, .about__body ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.about__body li {
  margin-bottom: 8px;
  line-height: 1.8;
}

.about__body li::marker {
  color: var(--text-outline);
}

.about__body strong {
  font-weight: 700;
  color: var(--text-primary);
}

.about__body a {
  color: var(--accent);
}

.about__body blockquote {
  border-left: 2px solid var(--accent);
  padding: 24px;
  margin: 32px 0;
  background: rgba(14, 14, 16, 0.5);
  color: var(--text-primary);
  font-style: italic;
  font-size: 17px;
  line-height: 1.8;
}

.about__body blockquote p {
  margin-bottom: 0;
}

/* About bento grid */
.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 48px 0;
}

.about__card {
  background: var(--surface-deep);
  padding: 32px;
  transition: background var(--transition-base);
}

.about__card:hover {
  background: var(--surface-low);
}

.about__card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

.about__card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.about__card-desc {
  font-size: 14px;
  color: rgba(212, 196, 183, 0.7);
  line-height: 1.7;
}

/* ── Responsive ──────────────────────────────────── */

@media (min-width: 640px) {
  .about__grid {
    grid-template-columns: 1fr 1fr;
  }

  .about__card--full {
    grid-column: span 2;
  }

  .hero__statement {
    font-size: 56px;
  }

  .post-title {
    font-size: 30px;
  }

  .post-header h1 {
    font-size: 44px;
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 0 20px;
    padding-top: 100px;
    padding-bottom: 64px;
  }

  .nav__inner {
    padding: 0 20px;
    height: 64px;
  }

  .hero {
    margin-bottom: 80px;
    padding: 24px 0 0;
  }

  .hero__statement {
    font-size: 36px;
  }

  .hero__subtitle {
    font-size: 16px;
  }

  .post-header h1 {
    font-size: 28px;
  }

  .post-header__desc {
    font-size: 16px;
  }

  .post-body {
    font-size: 16px;
  }

  .post-body h2 {
    font-size: 20px;
    margin: 48px 0 16px;
  }

  .post-body h3 {
    font-size: 17px;
  }

  .post-body blockquote {
    padding: 20px 18px;
    margin: 28px 0;
    font-size: 16px;
  }

  .post-item {
    margin-bottom: 56px;
  }

  .post-title {
    font-size: 22px;
  }

  .footer {
    padding: 48px 20px;
  }

  .post-header__meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  .about__title {
    font-size: 28px;
  }
}

@media (max-width: 380px) {
  .hero__statement {
    font-size: 28px;
  }

  .post-header h1 {
    font-size: 24px;
  }

  .nav__links {
    gap: 16px;
  }

  .about__title {
    font-size: 24px;
  }
}

/* ── Scrollbar ───────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(80, 69, 59, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
