:root {
  color-scheme: light dark;
  --background: #f6f6ef;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #5f5f5f;
  --accent: #ff6600;
  --border: #d9d9d0;
  --link-hover: #8f3600;
  --input-background: #ffffff;
  --input-border: #b9b9ae;
  --success: #1e6b35;
  --danger: #a11b1b;
  --page-gutter: max(1rem, calc((100vw - var(--max-width)) / 2));
  --max-width: 72rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f6f6ef;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #5f5f5f;
  --accent: #ff6600;
  --border: #d9d9d0;
  --link-hover: #8f3600;
  --input-background: #ffffff;
  --input-border: #b9b9ae;
  --success: #1e6b35;
  --danger: #a11b1b;
  --page-gutter: max(1rem, calc((100vw - var(--max-width)) / 2));
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #111111;
  --surface: #1a1a1a;
  --text: #f2f2f2;
  --muted: #a8a8a8;
  --accent: #ff7a1a;
  --border: #333333;
  --link-hover: #ffb366;
  --input-background: #242424;
  --input-border: #666666;
  --success: #7bd88f;
  --danger: #ff9b9b;
  --page-gutter: max(1rem, calc((100vw - var(--max-width)) / 2));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #111111;
    --surface: #1a1a1a;
    --text: #f2f2f2;
    --muted: #a8a8a8;
    --accent: #ff7a1a;
    --border: #333333;
    --link-hover: #ffb366;
    --input-background: #242424;
    --input-border: #666666;
    --success: #7bd88f;
    --danger: #ff9b9b;
    --page-gutter: max(1rem, calc((100vw - var(--max-width)) / 2));
  }
}

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

html {
  background: var(--background);
  color: var(--text);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.5;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-anchor: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.skip-link {
  background: var(--surface);
  border: 1px solid var(--border);
  left: 1rem;
  padding: 0.75rem 1rem;
  position: absolute;
  top: -100px;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

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

.site-header {
  align-items: center;
  background: var(--accent);
  color: #1f1f1f;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  padding: 0.75rem var(--page-gutter);
}

.site-header a {
  color: #1f1f1f;
  text-decoration: none;
}

.site-header a:hover {
  text-decoration: underline;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-header nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.site-header nav a,
.theme-toggle,
.install-button {
  align-items: center;
  display: inline-flex;
  min-height: 2.75rem;
}

.soon {
  font-size: 0.7rem;
  margin-left: 0.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.theme-toggle,
.install-button {
  background: transparent;
  border: 1px solid rgba(31, 31, 31, 0.7);
  border-radius: 0.375rem;
  color: #1f1f1f;
  cursor: pointer;
  font: inherit;
  padding: 0.35rem 0.7rem;
}

.theme-toggle:hover,
.install-button:hover {
  background: rgba(31, 31, 31, 0.12);
}

.install-note {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 0.75rem var(--page-gutter) 0;
}

.site-notice {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.875rem;
  gap: 0.35rem 1rem;
  justify-content: space-between;
  padding: 0.5rem var(--page-gutter);
}

.site-notice a {
  color: var(--link-hover);
  font-weight: 600;
}

main {
  margin: 0 auto;
  max-width: calc(var(--max-width) + 2rem);
  padding: 1.5rem 1rem 3rem;
}

.page-heading {
  scroll-margin-top: 1rem;
}

.page-heading h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
}

.muted {
  color: var(--muted);
}

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
}

.story-list,
.comment-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
}

.story {
  align-items: start;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  padding: 0.75rem 0;
}

.rank {
  color: var(--muted);
  flex: 0 0 2.5rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.story-body {
  min-width: 0;
}

.story-title {
  font-size: 1.05rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.story-title:visited {
  color: var(--muted);
}

.external-mark {
  color: var(--muted);
  font-size: 0.8em;
  font-weight: 400;
}

.story-comments {
  align-self: center;
  color: var(--link-hover);
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 2.75rem;
  padding: 0.35rem 0.25rem;
  text-align: right;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.domain {
  color: var(--muted);
  font-size: 0.875rem;
  margin-left: 0.35rem;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
}

.comment-list .comment-list {
  border-left: 1px solid var(--border);
  margin: 0.75rem 0 0 0.5rem;
  padding-left: 1rem;
}

.comment {
  margin: 0 0 1rem;
  scroll-margin-top: 1rem;
}

.comment-meta {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}

.comment-text {
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

.comment-replies {
  margin: 0.5rem 0 0;
}

.comment-replies summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.comment-continue {
  font-size: 0.875rem;
  margin: 0.25rem 0;
}

.comments-section h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
}

.comment-text pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  overflow-x: auto;
  padding: 0.75rem;
}

.comment-text blockquote {
  border-left: 3px solid var(--border);
  color: var(--muted);
  margin-left: 0;
  padding-left: 1rem;
}

.thread {
  max-width: 62rem;
}

.thread .page-heading h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.thread .page-heading h1 a {
  text-decoration: none;
}

.thread .page-heading h1 a:hover {
  text-decoration: underline;
}

.breadcrumb {
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

.pagination-disabled {
  color: var(--muted);
  opacity: 0.65;
}

.pagination a {
  align-items: center;
  display: inline-flex;
  min-height: 2.75rem;
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.waitlist-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0 0.75rem;
  max-width: 28rem;
  padding: 1rem;
}

.waitlist-form label {
  font-weight: 600;
}

.waitlist-form input {
  background: var(--input-background);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  color: var(--text);
  font: inherit;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
}

.status-success {
  color: var(--success);
}

.status-error {
  color: var(--danger);
}

.waitlist-form button {
  background: var(--accent);
  border: 0;
  border-radius: 0.375rem;
  color: #1f1f1f;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 3rem;
  padding: 1.5rem var(--page-gutter);
}

.site-footer p {
  margin: 0.25rem 0;
}

.footer-links {
  font-size: 0.8125rem;
}

.legal-page {
  max-width: 52rem;
}

.legal-page h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.legal-page h2 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.5rem;
}

.legal-page ul,
.legal-page ol {
  padding-left: 1.25rem;
}

.legal-page li {
  margin: 0.4rem 0;
}

.legal-page code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.1rem 0.25rem;
}

.address-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
}

@media (max-width: 700px) {
  .site-header {
    align-items: center;
    display: grid;
    gap: 0.5rem 0.75rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.5rem var(--page-gutter);
  }

  .brand {
    font-size: 1.1rem;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .site-header nav {
    border-top: 1px solid rgba(31, 31, 31, 0.22);
    gap: 0.75rem;
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 0.25rem;
  }

  .site-header nav a {
    min-height: 2.75rem;
  }

  .theme-toggle,
  .install-button {
    min-height: 2.75rem;
    padding: 0.35rem 0.55rem;
  }

  .story {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .story-comments {
    grid-column: 2;
    justify-self: start;
    margin-top: 0.15rem;
    text-align: left;
  }

  .site-notice {
    padding-bottom: 0.6rem;
    padding-top: 0.6rem;
  }

  .comment-list .comment-list {
    margin-left: 0.25rem;
    padding-left: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.eyebrow {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

.stack-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0;
  max-width: 32rem;
  padding: 1rem;
}

.stack-form label {
  font-weight: 600;
}

.stack-form input {
  background: var(--input-background);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  color: var(--text);
  font: inherit;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
}

.stack-form button,
.inbox-bulk button,
.button-link {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 0.375rem;
  color: #1f1f1f;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 600;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6rem 1rem;
  text-decoration: none;
  width: fit-content;
}

.button-link.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.claim-result {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  max-width: 48rem;
}

.claim-result code,
.pair-code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  overflow-wrap: anywhere;
  padding: 0.2rem 0.35rem;
}

.claim-result .status-success,
.claim-result .status-error {
  font-weight: 600;
}

.inbox-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.inbox-filters a[aria-current="page"] {
  font-weight: 700;
  text-decoration-thickness: 2px;
}

.inbox-bulk {
  margin: 0 0 1rem;
}

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notification {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.notification.is-unread {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.notification.is-dismissed {
  opacity: 0.68;
}

.notification-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.unread-dot {
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  height: 0.5rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  width: 0.5rem;
}

.notification-story {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.notification-snippet,
.notification-parent {
  margin: 0.35rem 0;
  overflow-wrap: anywhere;
}

.notification-parent {
  border-left: 3px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding-left: 0.6rem;
}

.notification-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

.text-button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 2.5rem;
  padding: 0.35rem 0.65rem;
}

.text-button:hover {
  border-color: var(--link-hover);
  color: var(--link-hover);
}

@media (max-width: 700px) {
  .notification-actions {
    gap: 0.5rem;
  }

  .text-button {
    min-height: 2.75rem;
  }
}
