/* ================================================================
   Raven Theme — Ravenlight Visual Identity
   Dark-native · Space Grotesk + DM Sans · Warm charcoal palette
   ================================================================ */

/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Palette */
  --c-bg:      #1C1914;   /* Raven Dark — page background, app shell */
  --c-surface: #252219;   /* Raven Surface — cards, panels, modals */
  --c-text:    #F0EDE6;   /* Soft Parchment — body text, headings */
  --c-violet:  #A393BF;   /* Raven Violet — accent, interactive, links */
  --c-amber:   #E8953B;   /* Muninn Amber — achievement states only */

  --c-rule:    rgba(163, 147, 191, 0.12);   /* Subtle divider tint */

  /* Fonts */
  --f-display: 'Space Grotesk', sans-serif;
  --f-body:    'DM Sans', sans-serif;
  --f-mono:    'SF Mono', 'Fira Code', 'Fira Mono', monospace;

  /* Type scale (desktop) */
  --t-display: clamp(2.5rem, 5.5vw, 4rem);   /* 64px → fluid */
  --t-h1: 2.5rem;       /* 40px */
  --t-h2: 2rem;         /* 32px */
  --t-h3: 1.5rem;       /* 24px */
  --t-body: 1rem;       /* 16px */
  --t-label: 0.8125rem; /* 13px */
  --t-caption: 0.75rem; /* 12px */

  /* Spacing — 8px base grid */
  --s1:  0.5rem;    /*  8px */
  --s2:  1rem;      /* 16px */
  --s3:  1.5rem;    /* 24px */
  --s4:  2rem;      /* 32px */
  --s5:  2.5rem;    /* 40px */
  --s6:  3rem;      /* 48px */
  --s8:  4rem;      /* 64px */
  --s10: 5rem;      /* 80px */
  --s12: 6rem;      /* 96px */
  --s16: 8rem;      /* 128px */

  /* Shape — almost sharp, not friendly */
  --radius: 5px;

  /* Motion */
  --dur-ui:       200ms;
  --dur-ceremony: 500ms;
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --max-content:    1280px;
  --gutter:         1.5rem;   /* 24px mobile */
}

@media (min-width: 640px)  { :root { --gutter: 3rem;  } }  /* 48px tablet */
@media (min-width: 1024px) { :root { --gutter: 5rem;  } }  /* 80px desktop */

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

/* ── Base ───────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

/* ── Accessibility ──────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--s2);
  z-index: 999;
  background: var(--c-violet);
  color: var(--c-bg);
  padding: var(--s1) var(--s3);
  border-radius: var(--radius);
  font-family: var(--f-body);
  font-size: var(--t-label);
  font-weight: 500;
  text-decoration: none;
  transition: top var(--dur-ui);
}

.skip-link:focus {
  top: var(--s2);
}

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

h1 { font-size: var(--t-h1); line-height: 1.15; }
h2 { font-size: var(--t-h2); line-height: 1.2;  }
h3 { font-size: var(--t-h3); font-weight: 600; line-height: 1.3; }

p { line-height: 1.65; }

strong { font-weight: 600; }

em { font-style: italic; }

/* ── Links ──────────────────────────────────────────────────────── */
a {
  color: var(--c-violet);
  text-decoration: none;
  transition: opacity var(--dur-ui) var(--ease-out);
}

a:hover {
  opacity: 0.78;
}

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

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

.site-main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ── Site Header / Nav ──────────────────────────────────────────── */
.site-header {
  padding-block: var(--s4);
  border-bottom: 1px solid var(--c-rule);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.site-title {
  font-family: var(--f-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-text);
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity var(--dur-ui) var(--ease-out);
}

.site-title:hover {
  color: var(--c-text);
  opacity: 0.8;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s4);
  list-style: none;
}

.nav-links a {
  font-family: var(--f-body);
  font-size: var(--t-label);
  font-weight: 500;
  color: var(--c-text);
  text-decoration: none;
  opacity: 0.55;
  transition: opacity var(--dur-ui) var(--ease-out);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--c-text);
}

/* ── Site Footer ────────────────────────────────────────────────── */
.site-footer {
  margin-top: var(--s10);
  padding-block: var(--s6);
  border-top: 1px solid var(--c-rule);
}

.site-footer p {
  font-size: var(--t-caption);
  opacity: 0.35;
  max-width: none;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  font-family: var(--f-body);
  font-size: var(--t-label);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius);
  padding: 0.75rem 1.375rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    opacity          var(--dur-ui) var(--ease-out),
    border-color     var(--dur-ui) var(--ease-out),
    background-color var(--dur-ui) var(--ease-out);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--c-violet);
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--c-violet);
  color: var(--c-bg);
  border-color: var(--c-violet);
}

.btn-primary:hover {
  opacity: 0.87;
  color: var(--c-bg);
}

.btn-ghost {
  background-color: transparent;
  color: var(--c-text);
  border-color: rgba(240, 237, 230, 0.18);
}

.btn-ghost:hover {
  border-color: rgba(240, 237, 230, 0.38);
  color: var(--c-text);
  opacity: 1;
}

/* ── Hero Section ───────────────────────────────────────────────── */
.hero {
  padding-block: var(--s16);
  text-align: center;
}

.hero-headline {
  font-family: var(--f-display);
  font-size: var(--t-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--c-text);
  max-width: 20ch;
  margin-inline: auto;
  margin-bottom: var(--s4);
}

.hero-subtext {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--c-text);
  opacity: 0.62;
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: var(--s6);
}

.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
}

.cta-trust {
  font-size: var(--t-caption);
  color: var(--c-text);
  opacity: 0.38;
  max-width: 44ch;
  text-align: center;
  line-height: 1.5;
  max-width: none;
}

/* ── Narrow container modifier ──────────────────────────────────── */
.container--narrow {
  max-width: 680px;
}

/* ── Shared section text styles ─────────────────────────────────── */
.section-headline {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3vw, var(--t-h2));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--c-text);
  margin-bottom: var(--s4);
}

.section-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--c-text);
  opacity: 0.65;
}

/* ── Problem Section ────────────────────────────────────────────── */
.problem-section {
  padding-block: var(--s16);
  border-top: 1px solid var(--c-rule);
  text-align: center;
}

/* ── Idea Section ───────────────────────────────────────────────── */
.idea-section {
  padding-block: var(--s16);
  border-top: 1px solid var(--c-rule);
  text-align: center;
}

.accent-word {
  color: var(--c-amber);
}

/* ── Builder Section ────────────────────────────────────────────── */
.builder-section {
  padding-block: var(--s16);
  border-top: 1px solid var(--c-rule);
  text-align: center;
}

/* ── Invite / Signup Section ────────────────────────────────────── */
.invite-section {
  padding-block: var(--s16);
  border-top: 1px solid var(--c-rule);
  text-align: center;
}

.invite-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--c-text);
  opacity: 0.65;
  margin-bottom: var(--s8);
}

/* ── Signup Form ────────────────────────────────────────────────── */
.signup-form {
  max-width: 440px;
  margin-inline: auto;
}

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

@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
  }
}

.form-input {
  flex: 1;
  font-family: var(--f-body);
  font-size: var(--t-body);
  color: var(--c-text);
  background-color: var(--c-surface);
  border: 1px solid rgba(240, 237, 230, 0.12);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color var(--dur-ui) var(--ease-out);
  min-width: 0;
}

.form-input::placeholder {
  color: var(--c-text);
  opacity: 0.35;
}

.form-input:focus {
  border-color: var(--c-violet);
}

.form-note {
  font-size: var(--t-caption);
  color: var(--c-text);
  opacity: 0.38;
  margin-top: var(--s2);
  line-height: 1.5;
}

.form-success {
  font-size: var(--t-body);
  color: var(--c-violet);
  margin-top: var(--s2);
  text-align: center;
}

.form-error {
  font-size: var(--t-caption);
  color: var(--c-amber);
  margin-top: var(--s2);
}

/* ── Screen reader only ─────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Features Section ───────────────────────────────────────────── */
.features-section {
  padding-block: var(--s12);
  border-top: 1px solid var(--c-rule);
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background-color: var(--c-surface);
  border-radius: 0;
  padding: var(--s6) var(--s5);
}

.features-grid .feature-card:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.features-grid .feature-card:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

@media (max-width: 767px) {
  .feature-card               { border-radius: 0 !important; }
  .features-grid .feature-card:first-child { border-radius: var(--radius) var(--radius) 0 0 !important; }
  .features-grid .feature-card:last-child  { border-radius: 0 0 var(--radius) var(--radius) !important; }
}

.feature-number {
  font-family: var(--f-display);
  font-size: var(--t-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-violet);
  opacity: 0.55;
  margin-bottom: var(--s3);
}

.feature-title {
  font-family: var(--f-display);
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--s2);
}

.feature-body {
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--c-text);
  opacity: 0.58;
  max-width: 38ch;
}

/* ── Manifesto Section ──────────────────────────────────────────── */
.manifesto-section {
  padding-block: var(--s16);
  border-top: 1px solid var(--c-rule);
  text-align: center;
}

.manifesto-quote {
  border: none;
  padding: 0;
  margin: 0 auto;
  max-width: 30ch;
}

.manifesto-quote p {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--c-text);
  opacity: 0.88;
  max-width: none;
}

/* ── Recent Posts on Homepage ───────────────────────────────────── */
.recent-posts-section {
  padding-block: var(--s10);
  border-top: 1px solid var(--c-rule);
}

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

.section-title {
  font-size: var(--t-h2);
}

.section-link {
  font-size: var(--t-label);
  font-weight: 500;
  color: var(--c-violet);
  opacity: 0.72;
  transition: opacity var(--dur-ui) var(--ease-out);
}

.section-link:hover {
  opacity: 1;
}

/* ── Post List ──────────────────────────────────────────────────── */
.post-list {
  list-style: none;
}

.post-list-item {
  border-top: 1px solid var(--c-rule);
  padding-block: var(--s5);
}

.post-list-item:last-child {
  border-bottom: 1px solid var(--c-rule);
}

.post-list-meta {
  font-size: var(--t-caption);
  color: var(--c-text);
  opacity: 0.4;
  margin-bottom: var(--s1);
  font-weight: 400;
  max-width: none;
}

.post-list-title {
  font-family: var(--f-display);
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--s1);
}

.post-list-title a {
  color: var(--c-text);
  text-decoration: none;
  transition: color var(--dur-ui) var(--ease-out);
}

.post-list-title a:hover {
  color: var(--c-violet);
  opacity: 1;
}

.post-list-summary {
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--c-text);
  opacity: 0.55;
  max-width: 66ch;
}

/* ── Page Header (list pages) ───────────────────────────────────── */
.page-header {
  padding-top: var(--s10);
  padding-bottom: var(--s6);
  border-bottom: 1px solid var(--c-rule);
  margin-bottom: var(--s2);
}

.page-header h1 {
  font-size: var(--t-h1);
  margin-bottom: var(--s2);
}

.page-description {
  font-size: 1.0625rem;
  line-height: 1.65;
  opacity: 0.55;
  max-width: 60ch;
}

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
  padding-block: var(--s10);
  text-align: center;
  opacity: 0.4;
}

/* ── Article Header ─────────────────────────────────────────────── */
.article-header {
  padding-top: var(--s10);
  padding-bottom: var(--s6);
  max-width: 720px;
  border-bottom: 1px solid var(--c-rule);
  margin-bottom: var(--s6);
}

.article-meta {
  font-size: var(--t-label);
  font-weight: 500;
  color: var(--c-violet);
  letter-spacing: 0.03em;
  margin-bottom: var(--s2);
  max-width: none;
}

.article-title {
  font-family: var(--f-display);
  font-size: var(--t-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--s3);
}

.article-description {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--c-text);
  opacity: 0.6;
  max-width: 60ch;
}

/* ── Article Body ───────────────────────────────────────────────── */
.article-body {
  max-width: 68ch;
  padding-bottom: var(--s10);
}

.article-body > * + * {
  margin-top: var(--s4);
}

.article-body h2 {
  font-size: var(--t-h2);
  margin-top: var(--s8);
  margin-bottom: var(--s3);
}

.article-body h3 {
  font-size: var(--t-h3);
  font-weight: 600;
  margin-top: var(--s6);
  margin-bottom: var(--s2);
}

.article-body p {
  line-height: 1.75;
}

.article-body ul,
.article-body ol {
  padding-left: var(--s4);
}

.article-body li {
  line-height: 1.65;
}

.article-body li + li {
  margin-top: var(--s1);
}

.article-body blockquote {
  border: none;
  border-left: 2px solid var(--c-violet);
  padding-left: var(--s4);
  color: var(--c-text);
  opacity: 0.72;
  margin: var(--s6) 0;
}

.article-body code {
  font-family: var(--f-mono);
  font-size: 0.875em;
  background-color: var(--c-surface);
  border-radius: 3px;
  padding: 0.15em 0.45em;
}

.article-body pre {
  background-color: var(--c-surface);
  border-radius: var(--radius);
  padding: var(--s4);
  overflow-x: auto;
  border: 1px solid var(--c-rule);
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.65;
}

.article-body a {
  text-decoration: underline;
  text-decoration-color: rgba(163, 147, 191, 0.4);
  text-underline-offset: 3px;
  transition:
    text-decoration-color var(--dur-ui) var(--ease-out),
    opacity               var(--dur-ui) var(--ease-out);
}

.article-body a:hover {
  text-decoration-color: var(--c-violet);
  opacity: 1;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--c-rule);
  margin-block: var(--s6);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-label);
}

.article-body th,
.article-body td {
  text-align: left;
  padding: var(--s1) var(--s2);
  border-bottom: 1px solid var(--c-rule);
}

.article-body th {
  font-weight: 500;
  color: var(--c-violet);
  letter-spacing: 0.03em;
}

/* ── Article Navigation ─────────────────────────────────────────── */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  padding-block: var(--s6);
  border-top: 1px solid var(--c-rule);
  margin-top: var(--s4);
}

.article-nav-link {
  font-size: var(--t-label);
  font-weight: 500;
  color: var(--c-violet);
}

.article-nav-next {
  margin-left: auto;
}

/* ── 404 Page ───────────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-block: var(--s16);
  min-height: 60vh;
}

.error-code {
  font-family: var(--f-display);
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--c-violet);
  opacity: 0.35;
  margin-bottom: var(--s4);
}

.error-message {
  font-family: var(--f-display);
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--s2);
}

.error-sub {
  font-size: var(--t-body);
  opacity: 0.5;
  margin-bottom: var(--s6);
  max-width: 42ch;
}
