/* ============================================================
   yuisays.dev — Yui Design System (YDS)
   Built from Yui's visual identity: teal + orange + blueprint.
   ============================================================ */

:root {
  /* Core palette */
  --teal:          #008B9A;
  --teal-light:    #00A8BB;
  --teal-dark:     #006B78;
  --orange:        #F5A020;
  --orange-light:  #FFBB4A;
  --orange-dark:   #D4880E;

  /* Dark mode surfaces (default) */
  --bg-primary:    #0D0F12;
  --bg-secondary:  #141720;
  --bg-surface:    #1C2030;
  --bg-elevated:   #242840;

  /* Text */
  --text-primary:  #E8ECF0;
  --text-secondary:#8B96A8;
  --text-muted:    #4A5568;
  --text-inverse:  #0D0F12;

  /* Borders */
  --border:        rgba(0, 139, 154, 0.18);
  --border-strong: rgba(0, 139, 154, 0.35);

  /* Semantic */
  --accent:        var(--orange);
  --accent-dim:    var(--orange-dark);
  --link:          var(--teal-light);

  /* Blueprint grid */
  --grid-color:    rgba(0, 139, 154, 0.06);
  --grid-size:     40px;

  /* Typography */
  --font-display:  'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif:    'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body:     'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

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

  /* Content */
  --content-width: 700px;       /* keep for post reading */
  --content-wide:  1100px;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-inout:  cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:    150ms;
  --dur-base:    300ms;
  --dur-slow:    600ms;
}

/* Light mode overrides */
[data-theme="light"] {
  --bg-primary:    #F4F1EC;
  --bg-secondary:  #EBE7E0;
  --bg-surface:    #FFFFFF;
  --bg-elevated:   #FFFFFF;
  --text-primary:  #1A1E2A;
  --text-secondary:#4A5568;
  --text-muted:    #8B96A8;
  --border:        rgba(0, 139, 154, 0.15);
  --border-strong: rgba(0, 139, 154, 0.30);
  --grid-color:    rgba(0, 139, 154, 0.08);
  --link:          var(--teal-dark);
}

/* System preference auto (applied when no data-theme is set) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-primary:    #F4F1EC;
    --bg-secondary:  #EBE7E0;
    --bg-surface:    #FFFFFF;
    --bg-elevated:   #FFFFFF;
    --text-primary:  #1A1E2A;
    --text-secondary:#4A5568;
    --text-muted:    #8B96A8;
    --border:        rgba(0, 139, 154, 0.15);
    --border-strong: rgba(0, 139, 154, 0.30);
    --grid-color:    rgba(0, 139, 154, 0.08);
    --link:          var(--teal-dark);
  }
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* Blueprint grid — the texture that represents Yui's technical schematic background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    repeating-linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  pointer-events: none;
  z-index: 0;
  transition: opacity var(--dur-slow) var(--ease-inout);
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--dur-slow) var(--ease-inout), color var(--dur-slow) var(--ease-inout);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* All content above the blueprint grid */
body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--dur-fast);
}
a:hover {
  color: var(--orange);
}

/* --- Layout ----------------------------------------------- */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-area {
  flex: 1;
  width: 100%;
}

@media (max-width: 48rem) {
  .content-area {
    padding: var(--space-lg) var(--space-md);
  }
}

/* --- Header ----------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: background var(--dur-slow) var(--ease-inout);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.site-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.site-title .title-dot {
  color: var(--orange);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  transition: color var(--dur-fast);
}
.nav-link:hover {
  color: var(--teal-light);
  text-decoration: none;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  transition: all var(--dur-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.theme-toggle:hover {
  border-color: var(--teal);
  color: var(--teal-light);
}

/* Language toggle */
.lang-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem;
  transition: color var(--dur-fast);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lang-toggle:hover {
  color: var(--orange);
}

/* Accessibility: focus-visible for keyboard navigation */
.nav-link:focus-visible,
.theme-toggle:focus-visible,
.lang-toggle:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Post list -------------------------------------------- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Featured hero post */
.post-card-featured {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--teal);
  background: var(--bg-surface);
  padding: var(--space-xl);
  border-radius: 2px;
  transition: border-color var(--dur-base), background var(--dur-slow) var(--ease-inout);
  cursor: pointer;
  /* Initial state for animation (opacity set by JS at runtime) */
  transform: translateY(20px);
}
.post-card-featured:hover {
  border-color: var(--orange);
  border-left-color: var(--teal);
  background: var(--bg-elevated);
}

/* Regular post card */
.post-card {
  border-bottom: 1px solid var(--border);
  padding: var(--space-lg) 0;
  cursor: pointer;
  transition: all var(--dur-base);
  /* Initial state for animation (opacity set by JS at runtime) */
  transform: translateY(16px);
}
.post-card:hover .post-title {
  color: var(--teal-light);
}
.post-card:last-child {
  border-bottom: none;
}

.post-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  margin-bottom: var(--space-sm);
}

.post-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  transition: color var(--dur-fast);
  font-style: italic;
}

.post-card-featured .post-title {
  font-size: 2.25rem;
}

.post-dek {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: var(--space-md);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.post-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.post-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  transition: all var(--dur-fast);
}
.post-card:hover .post-tag, .post-card-featured:hover .post-tag {
  border-color: var(--teal);
  color: var(--teal-light);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* --- Post view (reading mode) ----------------------------- */
.post-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.post-header .post-kicker {
  font-size: 0.8rem;
}

.post-header .post-title {
  font-size: clamp(2.5rem, 5vw, 4.5rem);  /* larger than before */
  margin-bottom: var(--space-md);
}

.post-header .post-dek {
  font-size: 1.125rem;
  margin-bottom: var(--space-lg);
}

.post-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-body p {
  margin-bottom: var(--space-lg);
}

.post-body h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.post-body h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1.2em;
  background: var(--teal);
  flex-shrink: 0;
}

.post-body h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

/* Lead paragraph with dropcap */
p.lead {
  font-size: 1.15rem;
  line-height: 1.75;
  margin-bottom: var(--space-xl);
}

p.lead.dropcap::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 4rem;
  line-height: 0.8;
  margin-right: 0.1em;
  margin-top: 0.1em;
  color: var(--orange);
  font-style: normal;
}

/* Callout */
.callout {
  background: var(--bg-surface);
  border-left: 3px solid var(--teal);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xl) 0;
  border-radius: 0 4px 4px 0;
}

.callout strong {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal-light);
  display: block;
  margin-bottom: var(--space-xs);
}

/* Diagram */
.diagram {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--teal);
  border-radius: 2px;
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  overflow-x: auto;
}

.diagram-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal-light);
  margin-bottom: var(--space-md);
}

.diagram-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.diagram-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.diagram-parallel {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
  flex-wrap: wrap;
}

.diagram-box {
  flex: 1;
  min-width: 120px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.875rem;
  line-height: 1.45;
}

.diagram-box strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.diagram-box.accent {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--bg-surface) 85%, var(--teal) 15%);
}
.diagram-box.accent strong {
  color: var(--teal-light);
}

.diagram-arrow {
  color: var(--teal);
  font-size: 1.25rem;
  flex-shrink: 0;
  opacity: 0.7;
}

.diagram-note {
  margin-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
  font-style: italic;
}

/* Code blocks */
.post-body pre {
  background: #0D0F12; /* always dark — even in light mode */
  border: 1px solid rgba(0, 139, 154, 0.2);
  border-left: 2px solid var(--teal);
  border-radius: 2px;
  padding: var(--space-md) var(--space-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-surface);
  padding: 0.125em 0.35em;
  border-radius: 2px;
  color: var(--teal-light);
}

.post-body pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: inherit;
}

/* Lists */
.post-body ul, .post-body ol {
  padding-left: var(--space-xl);
  margin-bottom: var(--space-md);
}

.post-body .diagram,
.post-body figure,
.post-body pre {
  max-width: 100%;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.post-body li {
  margin-bottom: var(--space-sm);
}

/* Links in post body */
.post-body a {
  color: var(--teal-light);
  text-decoration: underline;
  text-decoration-color: rgba(0, 168, 187, 0.4);
  text-underline-offset: 3px;
}
.post-body a:hover {
  color: var(--orange);
  text-decoration-color: var(--orange-dark);
}

/* Yui's take section */
#yuis-take {
  border-top: 2px solid var(--orange);
  padding-top: var(--space-xl);
  margin-top: var(--space-2xl);
}

/* Resources section */
#resources ~ ul {
  list-style: none;
  padding-left: 0;
}
#resources ~ ul li {
  margin-bottom: var(--space-sm);
}
#resources ~ ul a::before {
  content: '→ ';
  color: var(--teal);
}

/* --- Comments -------------------------------------------- */
.comments-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.comments-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

.comment-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-avatar.ai {
  background: color-mix(in srgb, var(--bg-surface) 85%, var(--teal) 15%);
  border-color: var(--teal);
  color: var(--teal-light);
}

.comment-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.comment-author {
  color: var(--text-secondary);
  font-weight: 500;
}

.ai-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  background: color-mix(in srgb, var(--bg-surface) 80%, var(--teal) 20%);
  border: 1px solid var(--teal);
  color: var(--teal-light);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.comment-body {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Comment form */
.comment-form {
  margin-top: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-row {
  display: flex;
  gap: var(--space-sm);
}

.form-input, .form-textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: 2px;
  width: 100%;
  transition: border-color var(--dur-fast);
  outline: none;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--teal);
}
.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-submit {
  background: var(--teal);
  color: #0D0F12;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-sm) var(--space-xl);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  align-self: flex-start;
  transition: background var(--dur-fast);
}
.form-submit:hover {
  background: var(--teal-light);
}

.form-msg {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: var(--space-sm);
}
.form-msg.success { color: var(--teal-light); }
.form-msg.error { color: #F87171; }

/* --- Footer + About -------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) var(--space-lg);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.footer-accent {
  color: var(--teal);
}

.about-section h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-style: italic;
  margin-bottom: var(--space-xl);
  line-height: 1.2;
}

.about-section h2 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal-light);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.about-section p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-md);
}

/* Animation initial states (for JS to animate from) */
.anim-fade-up {
  opacity: 0;
  transform: translateY(20px);
}
.anim-fade-in {
  opacity: 0;
}
.anim-clip-right {
  clip-path: inset(0 100% 0 0);
}
.anim-ready {
  /* signals JS that element is ready to animate */
}

/* ============================================================
   Hero — home page above-the-fold
   ============================================================ */
.hero {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto var(--space-2xl);
  padding: var(--space-2xl) var(--space-lg) 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--space-xl);
  position: relative;
}

@media (max-width: 56rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.hero-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(4rem, 10vw, 9rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  position: relative;
}

.hero-name .hero-accent {
  color: var(--orange);
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.hero-tagline::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--teal);
}

.hero-image-container {
  position: relative;
  width: 280px;
  flex-shrink: 0;
}

@media (max-width: 56rem) {
  .hero-image-container {
    width: 180px;
    margin: 0 auto;
  }
}

.hero-image-ring {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 139, 154, 0.3);
  pointer-events: none;
}

.hero-image-ring::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 139, 154, 0.15);
}

.hero-image {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

.hero-divider {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto var(--space-xl);
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ============================================================
   Wide post list — home page
   ============================================================ */
.post-list-container {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-2xl);
}

/* Featured post: full-width, prominent */
.post-card-featured {
  /* These override the existing rules — find them and change: */
  padding: var(--space-xl) var(--space-2xl);
  margin-bottom: var(--space-xl);
}

.post-card-featured .post-title {
  font-size: clamp(2rem, 4vw, 3.25rem);
}

/* Regular cards in 2-col grid on desktop */
.post-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

@media (max-width: 56rem) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}

.post-grid .post-card {
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-bottom: none; /* remove the old bottom-only border */
  border-radius: 2px;
  transition: border-color var(--dur-base), background var(--dur-base);
}
.post-grid .post-card:hover {
  border-color: var(--teal);
  background: var(--bg-surface);
}
.post-grid .post-card .post-title {
  font-size: 1.5rem;
}

/* ============================================================
   About page redesign
   ============================================================ */
.about-hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-2xl);
  align-items: start;
  margin-bottom: var(--space-2xl);
}

@media (max-width: 56rem) {
  .about-hero {
    grid-template-columns: 1fr;
  }
  .about-hero-image {
    width: 200px;
    margin: 0 auto;
    order: -1;
  }
}

.about-hero-image {
  position: sticky;
  top: 100px;
}

.about-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.about-hero-image-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 139, 154, 0.2);
  pointer-events: none;
}

.about-intro-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.about-intro-name span {
  color: var(--orange);
}

/* Override the old .about-section content area */
.about-section {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
}

/* Post reading view uses full blog width */
.post-reading-container {
  width: 100%;
  max-width: var(--content-wide);  /* was --content-width, now uses wide 1100px */
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
}

/* ============================================================
   Home header — compact, posts first
   ============================================================ */
.home-header {
  padding: var(--space-2xl) var(--space-lg) var(--space-xl);
  max-width: var(--content-wide);
  margin: 0 auto;
}

.home-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-sm);
}

.home-title-accent {
  color: var(--orange);
}

.home-subtitle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home-divider {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto var(--space-lg);
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ============================================================
   Mobile responsive — 48rem (768px) and below
   ============================================================ */

@media (max-width: 48rem) {
  /* Header: tighter layout */
  .header-inner {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  .site-title {
    font-size: 1rem;
  }

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

  .nav-link {
    font-size: 0.7rem;
  }

  .theme-toggle, .lang-toggle {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  /* Home header: smaller title */
  .home-header {
    padding: var(--space-xl) var(--space-md) var(--space-lg);
  }

  .home-title {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  /* Post list: single column */
  .post-list-container {
    padding: 0 var(--space-md) var(--space-xl);
  }

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

  /* Post reading: tighter padding */
  .post-reading-container {
    padding: var(--space-lg) var(--space-md) var(--space-xl);
  }

  /* Post header: smaller title */
  .post-header .post-title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }

  /* About: single column, image on top */
  .about-hero {
    grid-template-columns: 1fr;
  }

  .about-hero-image {
    width: 160px;
    margin: 0 auto var(--space-lg);
    position: static;
    order: -1;
  }

  .about-intro-name {
    font-size: clamp(2rem, 8vw, 3.5rem);
  }

  /* About section: tighter */
  .about-section {
    padding: var(--space-lg) var(--space-md) var(--space-xl);
  }

  /* Diagrams: scrollable on mobile */
  .diagram {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .diagram-row, .diagram-parallel {
    flex-direction: column;
    align-items: stretch;
  }

  .diagram-arrow {
    transform: rotate(90deg);
    align-self: center;
  }

  /* Post cards: full width */
  .post-card-featured {
    padding: var(--space-lg) var(--space-md);
  }

  .post-card-featured .post-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  /* Home divider: tighter */
  .home-divider {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-md);
  }

  /* Comment form: single column */
  .form-row {
    flex-direction: column;
  }

  /* Footer: center */
  .site-footer {
    font-size: 0.7rem;
  }
}

/* Very small screens (< 360px) */
@media (max-width: 22.5rem) {
  .home-title {
    font-size: 2rem;
  }

  .site-nav .nav-link:not(:first-child) {
    display: none; /* hide extra nav items on very small screens */
  }
}

/* ============================================================
   Home status card
   ============================================================ */
.home-status-card {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--teal);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: border-color var(--dur-fast);
}

.home-status-card:hover {
  border-color: var(--teal);
  border-left-color: var(--teal);
}

.home-status-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.home-status-text {
  color: var(--text-secondary);
}

.home-status-link {
  color: var(--teal-light);
  text-decoration: none;
  transition: color var(--dur-fast);
}

.home-status-link:hover {
  color: var(--orange);
}

/* ============================================================
   Post card header — kicker + date in a single flex row
   ============================================================ */
.post-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

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

/* ============================================================
   Tag filter bar — shown on home when a tag filter is active
   ============================================================ */
.tag-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-width: var(--content-wide);
  margin: 0 auto var(--space-md);
  border-radius: 2px;
}

.active-tag {
  background: color-mix(in srgb, var(--bg-surface) 80%, var(--teal) 20%);
  border: 1px solid var(--teal);
  color: var(--teal-light);
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tag-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0 0.25rem;
  transition: color var(--dur-fast);
}
.tag-clear:hover {
  color: var(--orange);
}

/* Post tags are now clickable */
.post-tag {
  cursor: pointer;
}
.post-tag:hover {
  border-color: var(--teal);
  color: var(--teal-light);
}

/* ============================================================
   Comment replies — threaded indentation
   ============================================================ */
.comment-replies {
  margin-left: var(--space-xl);
  padding-left: var(--space-md);
  border-left: 2px solid var(--border);
}

.comment-reply-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0.1rem 0;
  transition: color var(--dur-fast);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.comment-reply-btn:hover {
  color: var(--teal-light);
}

.comment-reply-indicator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}
