/* front's chrome: nav, footer, hero and page frame, built only from the
   design system's tokens (tsc.css). Editorial register: no rounded content
   surfaces, no engagement metrics, content appears and does not dance. */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: calc(-1 * var(--space-16));
  font-family: var(--font-ui);
  font-size: var(--text-body-sm);
  background: var(--bg-surface);
  padding: var(--space-2) var(--space-4);
  z-index: 10;
}

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

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: var(--header-height);
  background: var(--bg-surface-dark);
  padding: var(--space-3) var(--grid-margin);
}

.nav-wordmark {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  line-height: var(--lh-heading-lg);
  color: var(--text-inverted);
  text-decoration: none;
  white-space: nowrap;
}

.nav-wordmark:hover {
  color: var(--text-inverted);
}

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

.nav-links a {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-inverted-muted);
  text-decoration: none;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
}

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

.nav-links a[aria-current="page"] {
  border-bottom-color: var(--border-accent);
}

.nav-links a.nav-cta {
  color: var(--interactive-accent-text);
  background: var(--interactive-accent-bg);
  padding: var(--space-2) var(--space-5);
  border-bottom: none;
}

/* A member's handle keeps its own case. */
.nav-links a.nav-member {
  text-transform: none;
}

/* Sign out is a form (a POST), dressed as the nav's links. */
.nav-signout button {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-inverted-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-2) 0;
  cursor: pointer;
}

.nav-signout button:hover {
  color: var(--text-inverted);
}

/* ── Taxonomy label: SECTION · SUBSECTION · MONTH YEAR ── */
.taxonomy-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-label-lg);
  line-height: var(--lh-label-lg);
  letter-spacing: var(--ls-label-lg);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-accent);
  margin-bottom: var(--space-4);
}

.taxonomy-label::before {
  content: "";
  width: var(--space-6);
  border-top: 2px solid var(--color-rust-500);
}

/* ── Hero ── */
.hero {
  background: var(--bg-surface-dark);
  color: var(--text-inverted);
  padding: var(--hero-padding-top) var(--grid-margin) var(--hero-padding-bottom);
}

.hero-inner {
  max-width: 960px;
}

.hero-headline {
  color: var(--text-inverted);
  margin-bottom: var(--space-6);
}

.hero-lede {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--text-inverted-muted);
  max-width: var(--article-max-width);
}

/* ── Page frame ── */
.page {
  max-width: var(--article-max-width);
  margin: 0 auto;
  padding: var(--space-16) var(--article-padding-x);
}

.page-headline {
  font-size: var(--text-display-lg);
  line-height: var(--lh-display-lg);
  letter-spacing: var(--ls-display-lg);
  margin-bottom: var(--space-6);
}

.page-note {
  color: var(--text-secondary);
}

/* ── Byline: the writer, never a count ── */
.byline {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ── Home feed: the newest piece leads ── */
.feed {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-16) var(--grid-margin);
}

.feed-lead {
  padding-bottom: var(--space-12);
  border-bottom: 2px solid var(--text-primary);
}

.feed-lead-headline,
.feed-headline {
  font-family: var(--font-display);
  font-weight: 400;
}

.feed-lead-headline {
  font-size: var(--text-display-lg);
  line-height: var(--lh-display-lg);
  letter-spacing: var(--ls-display-lg);
  margin-bottom: var(--space-4);
}

.feed-headline {
  font-size: var(--text-display-sm);
  line-height: var(--lh-display-sm);
  letter-spacing: var(--ls-display-sm);
  margin-bottom: var(--space-3);
}

.feed-lead-headline a,
.feed-headline a {
  text-decoration: none;
}

.feed-dek {
  font-family: var(--font-body);
  color: var(--text-secondary);
  max-width: var(--article-max-width);
  margin-bottom: var(--space-3);
}

.feed-list {
  list-style: none;
}

.feed-item {
  padding: var(--space-10) 0;
  border-bottom: 1px solid var(--border-default);
}

/* ── A piece: its chrome, then its frame from the content host ── */
.piece-header {
  background: var(--bg-surface-dark);
  padding: var(--hero-padding-top) var(--grid-margin) var(--space-12);
}

.piece-header-inner {
  max-width: 960px;
}

.piece-headline {
  color: var(--text-inverted);
  font-size: var(--text-display-lg);
  line-height: var(--lh-display-lg);
  letter-spacing: var(--ls-display-lg);
  margin-bottom: var(--space-6);
}

.piece-dek {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--text-inverted-muted);
  max-width: var(--article-max-width);
  margin-bottom: var(--space-6);
}

.piece-header .byline {
  color: var(--text-inverted-muted);
}

/* Until the piece reports its height (read.js), the frame takes most of a
   screen and scrolls inside itself, so the piece is readable without it. */
.piece-frame {
  display: block;
  width: 100%;
  height: 80vh;
  border: 0;
  background: var(--bg-page);
}

/* ── About: the manifesto ── */
.manifesto section {
  margin-bottom: var(--space-12);
}

.manifesto p {
  margin-bottom: var(--space-4);
}

.manifesto-heading {
  font-size: var(--text-display-sm);
  line-height: var(--lh-display-sm);
  letter-spacing: var(--ls-display-sm);
  margin-bottom: var(--space-4);
}

.manifesto-list {
  margin: 0 0 var(--space-4) var(--space-6);
}

.manifesto-cta a {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--interactive-accent-text);
  background: var(--interactive-accent-bg);
  padding: var(--space-3) var(--space-6);
}

/* ── Account ── */
/* The design system's member-badge: label-sm in the UI face. Founding is
   the collective's first class, so it takes the rust accent, as a rule
   rather than a fill. */
.member-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: var(--text-label-sm);
  line-height: var(--lh-label-sm);
  letter-spacing: var(--ls-label-sm);
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-accent);
  border: var(--border-hairline) solid var(--border-accent);
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-8);
}

.account-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-3) var(--space-8);
  padding: var(--space-6) 0;
  margin-bottom: var(--space-8);
  border-top: var(--border-rule) solid var(--border-default);
  border-bottom: var(--border-rule) solid var(--border-default);
}

.account-facts dt {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-secondary);
}

.account-facts dd {
  font-family: var(--font-body);
  color: var(--text-primary);
}

.account-facts .account-handle,
.account-facts time {
  font-family: var(--font-mono);
}

.account-signout {
  margin-top: var(--space-8);
}

.account-signout button {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-primary);
  background: none;
  border: var(--border-strong-width) solid var(--border-strong);
  border-radius: var(--radius-none);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
}

.account-signout button:hover {
  color: var(--interactive-primary-text);
  background: var(--interactive-primary-bg);
  border-color: var(--interactive-primary-bg);
}

/* ── Studio: the writer's upload form and their pieces ── */
.studio-refusal {
  font-family: var(--font-ui);
  color: var(--text-accent);
  border-left: var(--border-strong-width) solid var(--border-accent);
  padding: var(--space-2) var(--space-4);
  margin: var(--space-6) 0;
}

.studio-form {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-6) 0;
  margin: var(--space-8) 0;
  border-top: var(--border-rule) solid var(--border-default);
  border-bottom: var(--border-rule) solid var(--border-default);
}

.studio-form label {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: var(--space-4);
}

.studio-form input,
.studio-form textarea {
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: var(--border-hairline) solid var(--border-strong);
  border-radius: var(--radius-none);
  padding: var(--space-2) var(--space-3);
}

.studio-form input:focus,
.studio-form textarea:focus {
  outline: 2px solid var(--interactive-focus-ring);
  outline-offset: 1px;
}

.studio-hint {
  font-family: var(--font-ui);
  font-size: var(--text-label-lg);
  color: var(--text-tertiary);
}

.studio-form button {
  justify-self: start;
  margin-top: var(--space-6);
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--interactive-primary-text);
  background: var(--interactive-primary-bg);
  border: var(--border-strong-width) solid var(--interactive-primary-bg);
  border-radius: var(--radius-none);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
}

.studio-form button:hover {
  background: var(--interactive-primary-hover);
}

.studio-heading {
  font-size: var(--text-display-sm);
  line-height: var(--lh-display-sm);
  margin-bottom: var(--space-4);
}

.studio-pieces {
  list-style: none;
  padding: 0;
}

.studio-piece {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) 0;
  border-bottom: var(--border-hairline) solid var(--border-default);
}

.studio-piece-title {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  line-height: var(--lh-heading-lg);
}

.studio-piece-slug {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.studio-preview {
  font-family: var(--font-ui);
  color: var(--text-link);
}

.studio-preview:hover {
  color: var(--text-link-hover);
}

/* ── Review: the editor's queue, published pieces and readers ── */
.review-byline {
  font-family: var(--font-ui);
  color: var(--text-secondary);
}

.review-action {
  margin-top: var(--space-2);
}

.review-action button {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  border: var(--border-hairline) solid var(--border-strong);
  border-radius: var(--radius-none);
  padding: var(--space-1) var(--space-4);
  cursor: pointer;
}

.review-action button:hover {
  color: var(--interactive-primary-text);
  background: var(--interactive-primary-bg);
  border-color: var(--interactive-primary-bg);
}

/* ── Footer ── */
.footer {
  background: var(--bg-surface-dark);
  padding: var(--space-16) var(--grid-margin) var(--space-10);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-8);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--border-inverted);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-wordmark {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  line-height: var(--lh-heading-lg);
  color: var(--text-inverted);
}

.footer-tagline {
  font-family: var(--font-display);
  font-size: var(--text-body-sm);
  line-height: var(--lh-body-sm);
  font-style: italic;
  color: var(--text-inverted-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-8);
  list-style: none;
}

.footer-links a {
  font-family: var(--font-ui);
  font-size: var(--text-label-md);
  line-height: var(--lh-label-md);
  letter-spacing: var(--ls-label-md);
  text-transform: uppercase;
  color: var(--text-inverted-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-inverted);
}

.footer-legal {
  font-family: var(--font-ui);
  font-size: var(--text-body-sm);
  line-height: var(--lh-body-sm);
  color: var(--text-inverted-muted);
  padding-top: var(--space-6);
}

/* ── Narrow screens ── */
@media (max-width: 720px) {
  .nav,
  .hero,
  .feed,
  .piece-header,
  .footer {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }

  .nav {
    flex-wrap: wrap;
  }

  .nav-links {
    gap: var(--space-5);
  }

  .hero-headline {
    font-size: var(--text-display-md);
    line-height: var(--lh-display-md);
    letter-spacing: var(--ls-display-md);
  }

  .feed-lead-headline,
  .piece-headline {
    font-size: var(--text-display-md);
    line-height: var(--lh-display-md);
    letter-spacing: var(--ls-display-md);
  }

  .page-headline {
    font-size: var(--text-display-sm);
    line-height: var(--lh-display-sm);
    letter-spacing: var(--ls-display-sm);
  }

  .footer-inner {
    flex-direction: column;
  }
}
