/* T R A D E W I N D — Website Stylesheet */
/* Dieter Rams functionalism. Less, but better. */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500&family=JetBrains+Mono:wght@300;400&display=swap');

/* === Design Tokens === */
:root {
  --white: #FAFAF8;
  --surface: #F2EDE8;
  --surface-warm: #EAE4DC;
  --black: #1A1A18;

  --chrome: #D6D0C8;
  --chrome-dark: #B8B0A6;

  --text-primary: #1A1A18;
  --text-secondary: #6B6560;
  --text-tertiary: #9B9590;

  --accent: #E8610A;
  --accent-green: #4A8C3F;
  --accent-red: #C4412B;

  --font-ui: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --max-width: 1100px;
  --section-gap: 120px;
}

[data-theme="dark"] {
  --white: #242320;
  --surface: #1C1B18;
  --surface-warm: #2C2B27;
  --black: #141311;

  --chrome: #3A3835;
  --chrome-dark: #4A4745;

  --text-primary: #E8E4DC;
  --text-secondary: #9B9590;
  --text-tertiary: #6B6560;
}

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

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

body {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--surface);
}

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

a:hover {
  text-decoration: underline;
}

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

/* === Typography === */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.25;
}

h1 { font-size: 48px; letter-spacing: -0.5px; }
h2 { font-size: 28px; }
h3 { font-size: 18px; }

.mono {
  font-family: var(--font-mono);
  font-weight: 400;
}

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }

/* === Navigation === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--black);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 32px;
}

.nav-brand {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  margin-right: 48px;
}

.nav-brand:hover {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  flex: 1;
}

.nav-links a {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.15s;
  padding: 14px 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: rgba(255,255,255,0.85);
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 300;
  color: rgba(255,255,255,0.45);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  transition: color 0.15s;
}

.theme-toggle:hover { color: rgba(255,255,255,0.85); }

.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
}

/* === Hero === */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 32px 80px;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.hero-title {
  font-size: 56px;
  font-weight: 500;
  letter-spacing: 12px;
  color: #FAFAF8;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.hero-subtitle {
  font-size: 18px;
  font-weight: 300;
  color: rgba(250,250,248,0.75);
  margin-bottom: 40px;
  line-height: 1.6;
}

.hero-stats {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 300;
  color: rgba(250,250,248,0.5);
  margin-bottom: 48px;
  letter-spacing: 1px;
}

.hero-stats span {
  margin: 0 12px;
}

.hero-stats .separator {
  color: rgba(250,250,248,0.2);
}

.hero-cta {
  display: inline-block;
  padding: 14px 32px;
  border: 1px solid rgba(250,250,248,0.25);
  border-radius: 6px;
  color: #FAFAF8;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.hero-cta:hover {
  border-color: rgba(250,250,248,0.6);
  background: rgba(250,250,248,0.1);
  color: #FAFAF8;
  text-decoration: none;
}

/* === Sections === */
.section {
  padding: 100px 32px;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-title {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.section-description {
  font-size: 16px;
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.7;
  margin-bottom: 48px;
}

.section-alt {
  background: var(--white);
}

/* === Architecture Layers === */
.layers {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 8px;
  overflow: hidden;
}

.layer {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  background: var(--white);
  transition: background 0.15s;
}

[data-theme="dark"] .layer {
  background: var(--surface-warm);
}

.layer:hover {
  background: var(--surface-warm);
}

[data-theme="dark"] .layer:hover {
  background: var(--chrome);
}

.layer-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 20px;
}

.layer-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
  min-width: 120px;
}

.layer-desc {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
}

/* === Systems Grid === */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.system-card {
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--chrome);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.system-card:hover {
  border-color: var(--accent);
}

.system-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.system-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.system-lines {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* === Voyages Timeline === */
.voyages {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.voyage {
  display: flex;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--chrome);
}

.voyage:last-child { border-bottom: none; }

.voyage-number {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  min-width: 32px;
  padding-top: 2px;
}

.voyage-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
  min-width: 180px;
}

.voyage-status {
  font-size: 13px;
  font-weight: 300;
  color: var(--text-secondary);
  flex: 1;
}

.voyage-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
}

.voyage-badge.complete {
  background: rgba(74, 140, 63, 0.1);
  color: var(--accent-green);
}

.voyage-badge.active {
  background: rgba(232, 97, 10, 0.1);
  color: var(--accent);
}

/* === Naming Table === */
.naming-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
}

.naming-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--white);
  border-radius: 4px;
}

.naming-concept {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
}

.naming-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

/* === Numbers Section === */
.numbers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}

.number-item {
  text-align: center;
}

.number-value {
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}

.number-label {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
}

/* === Footer === */
.footer {
  padding: 60px 32px;
  text-align: center;
  border-top: 1px solid var(--chrome);
}

.footer-tagline {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-tertiary);
  font-style: italic;
  margin-bottom: 12px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* === Blog Pages === */
.blog-page {
  padding-top: 84px;
  min-height: 100vh;
}

.blog-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 32px 24px;
}

.blog-header h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.blog-header p {
  color: var(--text-secondary);
  font-weight: 300;
}

.blog-list {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blog-card {
  display: block;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--chrome);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s;
}

.blog-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.blog-card-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.blog-card-excerpt {
  font-size: 14px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.blog-card-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  gap: 16px;
}

.blog-card-tag {
  color: var(--accent);
}

/* Single Post */
.post-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.post-title {
  font-size: 36px;
  font-weight: 500;
  margin-bottom: 12px;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 40px;
  display: flex;
  gap: 16px;
}

.post-content {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-content h1 { font-size: 28px; margin: 40px 0 16px; }
.post-content h2 { font-size: 22px; margin: 32px 0 12px; }
.post-content h3 { font-size: 18px; margin: 24px 0 8px; }
.post-content p { margin-bottom: 16px; }
.post-content a { color: var(--accent); }

.post-content code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface-warm);
  padding: 2px 6px;
  border-radius: 3px;
}

.post-content pre {
  background: var(--black);
  color: #E8E4DC;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 24px 0;
  line-height: 1.5;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

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

.post-content li { margin-bottom: 4px; }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 24px 0;
  background: var(--surface-warm);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.post-back {
  display: inline-block;
  margin-bottom: 32px;
  font-size: 14px;
  color: var(--text-secondary);
}

.post-back:hover { color: var(--accent); }

/* Tag Cloud */
.tag-cloud {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud:empty { display: none; }

.tag-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  padding: 4px 12px;
  border-radius: 3px;
  border: 1px solid var(--chrome);
  background: var(--white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FAFAF8;
}

.tag-pill-count {
  color: var(--text-tertiary);
  margin-left: 4px;
}

.tag-pill.active .tag-pill-count {
  color: rgba(250,250,248,0.7);
}

.blog-empty {
  text-align: center;
  padding: 80px 32px;
  color: var(--text-tertiary);
}

.blog-loading {
  text-align: center;
  padding: 80px 32px;
  color: var(--text-tertiary);
}

/* === Responsive === */
@media (max-width: 768px) {
  :root { --section-gap: 80px; }

  .nav-links { display: none; }
  .nav-mobile-toggle { display: block; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--black);
    padding: 16px 32px 24px;
    gap: 8px;
  }

  .hero-title {
    font-size: 32px;
    letter-spacing: 6px;
  }

  .hero-subtitle { font-size: 16px; }
  .hero-stats { font-size: 12px; }
  .hero-stats span { display: block; margin: 4px 0; }
  .hero-stats .separator { display: none; }

  h1 { font-size: 32px; }
  h2 { font-size: 24px; }

  .section { padding: 60px 20px; }

  .systems-grid { grid-template-columns: 1fr; }
  .naming-grid { grid-template-columns: 1fr; }
  .numbers-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .number-value { font-size: 36px; }

  .voyage { flex-direction: column; gap: 4px; }
  .voyage-name { min-width: unset; }

  .layer { flex-direction: column; gap: 4px; align-items: flex-start; }
  .layer-name { min-width: unset; }
}
