/*
Theme Name: DW Stack Stoupa
Theme URI: https://dwstack.com/theme/
Author: DW McEwing
Author URI: https://dwstack.com/theme/
Description: A secure, lightweight WordPress theme for rebuilding stoupagreece.com. Uses WordPress core features, block editor content, and clean responsive styling. No hardcoded page content.
Version: 1.3.3
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dwstack-stoupa
Tags: custom-logo, one-column, custom-menu, featured-images, block-styles, wide-blocks, responsive-layout, accessibility-ready
*/

/* =========================================================
   Base
   ========================================================= */

:root{
  --dw-bg: #ffffff;
  --dw-surface: #f6f7f8;
  --dw-text: #0f172a;
  --dw-muted: #475569;
  --dw-border: #e2e8f0;
  --dw-link: #0b5bd3;
  --dw-link-hover: #0848a8;

  --dw-max: 1120px;
  --dw-gutter: 20px;

  --dw-radius: 14px;
  --dw-shadow: 0 10px 30px rgba(2, 6, 23, .08);

  --dw-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --dw-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --dw-h1: clamp(2.0rem, 3.5vw, 3.0rem);
  --dw-h2: clamp(1.5rem, 2.2vw, 2.1rem);
  --dw-h3: clamp(1.2rem, 1.5vw, 1.5rem);
}

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

html { scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--dw-bg);
  color: var(--dw-text);
  font-family: var(--dw-font);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

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

a{
  color: var(--dw-link);
  text-decoration-thickness: 2px;
  text-underline-offset: .2em;
}

a:hover, a:focus{
  color: var(--dw-link-hover);
}

:focus-visible{
  outline: 3px solid rgba(11, 91, 211, .35);
  outline-offset: 3px;
  border-radius: 6px;
}

.screen-reader-text{
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.skip-link{
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
}

.skip-link:focus{
  left: 12px;
  top: 12px;
}

.dw-container{
  width: min(var(--dw-max), calc(100% - (var(--dw-gutter) * 2)));
  margin-inline: auto;
}

.dw-stack{ display: grid; gap: 1.2rem; }
.dw-stack-lg{ display: grid; gap: 2rem; }

.dw-surface{
  background: var(--dw-surface);
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius);
  box-shadow: var(--dw-shadow);
}

.dw-card{
  background: #fff;
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius);
  overflow: clip;
}

.dw-card__media img{
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.dw-card__body{
  padding: 16px 16px 18px;
}

.dw-card__title{
  margin: 0 0 6px;
  font-size: 1.1rem;
  line-height: 1.3;
}

.dw-card__meta{
  margin: 0;
  color: var(--dw-muted);
  font-size: .95rem;
}

/* =========================================================
   Header / Navigation
   ========================================================= */

.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--dw-border);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}


/* Constrain WordPress custom logo output (prevents huge logo) */
.site-logo img,
.custom-logo-link img,
img.custom-logo{
  max-height: 44px;
  height: 44px;
  width: auto;
}
@media (max-width: 920px){
  .site-logo img,
  .custom-logo-link img,
  img.custom-logo{
    max-height: 40px;
    height: 40px;
  }
}

.site-branding{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.site-title{
  font-size: 1.05rem;
  line-height: 1.2;
  margin: 0;
}

.site-title a{
  color: var(--dw-text);
  text-decoration: none;
}

.site-description{
  margin: 0;
  color: var(--dw-muted);
  font-size: .92rem;
}

.primary-nav{
  display: flex;
  align-items: center;
  gap: 14px;
}

.primary-nav ul{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 14px;
  align-items: center;
}

.primary-nav a{
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--dw-text);
}

.primary-nav a:hover,
.primary-nav a:focus{
  background: rgba(226, 232, 240, .75);
}

.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a{
  background: rgba(11, 91, 211, .10);
  color: #0b2f86;
}

.nav-toggle{
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--dw-border);
  background: #fff;
  color: var(--dw-text);
  cursor: pointer;
}

.nav-toggle svg{ width: 18px; height: 18px; }

@media (max-width: 880px){
  .nav-toggle{ display: inline-flex; }
  .primary-nav{
    position: fixed;
    inset: 64px 0 auto 0;
    background: rgba(255,255,255,.98);
    border-bottom: 1px solid var(--dw-border);
    transform: translateY(-120%);
    transition: transform .22s ease;
    padding: 12px 0 16px;
  }
  .primary-nav.is-open{ transform: translateY(0); }
  .primary-nav ul{
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .primary-nav a{
    padding: 12px 16px;
    border-radius: 0;
  }
}

/* =========================================================
   Content
   ========================================================= */

.site-main{
  padding: 30px 0 54px;
}

.page-header{
  padding: 30px 0 22px;
}

.page-title{
  font-size: var(--dw-h1);
  line-height: 1.1;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.page-subtitle{
  margin: 0;
  color: var(--dw-muted);
  max-width: 70ch;
}

.entry-title{
  font-size: var(--dw-h2);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 10px;
}

.entry-meta{
  color: var(--dw-muted);
  font-size: .95rem;
  margin: 0 0 18px;
}

.entry-content{
  max-width: 75ch;
}

.entry-content > *:first-child{ margin-top: 0; }
.entry-content > *{ margin-top: 1rem; margin-bottom: 0; }

.wp-block-image .alignleft{ float: left; margin: 0 16px 10px 0; }
.wp-block-image .alignright{ float: right; margin: 0 0 10px 16px; }
.wp-block-image .aligncenter{ margin-left: auto; margin-right: auto; }

.wp-block-separator{
  border: none;
  border-top: 1px solid var(--dw-border);
  margin: 2rem 0;
}

.dw-grid{
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}

.dw-col-4{ grid-column: span 4; }
.dw-col-6{ grid-column: span 6; }
.dw-col-12{ grid-column: span 12; }

@media (max-width: 900px){
  .dw-col-4, .dw-col-6{ grid-column: span 12; }
}

/* =========================================================
   Posts list
   ========================================================= */

.posts-grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.posts-grid > article{
  grid-column: span 4;
}

@media (max-width: 1100px){
  .posts-grid > article{ grid-column: span 6; }
}

@media (max-width: 700px){
  .posts-grid > article{ grid-column: span 12; }
}

.post-card{
  height: 100%;
  display: flex;
  flex-direction: column;
}

.post-card .dw-card__body{
  display: grid;
  gap: 10px;
}

.post-card .dw-card__excerpt{
  margin: 0;
  color: var(--dw-muted);
  font-size: .98rem;
}

.post-card .dw-card__actions{
  margin-top: auto;
}

.dw-button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--dw-border);
  background: #fff;
  color: var(--dw-text);
  text-decoration: none;
  font-weight: 600;
}

.dw-button:hover, .dw-button:focus{
  border-color: rgba(11, 91, 211, .35);
  box-shadow: 0 0 0 4px rgba(11, 91, 211, .12);
}

.dw-button.primary{
  background: var(--dw-link);
  border-color: var(--dw-link);
  color: #fff;
}

.dw-button.primary:hover,
.dw-button.primary:focus{
  background: var(--dw-link-hover);
  border-color: var(--dw-link-hover);
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer{
  border-top: 1px solid var(--dw-border);
  background: #fff;
}

.footer-inner{
  padding: 26px 0;
  display: grid;
  gap: 10px;
}

.footer-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--dw-muted);
  font-size: .95rem;
  align-items: center;
}

.footer-meta a{ color: inherit; }

.footer-nav ul{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.footer-nav a{
  padding: 6px 10px;
  border-radius: 10px;
  text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a:focus{
  background: rgba(226, 232, 240, .75);
}

/* =========================================================
   Forms
   ========================================================= */

input, select, textarea, button{
  font: inherit;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
textarea{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--dw-border);
  background: #fff;
}

input[type="search"]{ -webkit-appearance: none; }

label{ font-weight: 600; }

.search-form{
  display: flex;
  gap: 10px;
  align-items: stretch;
  max-width: 520px;
}

.search-form .search-submit{
  white-space: nowrap;
}

/* =========================================================
   WordPress defaults and helpers
   ========================================================= */

.alignwide{
  margin-left: calc(50% - min( var(--dw-max), calc(100% - (var(--dw-gutter) * 2)) ) / 2);
  margin-right: calc(50% - min( var(--dw-max), calc(100% - (var(--dw-gutter) * 2)) ) / 2);
  max-width: min(var(--dw-max), calc(100% - (var(--dw-gutter) * 2)));
}

.alignfull{
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
}

.wp-caption{
  max-width: 100%;
}

.wp-caption-text{
  color: var(--dw-muted);
  font-size: .92rem;
  margin-top: 6px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* =========================================================
   Ads
   ========================================================= */

.dw-ad-slot{
  width: 100%;
}

.dw-ad-sitewide-top{
  margin: 0;
  padding: 10px 0;
}
.dw-ad-sitewide-top img{
  display: block;
  max-width: 100%;
  height: auto;
}

/* =========================================================
   Header behavior
   ========================================================= */

/* Ensure header scrolls normally (not sticky) */
.site-header,
header.site-header,
.dw-header,
.dw-site-header{
  position: relative !important;
  top: auto !important;
}


/* ==============================
   DW Listings styles
   ============================== */

/* Reduce top whitespace when the first block is full-width */
.site-main > .wp-block-group.alignfull:first-child {
  padding-top: 36px !important;
}

/* Listings grid */
.dw-listings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0 0;
}
@media (max-width: 920px) {
  .dw-listings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .dw-listings-grid { grid-template-columns: 1fr; }
}

.dw-listing-card {
  border: 1px solid rgba(15,23,42,0.14);
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.dw-listing-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0D5EAF;
  display: block;
}
.dw-listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dw-listing-thumb.dw-placeholder {
  background: linear-gradient(135deg, #0D5EAF 0%, #00678D 55%, #284177 100%);
  position: relative;
}
.dw-listing-thumb.dw-placeholder::after {
  content: "Photo coming soon";
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
  background: rgba(0,0,0,0.14);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.22);
}

.dw-listing-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.dw-listing-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.dw-listing-title a { text-decoration: none; }
.dw-listing-excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(11,18,32,0.72);
}

.dw-listing-meta {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(15,23,42,0.10);
  font-size: 13px;
  line-height: 1.5;
  color: rgba(11,18,32,0.70);
}
.dw-listing-meta a { color: inherit; }

.dw-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.14);
  background: rgba(13,94,175,0.06);
  color: rgba(11,18,32,0.78);
}

.dw-listing-hero {
  background: #0D5EAF;
  color: #fff;
  padding: 54px 22px;
}
.dw-listing-hero .dw-container { max-width: 1100px; }
.dw-listing-hero .dw-kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: rgba(255,255,255,0.9);
}
.dw-listing-hero h1 {
  margin: 0;
  font-size: 54px;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.dw-listing-hero .dw-sub {
  margin: 14px 0 0;
  font-size: 16px;
  line-height: 1.8;
  color: rgba(255,255,255,0.9);
  max-width: 70ch;
}

.dw-listing-content-wrap {
  padding: 44px 22px 54px;
}
.dw-listing-content-wrap .dw-container { max-width: 1100px; }

.dw-listing-detail {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 920px) {
  .dw-listing-detail { grid-template-columns: 1fr; }
}
.dw-detail-panel {
  border: 1px solid rgba(15,23,42,0.14);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
}
.dw-detail-panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.dw-detail-row {
  margin: 0 0 10px;
  color: rgba(11,18,32,0.78);
  font-size: 14px;
  line-height: 1.7;
}
.dw-detail-row strong { font-weight: 800; }
