/*
 * WB Starter — theme.css
 *
 * Minimal base styles. Elementor handles most visual design —
 * this file covers resets, typography defaults, utility classes,
 * and nav/header/footer fallbacks.
 *
 * Structure:
 *  1. Custom Properties (tokens)
 *  2. Reset / Base
 *  3. Typography
 *  4. Layout
 *  5. Header & Navigation
 *  6. Footer
 *  7. Buttons
 *  8. Post Cards (archive)
 *  9. Utility
 * 10. Elementor Overrides
 * 11. Accessibility
 */

/* ── 1. Custom Properties ──────────────────────────────────────────────────── */

:root {
  /* Colours — replace with client values */
  --color-primary:     #000000;
  --color-secondary:   #555555;
  --color-accent:      #ffffff;
  --color-bg:          #ffffff;
  --color-text:        #1a1a1a;
  --color-text-muted:  #666666;
  --color-border:      #e0e0e0;

  /* Typography */
  --font-body:         system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading:      var(--font-body);
  --font-size-base:    1rem;       /* 16px */
  --font-size-sm:      0.875rem;
  --font-size-lg:      1.125rem;
  --line-height-body:  1.65;
  --line-height-tight: 1.2;

  /* Spacing scale */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width:       1140px;
  --gutter:          1.25rem;
  --border-radius:   4px;

  /* Header */
  --header-height:   70px;
  --header-bg:       #ffffff;
  --header-border:   var(--color-border);
}

/* ── 2. Reset / Base ───────────────────────────────────────────────────────── */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--color-primary);
  text-decoration: underline;
}

a:hover,
a:focus {
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* ── 3. Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--line-height-tight);
  font-weight: 700;
  margin-bottom: var(--space-md);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--space-md);
}

p:last-child {
  margin-bottom: 0;
}

.entry-content ul,
.entry-content ol {
  list-style: revert;
  padding-left: var(--space-xl);
  margin-bottom: var(--space-md);
}

.entry-content li {
  margin-bottom: var(--space-xs);
}

blockquote {
  border-left: 4px solid var(--color-primary);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xl) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

/* ── 4. Layout ─────────────────────────────────────────────────────────────── */

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

.site-content {
  flex: 1;
}

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

.site-main {
  padding: var(--space-3xl) var(--gutter);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ── 5. Header & Navigation ────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  height: var(--header-height);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  gap: var(--space-lg);
}

/* Branding */
.site-branding .site-title {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-text);
}

.site-branding img {
  max-height: 50px;
  width: auto;
}

/* Nav */
.main-navigation {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  display: block;
  padding: var(--space-sm) var(--space-xs);
  text-decoration: none;
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a {
  color: var(--color-primary);
}

/* Dropdown */
.nav-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: var(--space-sm) 0;
  z-index: 100;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:focus-within > .sub-menu {
  display: block;
}

.nav-menu .sub-menu a {
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
}

/* Mobile toggle button */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.menu-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ── Mobile nav ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .main-navigation {
    position: relative;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: calc(var(--header-height) / 2 + 20px);
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 220px;
    padding: var(--space-sm) 0;
    z-index: 200;
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-menu a {
    padding: var(--space-sm) var(--space-lg);
    width: 100%;
  }

  .nav-menu .sub-menu {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--color-border);
    padding: 0;
  }

  .nav-menu .sub-menu a {
    padding-left: var(--space-2xl);
  }
}

/* ── 6. Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  background-color: var(--color-text);
  color: #fff;
  padding: var(--space-2xl) var(--gutter);
}

.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-footer a {
  color: rgba(255,255,255,0.8);
}

.site-footer a:hover {
  color: #fff;
}

.site-footer__credit {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.6);
}

.footer-navigation .footer-nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.footer-navigation a {
  text-decoration: none;
  font-size: var(--font-size-sm);
}

/* ── 7. Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.65em 1.4em;
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  line-height: 1.4;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background-color: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background-color: transparent;
  color: var(--color-primary);
}

.btn--outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn--outline:hover {
  background-color: var(--color-primary);
  color: #fff;
}

/* ── 8. Post Cards ─────────────────────────────────────────────────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
}

.post-card {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-card__thumbnail img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-card__body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-sm);
}

.post-card__title {
  font-size: 1.15rem;
  margin-bottom: 0;
}

.post-card__title a {
  text-decoration: none;
  color: var(--color-text);
}

.post-card__title a:hover {
  color: var(--color-primary);
}

.post-card__meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.post-card__excerpt {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.post-card__read-more {
  align-self: flex-start;
  margin-top: var(--space-sm);
  font-size: var(--font-size-sm);
}

/* ── 9. Utility ────────────────────────────────────────────────────────────── */

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

/* ── 10. Elementor Overrides ───────────────────────────────────────────────── */

/*
 * Elementor adds its own heading/paragraph styles.
 * Keep this section minimal — only override what actually causes layout issues.
 */

/* Prevent Elementor's full-page/canvas template showing the sticky header */
body.elementor-template-canvas .site-header,
body.elementor-template-canvas .site-footer {
  display: none;
}

/* Ensure Elementor sections can go edge-to-edge */
.elementor-section.elementor-section-stretched {
  margin-left: calc(-1 * var(--gutter)) !important;
  margin-right: calc(-1 * var(--gutter)) !important;
}

/* ── 11. Accessibility ─────────────────────────────────────────────────────── */

/* Visible focus ring for keyboard users */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  z-index: 9999;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  text-decoration: none;
  font-weight: 600;
}

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