/*
Theme Name: Midnight Terminal
Theme URI: https://midnightchems.io
Author: Guy Wesley Orazem
Description: Fallout-inspired terminal theme for midnightchems.io. Dev blog and portfolio.
Version: 1.0.0
License: NONE - PRIVATE USE
Text Domain: midnight-terminal
*/

/* ==========================================================================
   1. TOKENS
   ========================================================================== */

:root {
  /* Backgrounds */
  --mc-bg:          oklch(0.15 0.008 150);
  --mc-surface:     oklch(0.19 0.012 150);

  /* Borders */
  --mc-border:      oklch(0.38 0.05 150);

  /* Text */
  --mc-text:        oklch(0.93 0.01 150);
  --mc-text-dim:    oklch(0.68 0.02 150);

  /* Accents */
  --mc-phosphor:    #33FF66;
  --mc-phosphor-hi: #7dffa3;
  --mc-amber:       #ffb000;
  --mc-on-phosphor: #0d1f14;

  /* Effects */
  --mc-glow:        0 0 18px oklch(0.7 0.2 150 / 0.35);

  /* Type */
  --mc-font-display: 'Major Mono Display', monospace;
  --mc-font-body:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout */
  --mc-max:        1120px;
  --mc-max-narrow: 720px;
  --mc-gutter:     28px;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

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

body {
  margin: 0;
  background: var(--mc-bg);
  color: var(--mc-text);
  font-family: var(--mc-font-body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

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

a {
  color: var(--mc-phosphor);
  text-decoration: none;
}
a:hover { color: var(--mc-phosphor-hi); }

:focus-visible {
  outline: 2px solid var(--mc-phosphor);
  outline-offset: 2px;
}

::selection {
  background: var(--mc-phosphor);
  color: var(--mc-on-phosphor);
}

.mc-skip-link {
  position: absolute;
  left: -9999px;
}
.mc-skip-link:focus {
  left: var(--mc-gutter);
  top: 8px;
  z-index: 100;
  background: var(--mc-phosphor);
  color: var(--mc-on-phosphor);
  padding: 10px 18px;
  font-size: 13px;
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4 {
  color: var(--mc-phosphor);
  margin: 0;
  font-weight: 400;
}

h1 {
  font-family: var(--mc-font-display);
  font-size: 42px;
  line-height: 1.2;
  text-shadow: var(--mc-glow);
}

.mc-h1--hero {
  font-size: 52px;
  line-height: 1.15;
}

.mc-h1--post {
  font-size: 30px;
  line-height: 1.3;
  text-shadow: none;
}

h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

h3 { font-size: 17px; line-height: 1.5; }

p { margin: 0; }

/* Prose blocks (post body, page content) */
.mc-prose {
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 15px;
  line-height: 1.9;
  color: var(--mc-text);
  max-width: var(--mc-max-narrow);
}
.mc-prose a { text-decoration: underline; }
.mc-prose ul, .mc-prose ol { margin: 0; padding-left: 1.4em; }
.mc-prose li { margin-bottom: 8px; }
.mc-prose code {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  padding: 1px 6px;
  font-size: 0.9em;
  color: var(--mc-phosphor);
}
.mc-prose pre {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  padding: 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
}
.mc-prose pre code { background: none; border: 0; padding: 0; }
.mc-prose blockquote {
  margin: 0;
  padding-left: 18px;
  border-left: 1px solid var(--mc-border);
  color: var(--mc-text-dim);
}

/* Utility text roles */
.mc-cmd {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--mc-text-dim);
}

.mc-meta {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--mc-text-dim);
}

.mc-tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--mc-amber);
  text-transform: uppercase;
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */

.mc-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mc-main { flex: 1; }

.mc-wrap {
  max-width: var(--mc-max);
  margin: 0 auto;
  padding-left: var(--mc-gutter);
  padding-right: var(--mc-gutter);
  width: 100%;
}

.mc-wrap--narrow { max-width: var(--mc-max-narrow); }

.mc-section {
  padding: 48px 0;
  border-bottom: 1px dashed var(--mc-border);
}
.mc-section--first { padding-top: 56px; }
.mc-section--last  { padding-bottom: 64px; border-bottom: 0; }

.mc-section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.mc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.mc-grid--tight {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

/* ==========================================================================
   5. HEADER / NAV
   ========================================================================== */

.mc-header {
  background: var(--mc-surface);
  border-bottom: 1px solid var(--mc-border);
}

.mc-header__status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--mc-text-dim);
}
.mc-header__status strong {
  color: var(--mc-phosphor);
  font-weight: 400;
}

.mc-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 6px;
  padding-bottom: 16px;
}

.mc-nav a {
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--mc-text-dim);
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
}
.mc-nav a:hover { color: var(--mc-phosphor); }

/* WP adds .current-menu-item / .current_page_item to the <li> */
.mc-nav .current-menu-item > a,
.mc-nav .current_page_item > a,
.mc-nav a[aria-current="page"] {
  color: var(--mc-phosphor);
  border-bottom-color: var(--mc-phosphor);
}

/* If using wp_nav_menu, strip the list styling */
.mc-nav ul {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */

.mc-footer {
  background: var(--mc-surface);
  border-top: 1px solid var(--mc-border);
  padding-top: 28px;
  padding-bottom: 32px;
}

.mc-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--mc-text-dim);
}

.mc-footer__links {
  display: flex;
  gap: 20px;
}
.mc-footer__links a { color: var(--mc-text-dim); }
.mc-footer__links a:hover { color: var(--mc-phosphor); }

/* ==========================================================================
   7. COMPONENTS
   ========================================================================== */

/* --- Card --- */
.mc-card {
  display: block;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  padding: 18px;
}
a.mc-card:hover { border-color: var(--mc-phosphor); }

.mc-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mc-card__title {
  color: var(--mc-phosphor);
  font-size: 17px;
  line-height: 1.5;
  margin: 10px 0 12px;
}

.mc-card__excerpt {
  color: var(--mc-text);
  font-size: 13px;
  line-height: 1.65;
}

/* --- Terminal window chrome (three dots) --- */
.mc-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.mc-dots span {
  width: 8px;
  height: 8px;
  background: var(--mc-border);
  display: inline-block;
}

.mc-window {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
}

.mc-window__bar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--mc-border);
}
.mc-window__bar span { width: 9px; height: 9px; }
.mc-window__file {
  width: auto !important;
  height: auto !important;
  background: none !important;
  color: var(--mc-text-dim);
  font-size: 11px;
  margin-left: 12px;
}

.mc-window__body { padding: 32px; }

/* --- Buttons --- */
.mc-btn {
  display: inline-block;
  padding: 12px 22px;
  font-size: 14px;
  letter-spacing: 0.04em;
  font-family: var(--mc-font-body);
  border: 1px solid var(--mc-phosphor);
  background: var(--mc-phosphor);
  color: var(--mc-on-phosphor);
  cursor: pointer;
}
.mc-btn:hover {
  background: var(--mc-phosphor-hi);
  border-color: var(--mc-phosphor-hi);
  color: var(--mc-on-phosphor);
}

.mc-btn--ghost {
  background: transparent;
  border-color: var(--mc-border);
  color: var(--mc-phosphor);
}
.mc-btn--ghost:hover {
  background: transparent;
  border-color: var(--mc-phosphor);
  color: var(--mc-phosphor);
}

.mc-btn--sm { padding: 10px 20px; font-size: 13px; }

/* --- Panel (contact rows, stack readout) --- */
.mc-panel {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  padding: 24px;
}

.mc-panel--row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mc-panel__label {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mc-text-dim);
  margin-bottom: 8px;
}

.mc-stack-row {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.mc-stack-row dt {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--mc-text-dim);
  margin: 0;
}
.mc-stack-row dd {
  font-size: 13px;
  color: var(--mc-phosphor);
  margin: 0;
}

/* --- Log list (about timeline) --- */
.mc-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.7;
}
.mc-log b {
  color: var(--mc-phosphor);
  font-weight: 400;
  margin-right: 8px;
}

/* ==========================================================================
   8. WORDPRESS CORE CLASSES
   ========================================================================== */

.alignleft   { float: left; margin: 0 24px 18px 0; }
.alignright  { float: right; margin: 0 0 18px 24px; }
.aligncenter { display: block; margin: 0 auto 18px; }
.alignwide, .alignfull { max-width: none; }

.wp-caption { max-width: 100%; }
.wp-caption-text,
figcaption {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--mc-text-dim);
  margin-top: 8px;
}

.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 {
  clip: auto !important;
  height: auto;
  width: auto;
  display: block;
  background: var(--mc-phosphor);
  color: var(--mc-on-phosphor);
  padding: 10px 18px;
  z-index: 100;
}

.sticky .mc-card { border-color: var(--mc-amber); }

/* Pagination */
.nav-links,
.mc-pagination {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 40px;
  font-size: 13px;
}
.mc-pagination .current {
  color: var(--mc-on-phosphor);
  background: var(--mc-phosphor);
  padding: 2px 8px;
}

/* Comments (if enabled) */
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-body {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  padding: 18px;
  margin-bottom: 16px;
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="search"],
textarea {
  background: var(--mc-bg);
  border: 1px solid var(--mc-border);
  color: var(--mc-text);
  font-family: var(--mc-font-body);
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--mc-phosphor); }
::placeholder { color: var(--mc-text-dim); opacity: 1; }

/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */

@media (max-width: 640px) {
  :root { --mc-gutter: 20px; }

  h1 { font-size: 28px; }
  .mc-h1--hero { font-size: 34px; }
  .mc-h1--post { font-size: 24px; }
  h2 { font-size: 19px; }

  .mc-section { padding: 36px 0; }
  .mc-section--first { padding-top: 40px; }
  .mc-window__body { padding: 22px; }
  .mc-nav { gap: 16px; }
  .mc-nav a { font-size: 14px; }
}

/* ==========================================================================
   10. MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Optional CRT effects — off by default. Add .mc-crt to <body> to enable.
   Gated behind reduced-motion so it never fires for users who opt out. */
@media (prefers-reduced-motion: no-preference) {
  .mc-crt::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
      to bottom,
      transparent 0 2px,
      oklch(0 0 0 / 0.16) 2px 4px
    );
  }
}
