/*
Theme Name: Radio Axiom Console
Theme URI: https://radioaxiom.com
Author: Radio Axiom
Author URI: https://radioaxiom.com
Description: A minimal, dark-mode console-aesthetic theme for Radio Axiom. Monospace typography, red/black palette, white body text, yellow links, red captions. Built for media-rich humanitarian journalism.
Version: 1.3.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: radio-axiom-console
Tags: dark, one-column, custom-menu, featured-images, post-formats, translation-ready
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --ra-black: #0a0a0a;
  --ra-black-raised: #111111;
  --ra-black-surface: #1a1a1a;
  --ra-red: #cc0000;
  --ra-red-dim: #880000;
  --ra-red-glow: #ff1a1a;
  --ra-white: #e0e0e0;
  --ra-white-bright: #ffffff;
  --ra-yellow: #e6c619;
  --ra-yellow-hover: #ffd900;
  --ra-gray: #666666;
  --ra-gray-light: #888888;
  --ra-font-mono: 'Courier New', Courier, 'Liberation Mono', 'Nimbus Mono L', monospace;
  --ra-font-size-base: 16px;
  --ra-font-size-sm: 14px;
  --ra-font-size-xs: 12px;
  --ra-font-size-lg: 18px;
  --ra-font-size-xl: 22px;
  --ra-font-size-2xl: 28px;
  --ra-line-height: 1.7;
  --ra-max-width: 760px;
  --ra-max-width-wide: 1080px;
  --ra-spacing-unit: 1rem;
  --ra-border: 1px solid #2a2a2a;
  --ra-border-red: 1px solid var(--ra-red-dim);
  --ra-scanline-opacity: 0.03;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--ra-font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background-color: var(--ra-black);
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-base);
  line-height: var(--ra-line-height);
  min-height: 100vh;
  position: relative;
}

/* Scanline overlay for CRT effect — uses pseudo on html to avoid breaking sticky */
html::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, var(--ra-scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--ra-scanline-opacity)) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ra-font-mono);
  font-weight: 700;
  color: var(--ra-white-bright);
  line-height: 1.3;
  margin-bottom: calc(var(--ra-spacing-unit) * 0.75);
}

h1 { font-size: var(--ra-font-size-2xl); }
h2 { font-size: var(--ra-font-size-xl); }
h3 { font-size: var(--ra-font-size-lg); }
h4, h5, h6 { font-size: var(--ra-font-size-base); }

/* Red prefix dash for headings inside content */
.entry-content h2::before,
.entry-content h3::before,
.entry-content h4::before {
  content: '// ';
  color: var(--ra-red);
  font-weight: 400;
}

p {
  margin-bottom: var(--ra-spacing-unit);
}

a {
  color: var(--ra-yellow);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover,
a:focus {
  color: var(--ra-yellow-hover);
  text-decoration: underline;
}

blockquote {
  border-left: 3px solid var(--ra-red);
  padding-left: var(--ra-spacing-unit);
  margin: calc(var(--ra-spacing-unit) * 1.5) 0;
  color: var(--ra-gray-light);
  font-style: italic;
}

code, pre {
  font-family: var(--ra-font-mono);
  background: var(--ra-black-surface);
  border: var(--ra-border);
}

code {
  padding: 0.15em 0.4em;
  font-size: var(--ra-font-size-sm);
  color: var(--ra-red-glow);
}

pre {
  padding: var(--ra-spacing-unit);
  overflow-x: auto;
  margin-bottom: var(--ra-spacing-unit);
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

hr {
  border: none;
  border-top: var(--ra-border-red);
  margin: calc(var(--ra-spacing-unit) * 2) 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content-wrapper {
  flex: 1;
  width: 100%;
  max-width: var(--ra-max-width-wide);
  margin: 0 auto;
  padding: 0 var(--ra-spacing-unit);
}

.site-content-wrapper.has-sidebar {
  display: flex;
  gap: calc(var(--ra-spacing-unit) * 2);
  align-items: flex-start;
  overflow: visible; /* required for position:sticky to work */
}

.site-content-wrapper.no-sidebar {
  display: block;
}

.site-content {
  flex: 1;
  min-width: 0;
  max-width: var(--ra-max-width);
  padding: calc(var(--ra-spacing-unit) * 2) 0;
}

.site-content-wrapper.no-sidebar .site-content {
  margin: 0 auto;
}

/* ============================================================
   STICKY SIDEBAR
   ============================================================ */
.sidebar-sticky {
  width: 220px;
  flex-shrink: 0;
  padding-top: calc(var(--ra-spacing-unit) * 2);
  align-self: stretch; /* critical: lets sticky child work */
}

.sidebar-sticky-inner {
  position: -webkit-sticky;
  position: sticky;
  top: 140px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding-bottom: calc(var(--ra-spacing-unit) * 2);
  /* prevent any transform/will-change from breaking sticky context */
}

/* Thin scrollbar for sidebar overflow */
.sidebar-sticky-inner::-webkit-scrollbar {
  width: 4px;
}

.sidebar-sticky-inner::-webkit-scrollbar-track {
  background: var(--ra-black);
}

.sidebar-sticky-inner::-webkit-scrollbar-thumb {
  background: var(--ra-red-dim);
}

.sidebar-sticky .widget {
  margin-bottom: calc(var(--ra-spacing-unit) * 1.5);
}

.sidebar-sticky .widget-title {
  font-size: var(--ra-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ra-red);
  border-bottom: var(--ra-border-red);
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
}

.sidebar-sticky .widget-title::before {
  content: '# ';
}

.sidebar-sticky .widget ul {
  list-style: none;
}

.sidebar-sticky .widget li {
  padding: 0.2rem 0;
  font-size: var(--ra-font-size-xs);
  border-bottom: var(--ra-border);
  line-height: 1.5;
}

.sidebar-sticky .widget li::before {
  content: '→ ';
  color: var(--ra-gray);
}

.sidebar-sticky .widget li a {
  color: var(--ra-yellow);
}

.sidebar-sticky .widget li a:hover {
  color: var(--ra-yellow-hover);
}

/* Category widget: show post counts in gray */
.sidebar-sticky .widget_categories li a {
  color: var(--ra-yellow);
}

.sidebar-sticky .widget_categories .count,
.sidebar-sticky .widget_categories li::after {
  color: var(--ra-gray);
  font-size: var(--ra-font-size-xs);
}

/* Search widget in sidebar */
.sidebar-sticky .search-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-sticky .search-field {
  width: 100%;
  background: var(--ra-black-surface);
  border: var(--ra-border);
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-xs);
  padding: 0.35rem 0.5rem;
}

.sidebar-sticky .search-submit {
  width: 100%;
  background: var(--ra-red-dim);
  border: none;
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem;
  cursor: pointer;
}

.sidebar-sticky .search-submit:hover {
  background: var(--ra-red);
}

/* Hide sidebar on mobile, show as collapsed block */
@media (max-width: 768px) {
  .site-content-wrapper.has-sidebar {
    flex-direction: column;
  }

  .sidebar-sticky {
    width: 100%;
    border-top: var(--ra-border-red);
    padding-top: var(--ra-spacing-unit);
    margin-top: var(--ra-spacing-unit);
  }

  .sidebar-sticky-inner {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--ra-spacing-unit);
  }

  .sidebar-sticky .widget {
    flex: 1;
    min-width: 200px;
  }
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--ra-black);
  border-bottom: var(--ra-border-red);
  padding: var(--ra-spacing-unit);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header-inner {
  max-width: var(--ra-max-width-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ra-spacing-unit);
}

.site-branding {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.site-title {
  font-size: var(--ra-font-size-lg);
  font-weight: 700;
  margin: 0;
}

.site-title a {
  color: var(--ra-red);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-title a:hover {
  color: var(--ra-red-glow);
  text-decoration: none;
}

.site-title a::before {
  content: '> ';
  color: var(--ra-gray);
  font-weight: 400;
}

.site-description {
  font-size: var(--ra-font-size-xs);
  color: var(--ra-gray);
  display: none;
}

@media (min-width: 600px) {
  .site-description {
    display: inline;
  }
}

/* Navigation */
.main-navigation ul {
  list-style: none;
  display: flex;
  gap: calc(var(--ra-spacing-unit) * 1.25);
  flex-wrap: wrap;
  align-items: center;
}

.main-navigation li {
  position: relative;
}

.main-navigation a {
  color: var(--ra-gray-light);
  font-size: var(--ra-font-size-sm);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.main-navigation a:hover,
.main-navigation .current-menu-item a {
  color: var(--ra-yellow);
}

/* Dropdown sub-menus */
.main-navigation ul ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  flex-direction: column;
  gap: 0;
  background: var(--ra-black-raised);
  border: var(--ra-border);
  border-top: var(--ra-border-red);
  padding: 0.5rem 0;
  min-width: 180px;
  z-index: 1000;
}

.main-navigation li:hover > ul {
  display: flex;
}

.main-navigation ul ul li {
  position: relative;
}

.main-navigation ul ul a {
  display: block;
  padding: 0.35rem 1rem;
  font-size: var(--ra-font-size-xs);
  white-space: nowrap;
  color: var(--ra-gray-light);
}

.main-navigation ul ul a:hover {
  color: var(--ra-yellow);
  background: var(--ra-black-surface);
}

/* Dropdown indicator for parent items */
.main-navigation .menu-item-has-children > a::after {
  content: ' ▾';
  font-size: 0.7em;
  color: var(--ra-gray);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: var(--ra-border);
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-sm);
  padding: 0.3em 0.7em;
  cursor: pointer;
}

@media (max-width: 599px) {
  .menu-toggle {
    display: block;
  }
  .main-navigation ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ra-black);
    border-bottom: var(--ra-border-red);
    padding: var(--ra-spacing-unit);
  }
  .main-navigation.toggled ul {
    display: flex;
  }
  .main-navigation ul ul {
    position: static;
    border: none;
    border-top: none;
    background: transparent;
    padding: 0 0 0 1rem;
    min-width: 0;
    display: none;
  }
  .main-navigation .toggled ul ul,
  .main-navigation li:hover > ul {
    display: flex;
  }
}

/* ============================================================
   POSTS & ENTRIES
   ============================================================ */
.post,
.page {
  margin-bottom: calc(var(--ra-spacing-unit) * 3);
  padding-bottom: calc(var(--ra-spacing-unit) * 2);
  border-bottom: var(--ra-border);
}

.post:last-child {
  border-bottom: none;
}

.entry-header {
  margin-bottom: var(--ra-spacing-unit);
}

.entry-title {
  font-size: var(--ra-font-size-xl);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.entry-title a {
  color: var(--ra-white-bright);
}

.entry-title a:hover {
  color: var(--ra-yellow);
  text-decoration: none;
}

.entry-meta {
  font-size: var(--ra-font-size-xs);
  color: var(--ra-red);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--ra-spacing-unit);
}

.entry-meta a {
  color: var(--ra-red);
}

.entry-meta a:hover {
  color: var(--ra-red-glow);
}

.entry-meta .sep {
  color: var(--ra-gray);
  margin: 0 0.4em;
}

.entry-content {
  font-size: var(--ra-font-size-base);
  line-height: var(--ra-line-height);
}

.entry-content > *:last-child {
  margin-bottom: 0;
}

.entry-footer {
  margin-top: calc(var(--ra-spacing-unit) * 1.5);
  font-size: var(--ra-font-size-xs);
  color: var(--ra-gray);
}

.entry-footer a {
  color: var(--ra-yellow);
}

.cat-links::before {
  content: '[filed: ';
  color: var(--ra-gray);
}
.cat-links::after {
  content: ']';
  color: var(--ra-gray);
}

.tags-links::before {
  content: '[tagged: ';
  color: var(--ra-gray);
}
.tags-links::after {
  content: ']';
  color: var(--ra-gray);
}

/* ============================================================
   MEDIA: IMAGES & VIDEO
   ============================================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.post-thumbnail {
  margin-bottom: var(--ra-spacing-unit);
  border: var(--ra-border);
  overflow: hidden;
}

.post-thumbnail img {
  width: 100%;
  transition: opacity 0.3s ease;
}

.post-thumbnail:hover img {
  opacity: 0.85;
}

figure {
  margin: calc(var(--ra-spacing-unit) * 1.5) 0;
}

figcaption,
.wp-caption-text,
.gallery-caption {
  font-size: var(--ra-font-size-xs);
  color: var(--ra-red);
  margin-top: 0.5rem;
  font-style: italic;
  letter-spacing: 0.02em;
}

figcaption::before,
.wp-caption-text::before {
  content: '— ';
}

/* Video & embeds */
.wp-block-embed,
.wp-block-video,
.entry-content iframe,
.entry-content video {
  max-width: 100%;
  margin: calc(var(--ra-spacing-unit) * 1.5) 0;
}

.wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

video {
  width: 100%;
  background: var(--ra-black-surface);
  border: var(--ra-border);
}

/* Gallery */
.wp-block-gallery {
  gap: 0.5rem !important;
}

.wp-block-gallery figcaption {
  color: var(--ra-red);
  background: rgba(10, 10, 10, 0.85);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-xs);
}

/* ============================================================
   SIDEBAR & WIDGETS
   ============================================================ */
.widget-area {
  max-width: var(--ra-max-width);
  margin: calc(var(--ra-spacing-unit) * 2) auto;
  padding: 0 var(--ra-spacing-unit);
}

.widget {
  margin-bottom: calc(var(--ra-spacing-unit) * 2);
}

.widget-title {
  font-size: var(--ra-font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ra-red);
  border-bottom: var(--ra-border-red);
  padding-bottom: 0.5rem;
  margin-bottom: var(--ra-spacing-unit);
}

.widget-title::before {
  content: '# ';
}

.widget ul {
  list-style: none;
}

.widget li {
  padding: 0.3rem 0;
  border-bottom: var(--ra-border);
  font-size: var(--ra-font-size-sm);
}

.widget li::before {
  content: '→ ';
  color: var(--ra-gray);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination,
.post-navigation,
.posts-navigation {
  margin: calc(var(--ra-spacing-unit) * 2) 0;
  font-size: var(--ra-font-size-sm);
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: var(--ra-spacing-unit);
}

.page-numbers {
  color: var(--ra-gray-light);
  padding: 0.3em 0.6em;
  border: var(--ra-border);
}

.page-numbers.current {
  color: var(--ra-red);
  border-color: var(--ra-red-dim);
}

.page-numbers:hover {
  color: var(--ra-yellow);
}

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-area {
  margin-top: calc(var(--ra-spacing-unit) * 2);
  border-top: var(--ra-border-red);
  padding-top: calc(var(--ra-spacing-unit) * 1.5);
}

.comments-title {
  font-size: var(--ra-font-size-lg);
  color: var(--ra-red);
}

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

.comment {
  padding: var(--ra-spacing-unit) 0;
  border-bottom: var(--ra-border);
}

.comment-author {
  font-size: var(--ra-font-size-sm);
  font-weight: 700;
  color: var(--ra-white-bright);
}

.comment-metadata {
  font-size: var(--ra-font-size-xs);
  color: var(--ra-red);
}

.comment-content {
  margin-top: 0.5rem;
  font-size: var(--ra-font-size-sm);
}

.comment-respond {
  margin-top: calc(var(--ra-spacing-unit) * 1.5);
}

.comment-form label {
  display: block;
  font-size: var(--ra-font-size-sm);
  color: var(--ra-gray-light);
  margin-bottom: 0.25rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  background: var(--ra-black-surface);
  border: var(--ra-border);
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-sm);
  padding: 0.5rem;
  margin-bottom: var(--ra-spacing-unit);
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--ra-red);
}

.comment-form .submit {
  background: var(--ra-red-dim);
  color: var(--ra-white-bright);
  border: none;
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.comment-form .submit:hover {
  background: var(--ra-red);
}

/* ============================================================
   SEARCH FORM
   ============================================================ */
.search-form {
  display: flex;
  gap: 0;
}

.search-field {
  flex: 1;
  background: var(--ra-black-surface);
  border: var(--ra-border);
  border-right: none;
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-sm);
  padding: 0.4rem 0.6rem;
}

.search-field:focus {
  outline: none;
  border-color: var(--ra-red);
}

.search-submit {
  background: var(--ra-red-dim);
  border: var(--ra-border);
  border-color: var(--ra-red-dim);
  color: var(--ra-white);
  font-family: var(--ra-font-mono);
  font-size: var(--ra-font-size-sm);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.search-submit:hover {
  background: var(--ra-red);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: var(--ra-border-red);
  padding: calc(var(--ra-spacing-unit) * 1.5) var(--ra-spacing-unit);
  text-align: center;
  font-size: var(--ra-font-size-xs);
  color: var(--ra-gray);
}

.site-footer a {
  color: var(--ra-red);
}

.site-footer .footer-prompt::before {
  content: '> ';
  color: var(--ra-gray);
}

/* ============================================================
   404
   ============================================================ */
.error-404 .page-title {
  color: var(--ra-red);
}

.error-404 .page-title::before {
  content: 'ERR: ';
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--ra-black-surface);
  clip: auto !important;
  color: var(--ra-white);
  display: block;
  font-size: var(--ra-font-size-sm);
  height: auto;
  left: 5px;
  padding: 1rem;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* ============================================================
   CURSOR BLINK ANIMATION (used in footer / branding)
   ============================================================ */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor-blink {
  animation: blink 1s step-end infinite;
  color: var(--ra-red);
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  body::after {
    display: none;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
  .site-header,
  .site-footer,
  .main-navigation,
  .comments-area {
    display: none;
  }
}
