/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --bg-base: #f9ecd3;
  --surface: #fff6e0;
  --surface-soft: #ffe6b2;
  --text: #1a1f28;
  --text-soft: #3f4757;
  --border-color: #2b2f38;
  --link: #c44b31;
  --accent: #ff6f4f;
  --accent-dark: #c94a32;
  --accent-contrast: #fff;
  --screen: #a7d7ff;
  --overlay: rgba(255, 244, 214, 0.28);
  --shadow: rgba(0, 0, 0, 0.25);
  --pixel: 3px;
  --bg-image-light: url("/assets/backgrounds/background_day-1f2e89ab.png");
  --bg-image-dark: url("/assets/backgrounds/background_night-5443f7bb.png");
  --bg-light-opacity: 1;
  --bg-dark-opacity: 0;
  --alert-bg: #fef6db;
  --alert-success-bg: #d9f8c7;
  --alert-success-text: #1f3d2a;
  --alert-error-bg: #ffd1c7;
  --alert-error-text: #4a2a00;
  --alert-warning-bg: #ffe7c7;
  --alert-warning-text: #4a2a00;
  --alert-info-bg: #cfe7ff;
  --alert-info-text: #1a3c55;
  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --paper: var(--surface);
  --paper-soft: var(--surface-soft);
  --border: var(--border-color);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg-base: #0c1421;
    --surface: #161e2b;
    --surface-soft: #1f2a3b;
    --text: #eef3fa;
    --text-soft: #c0cad8;
    --border-color: #3a4454;
    --link: #7dd3fc;
    --accent: #ff8a63;
    --accent-dark: #f36b46;
    --accent-contrast: #11151d;
    --screen: #2c5f85;
    --overlay: rgba(10, 16, 28, 0.55);
    --shadow: rgba(0, 0, 0, 0.6);
    --bg-light-opacity: 0;
    --bg-dark-opacity: 1;
    --alert-bg: #1e2736;
    --alert-success-bg: #1f3d2a;
    --alert-success-text: #d7f5e6;
    --alert-error-bg: #4b1f1a;
    --alert-error-text: #ffd9c9;
    --alert-warning-bg: #4b3518;
    --alert-warning-text: #ffe2b8;
    --alert-info-bg: #1d3447;
    --alert-info-text: #cfe8ff;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-light-opacity: 1;
  --bg-dark-opacity: 0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0c1421;
  --surface: #161e2b;
  --surface-soft: #1f2a3b;
  --text: #eef3fa;
  --text-soft: #c0cad8;
  --border-color: #3a4454;
  --link: #7dd3fc;
  --accent: #ff8a63;
  --accent-dark: #f36b46;
  --accent-contrast: #11151d;
  --screen: #2c5f85;
  --overlay: rgba(10, 16, 28, 0.55);
  --shadow: rgba(0, 0, 0, 0.6);
  --bg-light-opacity: 0;
  --bg-dark-opacity: 1;
  --alert-bg: #1e2736;
  --alert-success-bg: #1f3d2a;
  --alert-success-text: #d7f5e6;
  --alert-error-bg: #4b1f1a;
  --alert-error-text: #ffd9c9;
  --alert-warning-bg: #4b3518;
  --alert-warning-text: #ffe2b8;
  --alert-info-bg: #1d3447;
  --alert-info-text: #cfe8ff;
}

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

body {
  margin: 0;
  font-family: "Press Start 2P", system-ui;
  color: var(--ink);
  background-color: var(--bg-base);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

html,
body {
  min-height: 100%;
}

body::before,
body::after,
html::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background-image: var(--bg-image-light);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--bg-light-opacity);
  transition: opacity 0.6s ease;
  z-index: -3;
}

body::after {
  background-image: var(--bg-image-dark);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--bg-dark-opacity);
  transition: opacity 0.6s ease;
  z-index: -2;
}

html::before {
  background: var(--overlay);
  z-index: -1;
  transition: background-color 0.35s ease;
}

h1,
h2,
h3,
h4 {
  font-weight: 400;
  margin: 0;
}

p {
  margin: 0;
  line-height: 1.6;
}

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

a:focus-visible,
.pixel-button:focus-visible,
.text-link:focus-visible,
.nav-links a:focus-visible,
.footer-links a:focus-visible,
.topic-pill:focus-visible,
.breadcrumbs__link:focus-visible,
.app-alert__dismiss:focus-visible {
  outline: 2px dashed var(--accent-dark);
  outline-offset: 2px;
}

.text-link:hover,
.nav-links a:hover,
.footer-links a:hover {
  text-decoration: underline;
}

body,
.page,
.site-header,
.breadcrumbs__list,
.hero,
.stat-tile,
.hero-card,
.story-card,
.topic-pill,
.newsletter,
.app-alert,
.app-alert__dismiss,
.newsletter-form input,
.form-input,
.pixel-button,
.site-footer {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 32px;
}

.flash {
  margin: 0 0 24px;
}

.breadcrumbs {
  margin: 0 0 18px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.breadcrumbs__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  border: var(--pixel) solid var(--border);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--border);
}

.breadcrumbs__item {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
}

.breadcrumbs__item + .breadcrumbs__item::before {
  content: "/";
  color: var(--accent-dark);
}

.breadcrumbs__link,
.breadcrumbs__current {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

.breadcrumbs__link {
  font-weight: 700;
}

.breadcrumbs__link:focus-visible {
  outline: 2px dashed var(--accent-dark);
  outline-offset: 2px;
}

.breadcrumbs__current {
  color: var(--ink);
}

.brand {
  font-family: "Press Start 2P", system-ui;
  font-size: 16px;
  letter-spacing: 1px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: var(--pixel) solid var(--border);
  background: var(--paper);
  color: var(--ink);
  padding: 6px;
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.3s ease,
    color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle__option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle__option:has(input:focus-visible) {
  outline: 2px dashed var(--accent-dark);
  outline-offset: 2px;
}

.theme-toggle__option:has(input:checked) {
  background: var(--surface-soft);
  border-color: var(--border);
}

.theme-toggle__text {
  font-size: 10px;
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  gap: 20px;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 14px;
}

.nav-links a,
.footer-links a {
  color: inherit;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.pixel-button {
  border: var(--pixel) solid var(--border);
  border-radius: 0;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  text-transform: uppercase;
  box-shadow: 6px 6px 0 var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pixel-button.primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.pixel-button.secondary {
  background: var(--screen);
}

.pixel-button.ghost {
  background: transparent;
}

.pixel-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--border);
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  align-items: center;
  padding: 24px;
  background: var(--paper);
  border: var(--pixel) solid var(--border);
  box-shadow: 12px 12px 0 var(--border);
}

.hero--compact {
  padding: 20px;
  gap: 22px;
}

.hero-copy h1 {
  font-size: clamp(26px, 3.2vw, 40px);
  margin-top: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
}

.hero-subtitle {
  margin: 20px 0 24px;
  color: var(--ink-soft);
  max-width: 520px;
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  color: var(--ink-soft);
  font-size: 15px;
}

.stat-tile {
  background: var(--surface);
  border: var(--pixel) solid var(--border);
  padding: 10px 12px;
  box-shadow: 4px 4px 0 var(--border);
}

.hero-meta strong {
  display: block;
  font-size: 20px;
  color: var(--ink);
}

.hero-card {
  background: var(--surface);
  padding: 24px;
  border: var(--pixel) solid var(--border);
  box-shadow: 8px 8px 0 var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
}

.section {
  margin-top: 48px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.text-link {
  font-weight: 700;
  color: var(--accent-dark);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.story-card {
  background: var(--surface);
  border: var(--pixel) solid var(--border);
  padding: 20px;
  display: grid;
  gap: 12px;
  min-height: 190px;
  box-shadow: 6px 6px 0 var(--border);
}

.story-card--full {
  min-height: auto;
}

.muted {
  color: var(--ink-soft);
  font-size: 16px;
}

.card-meta {
  font-size: 13px;
  color: var(--ink-soft);
}

.topics {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: center;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: var(--pixel) solid var(--border);
  padding: 10px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 4px 4px 0 var(--border);
}

.newsletter {
  background: var(--paper-soft);
  padding: 28px;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: center;
  border: var(--pixel) solid var(--border);
  box-shadow: 10px 10px 0 var(--border);
}

.newsletter-anchor {
  position: relative;
  top: -12px;
  display: block;
}

#values.section.newsletter,
.section.newsletter {
  display: block;
}

.newsletter-messages {
  width: 100%;
  margin-bottom: 12px;
}

.newsletter-messages:empty {
  display: none;
}

.newsletter-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

@media (max-width: 768px) {
  .newsletter-body {
    flex-direction: column;
    align-items: stretch;
  }
}

.flash-messages {
  display: grid;
}

.app-alert {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: var(--pixel) solid var(--border);
  box-shadow: 6px 6px 0 var(--border);
  font-weight: 600;
  font-size: 14px;
  background: var(--alert-bg);
  color: var(--ink);
}

.app-alert + .app-alert {
  margin-top: 12px;
}

.app-alert__message {
  line-height: 1.4;
}

.app-alert__dismiss {
  border: var(--pixel) solid var(--border);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--border);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  text-transform: uppercase;
}

.app-alert__dismiss:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--border);
}

.app-alert--success {
  background: var(--alert-success-bg);
  border-color: var(--border);
  box-shadow: 6px 6px 0 var(--border);
  color: var(--alert-success-text);
}

.app-alert--error {
  background: var(--alert-error-bg);
  border-color: var(--border);
  box-shadow: 6px 6px 0 var(--border);
  color: var(--alert-error-text);
}

.app-alert--warning {
  background: var(--alert-warning-bg);
  border-color: var(--border);
  box-shadow: 6px 6px 0 var(--border);
  color: var(--alert-warning-text);
}

.app-alert--info {
  background: var(--alert-info-bg);
  border-color: var(--border);
  box-shadow: 6px 6px 0 var(--border);
  color: var(--alert-info-text);
}

.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.newsletter-form input {
  flex: 1;
  min-width: 220px;
  padding: 12px 16px;
  border: var(--pixel) solid var(--border);
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--border);
}

.article-form {
  display: grid;
  gap: 16px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-label {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: var(--pixel) solid var(--border);
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--border);
}

.form-textarea {
  min-height: 200px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.article-actions {
  margin-top: 20px;
}

.site-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: var(--pixel) solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 14px;
}

.footer-links {
  display: flex;
  gap: 16px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .breadcrumbs__list {
    padding: 8px 10px;
  }

  .breadcrumbs__item {
    max-width: 200px;
  }

  .breadcrumbs__link,
  .breadcrumbs__current {
    max-width: 170px;
  }
}
