/* === Swift Axis News — editorial theme === */

/* ── Design tokens ── */
:root {
  color-scheme: light;

  /* Colour */
  --color-bg: #ffffff;
  --color-surface: #f6f6f8;
  --color-surface-alt: #f1f2f5;
  --color-surface-hover: #e9ebf0;
  --color-text: #14161a;
  --color-secondary: #5b6472;
  --color-muted: #858d9b;
  --color-border: #e3e6eb;
  --color-primary: #1d4ed8;
  --color-primary-strong: #1739a8;
  --color-brand: #c81e4a;
  --color-accent: #d97706;
  --color-success: #15803d;
  --color-danger: #dc2626;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;

  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.8;

  /* Layout */
  --gap: 1.5rem;
  --max-width: 1200px;
  --content-width: 720px;

  /* Shape & depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.18);

  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --color-bg: #0d0f14;
    --color-surface: #151922;
    --color-surface-alt: #1b2029;
    --color-surface-hover: #232936;
    --color-text: #e7e9ee;
    --color-secondary: #9aa3b2;
    --color-muted: #737d8c;
    --color-border: #262c38;
    --color-primary: #8ab4ff;
    --color-primary-strong: #b9d0ff;
    --color-brand: #ff7a9c;
    --color-accent: #fbbf24;
    --color-success: #4ade80;
    --color-danger: #f87171;
  }
}

[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #0d0f14;
  --color-surface: #151922;
  --color-surface-alt: #1b2029;
  --color-surface-hover: #232936;
  --color-text: #e7e9ee;
  --color-secondary: #9aa3b2;
  --color-muted: #737d8c;
  --color-border: #262c38;
  --color-primary: #8ab4ff;
  --color-primary-strong: #b9d0ff;
  --color-brand: #ff7a9c;
  --color-accent: #fbbf24;
  --color-success: #4ade80;
  --color-danger: #f87171;
}

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

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

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
}

::selection {
  background: color-mix(in srgb, var(--color-brand) 22%, transparent);
}

/* ── Accessibility utilities ── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: 0;
  left: -9999px;
  z-index: 10000;
  padding: 0.65rem 1rem;
  background: var(--color-text);
  color: var(--color-bg);
  border-radius: 0 0 var(--radius) 0;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

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

/* ── Layout ── */
.gh-outer {
  padding: 0 var(--gap);
}

.gh-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.gh-canvas {
  max-width: var(--content-width);
  margin: 0 auto;
}

.site-content {
  min-height: 60vh;
}

.site-main {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* ── Header ── */
.gh-head {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.gh-head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gh-head-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.gh-head-brand-wrapper {
  display: flex;
  align-items: center;
}

.gh-head-logo {
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.gh-head-logo img {
  max-height: 40px;
  width: auto;
}

.gh-head-menu {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-left: auto;
  margin-right: 1rem;
}

.gh-head-menu a {
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-secondary);
  transition: color 0.15s ease;
}

.gh-head-menu a:hover {
  color: var(--color-text);
}

.gh-head-menu a.is-active {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-brand);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.gh-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gh-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-secondary);
  padding: 0.4rem;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.gh-icon-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.gh-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  position: relative;
}

.gh-burger::before,
.gh-burger::after {
  content: '';
  position: absolute;
  left: 2px;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.2s ease;
}

.gh-burger::before {
  top: 7px;
}

.gh-burger::after {
  bottom: 7px;
}

/* ── Brief ticker ── */
.gh-brief-ticker {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--color-border);
}

/* ── Newsroom homepage ── */
.home-secondary {
  margin: 0 0 1rem;
}

.home-secondary-grid {
  display: grid;
  gap: var(--gap);
}

.home-section {
  margin-top: 0.5rem;
}

.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.home-section-title {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.home-section-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}

.home-section-link:hover {
  text-decoration: underline;
}

.home-archive-header {
  margin: 1.5rem 0;
}

.home-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-brand);
  margin: 0 0 0.4rem;
}

.home-archive-title {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.home-archive-meta {
  color: var(--color-secondary);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

.home-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--color-secondary);
}

/* ── Post feed ── */
.post-feed {
  display: grid;
  gap: var(--gap);
}

@media (min-width: 640px) {
  .post-feed {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-secondary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ── Briefs ── */
.briefs-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .briefs-feed {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

/* Latest stories + briefs rail */
.home-latest-layout {
  display: grid;
  gap: 2rem;
}

.home-latest-layout .home-section {
  margin-top: 0;
}

@media (min-width: 1024px) {
  .home-latest-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }

  .home-latest-layout .post-feed {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-rail {
    position: sticky;
    top: 8.5rem;
  }
}

@media (min-width: 1200px) {
  .home-latest-layout .post-feed {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Term (tag/author) pages ── */
.gh-term {
  margin-bottom: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.gh-term-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.gh-term-description {
  color: var(--color-secondary);
  font-size: 1rem;
}

.gh-term-count {
  font-size: 0.85rem;
  color: var(--color-secondary);
}

.gh-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--color-secondary);
}

/* ── Pagination ── */
.gh-pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
}

.gh-pagination a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.gh-pagination a:hover {
  text-decoration: underline;
}

.gh-pagination-prev,
.gh-pagination-next {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.gh-pagination-prev:hover,
.gh-pagination-next:hover {
  text-decoration: underline;
}

/* ── Static & CMS pages ── */
.static-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.static-page-header {
  margin-bottom: 2.5rem;
}

.static-page-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.static-page-subtitle {
  font-size: 1.1rem;
  color: var(--color-secondary);
  font-style: italic;
}

.static-page-date {
  font-size: 0.85rem;
  color: var(--color-secondary);
  margin-bottom: 1.5rem;
}

.static-page-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text);
}

.static-page-body section {
  margin-bottom: 1.75rem;
}

.static-page-body p {
  margin-bottom: 1rem;
}

.static-page-body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 2rem 0 0.75rem;
}

.static-page-body strong {
  font-weight: 600;
}

.static-page-body a {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ── Article content ── */
.gh-content {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.gh-content > * + * {
  margin-top: 1.5em;
}

.gh-content h1,
.gh-content h2,
.gh-content h3 {
  scroll-margin-top: 5rem;
}

.gh-content h1 {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: var(--leading-tight);
  margin-top: 1.5em;
}

.gh-content h2 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: var(--leading-tight);
  margin-top: 2em;
}

.gh-content h3 {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: var(--leading-tight);
  margin-top: 1.75em;
}

.gh-content p {
  margin: 1.5em 0;
}

.gh-content ul,
.gh-content ol {
  padding-left: 1.5em;
  margin: 1.5em 0;
}

.gh-content li + li {
  margin-top: 0.5em;
}

.gh-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5em 0;
}

.gh-content figure {
  margin: 2em 0;
}

.gh-content figcaption {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-secondary);
  margin-top: 0.6em;
  text-align: center;
}

.gh-content blockquote {
  border-left: 3px solid var(--color-brand);
  margin: 1.75em 0;
  padding: 0.25em 0 0.25em 1.25em;
  color: var(--color-secondary);
  font-style: italic;
}

.gh-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gh-content pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

.gh-content code {
  font-size: 0.9em;
  background: var(--color-surface);
  padding: 0.15em 0.3em;
  border-radius: 3px;
}

.gh-content pre code {
  background: none;
  padding: 0;
}

.gh-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5em 0;
}

.gh-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  margin: 1.5em 0;
}

.gh-content th,
.gh-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.gh-content th {
  background: var(--color-surface);
  font-weight: 600;
}

/* ── Footer ── */
.gh-foot {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  margin-top: 3rem;
}

.gh-foot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.gh-copyright {
  font-size: 0.85rem;
  font-weight: 500;
}

.gh-social-links {
  display: flex;
  gap: 0.75rem;
}

.gh-social-links a {
  color: var(--color-secondary);
  transition: color 0.15s ease;
}

.gh-social-links a:hover {
  color: var(--color-text);
}

.gh-foot-menu {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.gh-foot-menu a {
  font-size: 0.85rem;
  color: var(--color-secondary);
  text-decoration: none;
}

.gh-foot-menu a:hover {
  color: var(--color-text);
}

.gh-powered-by {
  font-size: 0.8rem;
  color: var(--color-secondary);
}

.gh-powered-by a {
  color: var(--color-primary);
  text-decoration: none;
}

.gh-powered-by a:hover {
  text-decoration: underline;
}

/* ── Search overlay ── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-overlay.hidden {
  display: none;
}

.search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.search-overlay-panel {
  position: relative;
  width: min(640px, 90vw);
  max-height: 70vh;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.search-input-icon {
  flex-shrink: 0;
  color: var(--color-secondary);
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1.125rem;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
}

.search-input::placeholder {
  color: var(--color-secondary);
}

.search-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-secondary);
  padding: 0.3rem;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.search-close:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.search-results {
  overflow-y: auto;
  padding: 0.5rem 0;
}

.search-loading,
.search-error {
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--color-secondary);
  font-size: 0.9375rem;
}

.search-empty {
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--color-secondary);
  font-size: 0.9375rem;
}

.search-empty.hidden {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.search-result-item:hover {
  background: var(--color-surface);
}

.search-result-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-surface);
}

.search-result-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.search-result-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-excerpt {
  font-size: 0.8125rem;
  color: var(--color-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Mobile ── */
@media (max-width: 639px) {
  .gh-burger {
    display: block;
  }

  .gh-head-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 1rem 1.5rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .gh-head.is-open .gh-head-menu {
    display: flex;
  }

  .gh-head-actions {
    display: flex;
  }

  .post-feed {
    grid-template-columns: 1fr;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
