:root {
  color-scheme: light dark;
  --color-bg: #f7f7f5;
  --color-surface: #ffffff;
  --color-text: #1b1d22;
  --color-muted: #55596a;
  --color-border: #d9dbe2;
  --color-accent: #2452c7;
  --color-accent-text: #ffffff;
  --color-focus: #f0a500;
  --color-draft: #7a4b00;
  --color-draft-bg: #fff4d6;
  --radius: 12px;
  --max-width: 1080px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0f1116;
    --color-surface: #171a21;
    --color-text: #e8eaf0;
    --color-muted: #a3a8b8;
    --color-border: #2a2f3b;
    --color-accent: #7aa2ff;
    --color-accent-text: #0f1116;
    --color-focus: #ffcc4d;
    --color-draft: #ffd98a;
    --color-draft-bg: #3a2e12;
  }
}

:root[data-theme="dark"] {
  --color-bg: #0f1116;
  --color-surface: #171a21;
  --color-text: #e8eaf0;
  --color-muted: #a3a8b8;
  --color-border: #2a2f3b;
  --color-accent: #7aa2ff;
  --color-accent-text: #0f1116;
  --color-focus: #ffcc4d;
  --color-draft: #ffd98a;
  --color-draft-bg: #3a2e12;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--color-accent);
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--color-accent);
  color: var(--color-accent-text);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  z-index: 10;
}

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main {
  flex: 1;
  padding: 2rem 0 3rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-top: 2rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

.lead {
  font-size: 1.15rem;
  color: var(--color-muted);
}

/* Header and footer */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

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

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 1.5rem 0;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.site-footer ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.75rem;
  padding: 0;
}

/* Buttons and badges */
.button {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  cursor: pointer;
}

.button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.button-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.store-badge {
  display: inline-flex;
  flex-direction: column;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  min-width: 11rem;
}

.store-badge small {
  color: var(--color-muted);
  font-size: 0.8rem;
}

/* Cards and grids */
.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  margin-top: 1.5rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card a {
  text-decoration: none;
  color: inherit;
}

.card-title {
  margin: 0 0 0.25rem;
}

.card-link:hover .card-title {
  text-decoration: underline;
}

.status {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.empty-state {
  margin-top: 1.5rem;
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
}

/* Draft notice on legal pages */
.draft-notice {
  background: var(--color-draft-bg);
  color: var(--color-draft);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Forms */
.form {
  display: grid;
  gap: 1rem;
  max-width: 640px;
  margin-top: 1.5rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-weight: 600;
}

.field input,
.field textarea {
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field-error {
  color: #b42318;
  font-size: 0.9rem;
  min-height: 0;
}

.field-error:empty {
  display: none;
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: #b42318;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin: 0;
}

.form-status:empty {
  display: none;
}

.form-status-success {
  background: #e6f4ea;
  color: #14532d;
}

.form-status-error {
  background: #fdecea;
  color: #7a1b12;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-status-success {
    background: #14301f;
    color: #bdf0cf;
  }
  :root:not([data-theme="light"]) .form-status-error {
    background: #3a1714;
    color: #ffc9c3;
  }
}

:root[data-theme="dark"] .form-status-success {
  background: #14301f;
  color: #bdf0cf;
}

:root[data-theme="dark"] .form-status-error {
  background: #3a1714;
  color: #ffc9c3;
}

.legal h2 {
  font-size: 1.3rem;
}

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

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: opacity 0.15s ease;
  }
  .button:hover {
    opacity: 0.9;
  }
}

/* Blog */
.post-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 1.25rem;
}

.post-meta {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.post h1 {
  margin-bottom: 0.25rem;
}

/* Notice under the contact form */
.form-note {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0;
}

/* Tags */
.tag-list {
  font-size: 0.92rem;
  color: var(--color-muted);
  margin: 1rem 0 0;
}

.tag-cloud {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 1.5rem 0;
}
