/*
Theme Name: StarGazing Dark 3
Theme URI: https://star-gazing.co.uk
Author: Dave Eagle
Author URI: https://star-gazing.co.uk
Description: A modern dark astrophotography theme for Star-Gazing.co.uk, featuring a starfield hero, electric blue accents, click-to-open navigation dropdowns, and a sidebar post list layout.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: stargazing-dark3
Tags: dark, astrophotography, astronomy, sidebar, custom-menu, featured-images, blog
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --sg-black:        #000000;
  --sg-deep:         #040710;
  --sg-surface:      #080d1a;
  --sg-surface2:     #0c1220;
  --sg-surface3:     #101828;
  --sg-cyan:         #00c8ff;
  --sg-cyan-dim:     #0099cc;
  --sg-cyan-glow:    rgba(0,200,255,0.18);
  --sg-cyan-faint:   rgba(0,200,255,0.05);
  --sg-white:        #ffffff;
  --sg-grey:         #8899aa;
  --sg-grey-dim:     #445566;
  --sg-border:       rgba(0,200,255,0.15);
  --sg-border-dim:   rgba(0,200,255,0.07);

  --font-display:    'Russo One', sans-serif;
  --font-body:       'Rajdhani', sans-serif;
  --font-prose:      'Source Serif 4', Georgia, serif;

  --nav-height:      48px;
  --sidebar-width:   300px;
  --content-max:     1360px;
  --radius:          2px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--sg-black);
  color: var(--sg-white);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--sg-cyan); text-decoration: none; transition: color 0.18s; }
a:hover { color: var(--sg-white); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--sg-white);
  margin-bottom: 0.6em;
}
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1.2em; font-family: var(--font-prose); font-weight: 300; color: #ccd6e0; }
p:last-child { margin-bottom: 0; }

blockquote {
  border-left: 3px solid var(--sg-cyan);
  padding: 12px 20px;
  margin: 24px 0;
  background: var(--sg-cyan-faint);
  font-style: italic;
  color: var(--sg-grey);
}

code, pre {
  font-family: 'Courier New', monospace;
  background: var(--sg-surface3);
  border: 1px solid var(--sg-border-dim);
  color: var(--sg-cyan);
  border-radius: var(--radius);
}
code { padding: 2px 6px; font-size: 0.88em; }
pre { padding: 16px; overflow-x: auto; margin-bottom: 1.2em; }
pre code { background: none; border: none; padding: 0; }

ul, ol { padding-left: 1.4em; margin-bottom: 1.2em; font-family: var(--font-prose); color: #ccd6e0; }
li { margin-bottom: 0.3em; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--sg-black); }
::-webkit-scrollbar-thumb { background: var(--sg-grey-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sg-cyan-dim); }

/* ============================================================
   CANVAS STARFIELD
   ============================================================ */
#sg-starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   SITE WRAPPER
   ============================================================ */
#page { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ============================================================
   SKIP LINK (ACCESSIBILITY)
   ============================================================ */
.skip-link {
  position: absolute;
  top: -999px;
  left: 0;
  background: var(--sg-cyan);
  color: var(--sg-black);
  padding: 8px 16px;
  z-index: 9999;
  font-family: var(--font-body);
}
.skip-link:focus { top: 0; }

/* ============================================================
   HEADER & HERO BANNER
   ============================================================ */
#masthead {
  position: relative;
  z-index: 100;
  width: 100%;
}

.sg-hero {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 55%, rgba(0,40,120,0.55) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 35%, rgba(60,0,120,0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(0,100,200,0.2) 0%, transparent 45%),
    linear-gradient(180deg, #020510 0%, #040a18 60%, #030812 100%);
}

/* Milky Way dust lane */
.sg-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(108deg,
      transparent 0%,
      rgba(80,120,200,0.07) 18%,
      rgba(160,120,255,0.05) 32%,
      rgba(60,100,200,0.09) 50%,
      rgba(0,150,255,0.04) 65%,
      transparent 80%);
  z-index: 1;
}

/* SVG star clusters in hero */
.sg-hero-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0.22;
}

.sg-hero-inner {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 clamp(20px, 4vw, 48px);
  gap: 20px;
}

/* ============================================================
   SOCIAL ICONS IN HERO
   ============================================================ */
.sg-social-icons {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.sg-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--sg-border);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  color: var(--sg-white);
  transition: transform 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.sg-social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.sg-social-link:hover {
  transform: translateY(-3px);
  color: var(--sg-white);
}

/* Per-platform hover colours */
.sg-social-facebook:hover {
  background: #1877f2;
  border-color: #1877f2;
  box-shadow: 0 4px 18px rgba(24,119,242,0.45);
}
.sg-social-x:hover {
  background: #000000;
  border-color: #555;
  box-shadow: 0 4px 18px rgba(255,255,255,0.15);
}
.sg-social-bluesky:hover {
  background: #0085ff;
  border-color: #0085ff;
  box-shadow: 0 4px 18px rgba(0,133,255,0.45);
}
.sg-social-instagram:hover {
  background: radial-gradient(circle at 30% 110%, #ffdd55, #ff543e 40%, #c837ab 70%);
  border-color: #c837ab;
  box-shadow: 0 4px 18px rgba(200,55,171,0.45);
}

/* Logo image — flex child, takes remaining space, icons sit to the right */
.sg-site-logo-img {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
}
.sg-site-logo-img a {
  display: block;
  height: 100%;
  line-height: 0;
}
.sg-site-logo-img img {
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  object-position: left center;
  display: block;
}


/* ============================================================
   NAVIGATION
   ============================================================ */
#site-navigation {
  position: relative;
  z-index: 200;
  background: rgba(4,7,16,0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--sg-border);
  border-top: 1px solid var(--sg-border);
}

.sg-nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px);
  display: flex;
  align-items: stretch;
  position: relative;
}

/* Primary menu list */
#primary-menu {
  list-style: none;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

#primary-menu > li {
  position: relative;
}

#primary-menu > li > a,
#primary-menu > li > span.nav-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 16px;
  height: var(--nav-height);
  font-family: var(--font-display);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sg-white);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  transition: color 0.18s, background 0.18s;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  user-select: none;
}

#primary-menu > li > a:hover,
#primary-menu > li.sg-open > a,
#primary-menu > li.current-menu-item > a,
#primary-menu > li.current-menu-ancestor > a,
#primary-menu > li.current_page_item > a,
#primary-menu > li.current_page_ancestor > a,
#primary-menu > li.current_page_parent > a {
  color: var(--sg-cyan);
  background: var(--sg-cyan-faint);
  border-bottom-color: var(--sg-cyan);
}

/* Dropdown chevron */
.sg-chevron {
  font-size: 0.5rem;
  opacity: 0.55;
  transition: transform 0.22s;
  pointer-events: none;
  display: inline-block;
  margin-left: 3px;
}
#primary-menu > li.sg-open > a .sg-chevron { transform: rotate(180deg); }

/* Sub-menu (dropdown) */
#primary-menu .sub-menu {
  display: none;
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  min-width: 230px;
  list-style: none;
  background: rgba(6,10,22,0.99);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sg-border);
  border-top: 2px solid var(--sg-cyan);
  box-shadow: 0 18px 52px rgba(0,0,0,0.85), 0 0 40px rgba(0,200,255,0.07);
  z-index: 300;
  padding: 6px 0;
}

#primary-menu li.sg-open > .sub-menu { display: block; }

#primary-menu .sub-menu li a {
  display: block;
  padding: 10px 22px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--sg-grey);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,200,255,0.05);
  transition: color 0.14s, padding-left 0.14s, background 0.14s;
}
#primary-menu .sub-menu li:last-child a { border-bottom: none; }
#primary-menu .sub-menu li a::before { content: '›'; margin-right: 8px; opacity: 0.45; }
#primary-menu .sub-menu li a:hover {
  color: var(--sg-cyan);
  padding-left: 30px;
  background: var(--sg-cyan-faint);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--sg-border);
  color: var(--sg-grey);
  padding: 10px 16px;
  margin: auto 0 auto auto;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
}
.menu-toggle:hover { color: var(--sg-cyan); border-color: var(--sg-cyan); }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.sg-breadcrumb {
  background: var(--sg-surface);
  border-bottom: 1px solid var(--sg-border-dim);
  padding: 9px clamp(16px,3vw,40px);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  color: var(--sg-grey-dim);
  font-family: var(--font-body);
  position: relative;
  z-index: 10;
}
.sg-breadcrumb a { color: var(--sg-cyan-dim); }
.sg-breadcrumb a:hover { color: var(--sg-cyan); }
.sg-breadcrumb .sep { margin: 0 7px; }

/* ============================================================
   GLOW DIVIDER
   ============================================================ */
.sg-glow-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sg-cyan), transparent);
  opacity: 0.25;
}

/* ============================================================
   CONTENT AREA & SIDEBAR LAYOUT
   ============================================================ */
#content {
  position: relative;
  z-index: 10;
  flex: 1;
}

.sg-content-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 600px;
}

/* Explicit column placement — sidebar in col 1, main in col 2,
   regardless of which appears first in the HTML source */
#primary   { grid-column: 2; grid-row: 1; }
#secondary { grid-column: 1; grid-row: 1; }

/* ============================================================
   SIDEBAR
   ============================================================ */
#secondary {
  background: var(--sg-surface);
  border-right: 1px solid var(--sg-border);
  padding: 0;
}

.widget {
  border-bottom: 1px solid var(--sg-border-dim);
  padding: 22px 0;
}
.widget:last-child { border-bottom: none; }

.widget-title {
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--sg-cyan);
  padding: 0 20px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}
.widget-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--sg-border), transparent);
}

/* Recent posts in sidebar */
.widget_recent_entries ul,
.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget_recent_entries ul li a,
.widget ul li a {
  display: block;
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--sg-white);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.35;
  transition: all 0.16s;
}
.widget_recent_entries ul li a:hover,
.widget ul li a:hover {
  color: var(--sg-white);
  border-left-color: var(--sg-cyan);
  background: linear-gradient(90deg, rgba(0,200,255,0.07), transparent);
  padding-left: 26px;
}
.widget_recent_entries ul li a.current-post {
  color: var(--sg-cyan);
  border-left-color: var(--sg-cyan);
}

.widget_recent_entries ul li .post-date {
  display: block;
  font-size: 0.69rem;
  color: var(--sg-grey-dim);
  margin-top: 2px;
  letter-spacing: 0.04em;
  padding-left: 0;
}

/* Category / tag widgets */
.widget_categories ul li,
.widget_tag_cloud { padding: 0 20px; }

.widget_categories ul li a {
  display: flex;
  justify-content: space-between;
}

.tag-cloud-link {
  display: inline-block;
  padding: 3px 9px;
  margin: 3px;
  background: rgba(0,200,255,0.05);
  border: 1px solid var(--sg-border);
  border-radius: 2px;
  font-size: 0.74rem !important;
  color: var(--sg-cyan-dim) !important;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}
.tag-cloud-link:hover {
  background: rgba(0,200,255,0.14);
  color: var(--sg-cyan) !important;
}

/* Text widget */
.widget_text p { font-size: 0.84rem; color: var(--sg-grey); padding: 0 20px; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
#primary {
  padding: clamp(24px,3vw,44px) clamp(20px,4vw,52px);
  min-width: 0;
}

/* ============================================================
   SECTION LABEL
   ============================================================ */
.sg-section-label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--sg-cyan);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sg-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--sg-border), transparent);
}

/* ============================================================
   POST / ARTICLE CARDS (ARCHIVE / BLOG)
   ============================================================ */
.sg-post-card {
  background: var(--sg-surface2);
  border: 1px solid rgba(0,200,255,0.1);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.sg-post-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--sg-cyan), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.sg-post-card:hover {
  border-color: var(--sg-border);
  box-shadow: 0 10px 36px rgba(0,0,0,0.6);
  transform: translateY(-2px);
}
.sg-post-card:hover::before { opacity: 1; }

.sg-post-thumbnail {
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: var(--sg-surface3);
  line-height: 0; /* kills the inline whitespace gap below the image */
  font-size: 0;
}
.sg-post-thumbnail a {
  display: block; /* inline <a> causes a baseline gap beneath the image */
  width: 100%;
  height: 100%;
  line-height: 0;
}
.sg-post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block; /* removes the default inline bottom gap on <img> */
  transition: transform 0.4s;
}
.sg-post-card:hover .sg-post-thumbnail img { transform: scale(1.04); }

/* Placeholder when no thumbnail */
.sg-post-thumbnail.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 40% 50%, rgba(0,60,160,0.35) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 35%, rgba(60,0,120,0.25) 0%, transparent 50%),
    var(--sg-surface3);
}

.sg-post-body { padding: 24px; }

.sg-post-meta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--sg-cyan-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.sg-post-meta a { color: var(--sg-cyan-dim); }
.sg-post-meta a:hover { color: var(--sg-cyan); }
.sg-post-meta .sep { margin: 0 6px; }

.sg-post-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  font-weight: 900;
  margin-bottom: 12px;
  line-height: 1.2;
}
.sg-post-title a { color: var(--sg-white); text-decoration: none; }
.sg-post-title a:hover { color: var(--sg-cyan); }

.sg-post-excerpt {
  font-family: var(--font-prose);
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--sg-grey);
  line-height: 1.65;
  margin-bottom: 18px;
}

.sg-read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sg-cyan);
  border: 1px solid var(--sg-border);
  padding: 8px 16px;
  background: var(--sg-cyan-faint);
  transition: all 0.18s;
  text-decoration: none;
}
.sg-read-more::after { content: '→'; }
.sg-read-more:hover { background: rgba(0,200,255,0.14); border-color: var(--sg-cyan); color: var(--sg-cyan); }

/* ============================================================
   SINGLE POST / PAGE
   ============================================================ */
.sg-entry-header { margin-bottom: 32px; }

.sg-entry-featured-image {
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  margin-bottom: 32px;
  border: 1px solid var(--sg-border-dim);
}
.sg-entry-featured-image img { width: 100%; height: 100%; object-fit: cover; }

.sg-entry-content {
  font-family: var(--font-prose);
  font-size: 1rem;
  font-weight: 300;
  color: #ccd6e0;
  line-height: 1.8;
  max-width: 72ch;
}
.sg-entry-content h2,
.sg-entry-content h3,
.sg-entry-content h4 { margin-top: 1.8em; margin-bottom: 0.6em; }

.sg-entry-content a { color: var(--sg-cyan); }
.sg-entry-content a:hover { color: var(--sg-white); text-decoration: underline; }

.sg-entry-content img {
  display: block;          /* removes the inline baseline descender gap */
  border: 1px solid var(--sg-border-dim);
  margin: 0.6em 0;         /* was 1.5em — reduced to a sensible gap */
  max-width: 100%;
  height: auto;
  line-height: 0;
}

/* Block editor figure wrappers around images */
.sg-entry-content figure {
  margin: 0.6em 0;
  line-height: 0;
}
.sg-entry-content figure img {
  margin: 0;               /* figure provides the spacing — don't double up */
}
.sg-entry-content figcaption {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--sg-grey-dim);
  line-height: 1.5;
  margin-top: 6px;
  font-style: italic;
}

/* Linked images inside content */
.sg-entry-content a img {
  display: block;
  line-height: 0;
}
.sg-entry-content p:has(> img),
.sg-entry-content p:has(> a > img) {
  line-height: 0;
  margin-bottom: 0.6em;
}

/* Post navigation */
.sg-post-nav {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--sg-border-dim);
}
.sg-post-nav a {
  flex: 1;
  padding: 14px 18px;
  background: var(--sg-surface2);
  border: 1px solid var(--sg-border-dim);
  color: var(--sg-grey);
  font-family: var(--font-body);
  font-size: 0.82rem;
  transition: all 0.18s;
  line-height: 1.35;
}
.sg-post-nav a:hover { border-color: var(--sg-cyan); color: var(--sg-cyan); }
.sg-post-nav .nav-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  color: var(--sg-cyan);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sg-post-nav .next-post { text-align: right; }

/* Comments */
.comments-area { margin-top: 48px; }
.comments-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  color: var(--sg-cyan);
  text-transform: uppercase;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sg-border-dim);
}
.comment-body {
  background: var(--sg-surface2);
  border: 1px solid var(--sg-border-dim);
  padding: 18px;
  margin-bottom: 16px;
}
.comment-author .fn { color: var(--sg-cyan); font-family: var(--font-body); font-weight: 600; }
.comment-metadata { font-size: 0.72rem; color: var(--sg-grey-dim); margin-bottom: 10px; }
.comment-content p { font-size: 0.92rem; }

/* Comment form */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  background: var(--sg-surface3);
  border: 1px solid var(--sg-border);
  color: var(--sg-white);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.18s;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--sg-cyan); }
.comment-form input[type="submit"] {
  background: var(--sg-cyan-faint);
  border: 1px solid var(--sg-border);
  color: var(--sg-cyan);
  padding: 10px 24px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
}
.comment-form input[type="submit"]:hover { background: rgba(0,200,255,0.14); border-color: var(--sg-cyan); }

/* ============================================================
   PAGINATION
   ============================================================ */
.sg-pagination {
  display: flex;
  gap: 8px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.sg-pagination a,
.sg-pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--sg-border-dim);
  background: var(--sg-surface2);
  color: var(--sg-grey);
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  transition: all 0.16s;
  text-decoration: none;
}
.sg-pagination a:hover,
.sg-pagination .current {
  border-color: var(--sg-cyan);
  color: var(--sg-cyan);
  background: var(--sg-cyan-faint);
}

/* ============================================================
   FOOTER
   ============================================================ */
#colophon {
  position: relative;
  z-index: 10;
  background: var(--sg-surface);
  border-top: 1px solid var(--sg-border);
}

.sg-footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: clamp(24px,4vw,48px);
  padding: clamp(32px,4vw,48px) clamp(20px,3vw,40px);
}

.sg-footer-brand .sg-site-name { font-size: 1.3rem; margin-bottom: 12px; }
.sg-footer-brand p { font-size: 0.82rem; color: var(--sg-grey); max-width: 300px; margin-bottom: 0; font-family: var(--font-body); }

.sg-footer-col h4 {
  font-family: var(--font-display);
  font-size: 0.56rem;
  letter-spacing: 0.22em;
  color: var(--sg-cyan);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.sg-footer-col ul { list-style: none; padding: 0; margin: 0; }
.sg-footer-col ul li { margin-bottom: 8px; }
.sg-footer-col ul li a { font-family: var(--font-body); font-size: 0.84rem; color: var(--sg-grey); }
.sg-footer-col ul li a:hover { color: var(--sg-cyan); }

.sg-footer-bottom {
  background: var(--sg-black);
  border-top: 1px solid rgba(0,200,255,0.07);
}
.sg-footer-bottom-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 14px clamp(20px,3vw,40px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--sg-grey-dim);
  letter-spacing: 0.06em;
  font-family: var(--font-body);
}
.sg-footer-bottom-inner a { color: var(--sg-cyan-dim); }
.sg-footer-bottom-inner a:hover { color: var(--sg-cyan); }

/* ============================================================
   404 / SEARCH RESULTS
   ============================================================ */
.error404 #primary, .search #primary { text-align: center; padding: 60px 40px; }
.sg-404-heading {
  font-family: var(--font-display);
  font-size: clamp(3rem,10vw,8rem);
  color: var(--sg-cyan);
  opacity: 0.18;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 0;
}

/* Search form */
.search-form { display: flex; gap: 0; max-width: 480px; margin: 20px auto 0; }
.search-form input[type="search"] {
  flex: 1;
  background: var(--sg-surface3);
  border: 1px solid var(--sg-border);
  border-right: none;
  color: var(--sg-white);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}
.search-form input[type="search"]:focus { border-color: var(--sg-cyan); }
.search-form input[type="submit"] {
  background: var(--sg-cyan-faint);
  border: 1px solid var(--sg-border);
  border-left: none;
  color: var(--sg-cyan);
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
}
.search-form input[type="submit"]:hover { background: rgba(0,200,255,0.14); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  /* Single column — reset explicit placement so DOM order flows naturally */
  .sg-content-wrap {
    grid-template-columns: 1fr;
  }
  #primary   { grid-column: 1; grid-row: 1; }
  #secondary { grid-column: 1; grid-row: 2; border-right: none; border-top: 1px solid var(--sg-border); }

  .sg-footer-inner { grid-template-columns: 1fr 1fr; }

  .menu-toggle { display: flex; align-items: center; }
  #primary-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    border-top: 1px solid var(--sg-border-dim);
    padding: 8px 0;
  }
  #primary-menu.toggled { display: flex; }
  #primary-menu > li > a,
  #primary-menu > li > span.nav-trigger {
    height: auto;
    padding: 12px 20px;
    border-bottom: 1px solid var(--sg-border-dim);
    width: 100%;
    font-size: 0.73rem !important;
  }
  #primary-menu .sub-menu { position: static; box-shadow: none; border-top: none; border-left: 3px solid var(--sg-cyan); margin-left: 16px; }

  .sg-nav-inner { flex-wrap: wrap; }

  /* Slightly smaller social icons on tablet */
  .sg-social-link { width: 38px; height: 38px; }
  .sg-social-link svg { width: 17px; height: 17px; }
  .sg-social-icons { gap: 10px; }
}

@media (max-width: 600px) {
  .sg-hero { height: 120px; }
  .sg-footer-inner { grid-template-columns: 1fr; }
  .sg-post-nav { flex-direction: column; }

  /* Tighter padding on small screens */
  #primary { padding: 20px 16px; }

  /* Stack social icons sensibly on small screens */
  .sg-social-link { width: 34px; height: 34px; }
  .sg-social-link svg { width: 15px; height: 15px; }
  .sg-social-icons { gap: 8px; }
}

/* ============================================================
   FADE-IN ANIMATION
   ============================================================ */
@keyframes sgFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
#masthead  { animation: sgFadeUp 0.5s ease both; }
#content   { animation: sgFadeUp 0.6s 0.08s ease both; }
#colophon  { animation: sgFadeUp 0.6s 0.14s ease both; }
