/* === FONTS === */

@font-face {
  font-family: 'Apfel Grotezk';
  src: url('/fonts/ApfelGrotezk-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Apfel Grotezk';
  src: url('/fonts/ApfelGrotezk-Mittel.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* === CSS VARIABLES (Light theme default) === */

:root {
  --bg: #ffffff;
  --text: #373737;
  --text-muted: #ABABAB;
  --text-secondary: #6b6b6b;
  --border: #e5e5e5;
  --surface: #F8F8F8;
  --surface-hover: #F2F2F2;
  --accent: #d54d33;
  --interactive: #ABABAB;
  --interactive-hover: #047AFE;
  --post-title-color: #373737;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e0e0e0;
  --text-muted: #777;
  --text-secondary: #aaa;
  --border: #333;
  --surface: #242424;
  --surface-hover: #2a2a2a;
  --accent: #e8614a;
  --interactive: #777;
  --interactive-hover: #3d9aff;
  --post-title-color: #e0e0e0;
}

/* === TEXT SELECTION === */

::selection {
  background-color: #047AFE;
  color: #ffffff;
}

[data-theme="dark"] ::selection {
  background-color: #047AFE;
  color: #ffffff;
}

/* === RESET === */

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

/* === BASE === */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Apfel Grotezk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s, color 0.2s;
}

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

/* === LAYOUT === */

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === LOGO THEME SWITCHING === */

.theme-logo-dark { display: none; }

[data-theme="dark"] .theme-logo-light { display: none; }
[data-theme="dark"] .theme-logo-dark { display: inline; }

/* Block display variants for hero */
.hero-logo .theme-logo-light { display: block; }
.hero-logo .theme-logo-dark { display: none; }

[data-theme="dark"] .hero-logo .theme-logo-light { display: none; }
[data-theme="dark"] .hero-logo .theme-logo-dark { display: block; }

/* === NAVBAR === */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transform: translateY(0);
  transition: transform 0.3s, background 0.2s, border-color 0.2s;
}

.navbar.hidden {
  transform: translateY(-100%);
}

.navbar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.navbar-logo img {
  height: 28px;
  width: auto;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.navbar-link {
  font-size: 14px;
  color: var(--interactive);
  text-decoration: none;
  transition: color 0.2s ease;
}

.navbar-link:hover {
  color: var(--interactive-hover);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--interactive);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  color: var(--interactive-hover);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* === HERO SECTION (homepage) === */

.hero {
  padding: 24px 0 0;
}

.hero-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-meta-text {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
}

.hero-meta-text a {
  color: var(--interactive);
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.hero-meta-text a:hover {
  color: var(--interactive-hover);
  border-color: var(--interactive-hover);
}

.hero-meta-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hero-meta-link {
  font-size: 14px;
  color: var(--interactive);
  text-decoration: none;
  transition: color 0.2s ease;
}

.hero-meta-link:hover {
  color: var(--interactive-hover);
}

.hero-spacer {
  height: 22vh;
}

.hero-logo {
  display: block;
}

.hero-logo img {
  width: 160px;
  height: auto;
}

/* === POST LIST (homepage) === */

.post-list {
  list-style: none;
  margin-top: 48px;
}

.post-item {
  padding: 28px 0;
}

.post-item + .post-item {
  border-top: 1px solid var(--border);
}

.post-item-link {
  display: block;
  text-decoration: none;
}

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

.post-title {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--post-title-color);
  transition: color 0.2s ease;
}

.post-meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.post-desc {
  margin-top: 8px;
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === ARTICLE (post page) === */

.article-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 72px;
}

.article-meta-left {
  display: flex;
  align-items: center;
  font-size: 15px;
  color: var(--text-muted);
}

.raw-audio-inline {
  display: inline-flex;
  align-items: center;
}

.raw-audio-inline[data-has-audio="false"] {
  display: none;
}

.meta-dot {
  margin: 0 8px;
  color: var(--text-muted);
}

.article-spacer {
  height: 30vh;
}

.article-header {
  padding: 0;
}

.article-title {
  font-size: 56px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.article-date {
  font-size: 15px;
  color: var(--text-muted);
}

.share-btn {
  font-family: inherit;
  font-size: 14px;
  color: var(--interactive);
  background: none;
  border: 1px solid var(--interactive);
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.share-btn:hover {
  color: var(--interactive-hover);
  border-color: var(--interactive-hover);
}

.share-btn.copied {
  opacity: 0.7;
}

/* === RAW AUDIO (expandable) === */

.raw-audio-toggle {
  display: inline-block;
  font-size: 15px;
  color: var(--interactive);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  transition: color 0.2s ease;
}

.raw-audio-toggle:hover {
  color: var(--interactive-hover);
}

.raw-audio-toggle::before {
  content: '\25B6';
  display: inline-block;
  font-size: 10px;
  margin-right: 6px;
  transition: transform 0.2s;
}

.raw-audio-toggle.expanded::before {
  transform: rotate(90deg);
}

.raw-audio-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.raw-audio-panel.open {
  max-height: 300px;
}

.raw-audio-panel-inner {
  padding: 16px 0;
}

/* Custom audio player */
.custom-audio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 8px;
}

.custom-audio:last-child {
  margin-bottom: 0;
}

.audio-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.audio-play-btn:hover {
  opacity: 0.8;
}

.audio-play-btn svg {
  width: 14px;
  height: 14px;
}

.audio-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-progress {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.audio-progress-bar {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.audio-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

/* === ARTICLE CONTENT === */

.article-content {
  margin-top: 24px;
}

.article-content p {
  margin-bottom: 24px;
}

.article-content h2 {
  font-size: 26px;
  font-weight: 500;
  margin-top: 48px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-content h3 {
  font-size: 21px;
  font-weight: 500;
  margin-top: 36px;
  margin-bottom: 12px;
  line-height: 1.3;
}

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

.article-content li {
  margin-bottom: 8px;
}

.article-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-content code {
  font-size: 15px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
}

.article-content pre {
  background: var(--surface);
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}

.article-content a {
  color: var(--interactive);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.article-content a:hover {
  color: var(--interactive-hover);
  border-bottom-color: var(--interactive-hover);
}

.article-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 24px 0;
}

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

/* === SILICON'S TAKE === */

.silicon-take {
  margin-top: 48px;
  padding: 28px 28px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
}

.silicon-take-header {
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 12px;
}

.silicon-take p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.silicon-take p:last-child {
  margin-bottom: 0;
}

/* === BACK LINK (bottom of post page) === */

.back-link-section {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.back-link {
  font-size: 15px;
  color: var(--interactive);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* === FOOTER === */

.site-footer {
  margin-top: 80px;
  padding: 32px 0;
  text-align: center;
}

.footer-text {
  font-size: 14px;
  color: var(--text-muted);
}

.footer-text a {
  color: var(--interactive);
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-text a:hover {
  color: var(--interactive-hover);
  border-color: var(--interactive-hover);
}

/* === RESPONSIVE === */

@media (max-width: 600px) {
  .hero {
    padding: 20px 0 0;
  }

  .hero-spacer {
    height: 16vh;
  }

  .hero-logo img {
    width: 120px;
  }

  .post-list {
    margin-top: 36px;
  }

  .post-item {
    padding: 24px 0;
  }

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

  .article-top-meta {
    padding-top: 64px;
  }

  .article-spacer {
    height: 20vh;
  }

  .article-title {
    font-size: 36px;
  }

  .article-content {
    margin-top: 20px;
  }

  .silicon-take {
    padding: 24px 20px;
  }

  .site-footer {
    margin-top: 56px;
  }

  .navbar-right {
    gap: 14px;
  }

  .hero-meta-right {
    gap: 14px;
  }
}
