/*
Theme Name: Pattern Theme
Theme URI: https://patternjj.kinsta.cloud
Author: BentonLane
Description: Custom editorial theme for Pattern magazine implementing the Gathered design system.
Version: 1.0.0
Text Domain: pattern-theme
*/

/* ── CSS Custom Properties ── */
:root {
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --surface-alt: #F3EDE5;
  --surface-warm: #EDE6DB;
  --text: #2A2119;
  --text-sec: #6B5E52;
  --text-muted: #A89B8E;
  --accent: #C25A35;
  --accent-hover: #A84928;
  --accent-soft: #F3DDD3;
  --accent-pale: #FBF0EB;
  --border: #E0D8CE;
  --border-light: #EDE8E1;
  --nav-bg: #2A2119;
  --nav-text: #FAF8F4;
}

/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.78;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; display: block; }

/* ── Utility Bar ── */
.utility-bar {
  background: var(--nav-bg);
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(250,248,244,.5);
  letter-spacing: 0.06em;
}
.utility-bar a { color: rgba(250,248,244,.6); }
.utility-bar a:hover { color: var(--nav-text); }
.utility-links { display: flex; gap: 20px; }
.utility-date { text-transform: uppercase; letter-spacing: 0.1em; }

/* ── Masthead (Homepage) ── */
.masthead {
  text-align: center;
  padding: 36px 24px 0;
}
.masthead-logo {
  font-family: 'Playfair Display', serif;
  font-size: 56px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}
.masthead-logo .dot { color: var(--accent); }
.masthead-tagline {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Primary Navigation ── */
.primary-nav {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 20px;
}
.primary-nav a {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}
.primary-nav a:hover { color: var(--accent); }
.primary-nav ul { list-style: none; display: flex; gap: 28px; }
.primary-nav li { list-style: none; }

/* ── Article Nav Bar (single posts) ── */
.article-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.article-nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.article-nav-logo .dot { color: var(--accent); }
.article-nav-links { display: flex; gap: 24px; }
.article-nav-links a {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-sec);
}
.article-nav-links a:hover { color: var(--accent); }

/* ── Article Header ── */
.article-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 0;
  text-align: center;
}
.article-category {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}
.article-title {
  font-family: 'Playfair Display', serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 20px;
}
.article-deck {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-sec);
  margin-bottom: 28px;
}
.article-byline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-sec);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 36px;
}
.article-byline .author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.article-byline .author-name { font-weight: 600; color: var(--text); }
.article-byline .sep { color: var(--border); }

/* ── Featured Image / Hero ── */
.article-hero {
  max-width: 920px;
  margin: 0 auto 36px;
  padding: 0 24px;
}
.article-hero img {
  width: 100%;
  border-radius: 3px;
}
.article-hero figcaption,
.article-hero .hero-caption {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}
.article-hero figcaption a,
.article-hero .hero-caption a { color: var(--accent); }

/* ── Article Body ── */
.article-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.article-body p {
  font-size: 18px;
  line-height: 1.78;
  margin-bottom: 24px;
  color: var(--text);
}
.article-body h2 {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 48px;
  margin-bottom: 20px;
  color: var(--text);
}
.article-body h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 36px;
  margin-bottom: 14px;
}
.article-body h4 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 28px;
  margin-bottom: 10px;
}
.article-body ul, .article-body ol {
  margin-bottom: 24px;
  padding-left: 24px;
}
.article-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}
.article-body strong { font-weight: 600; }
.article-body em { font-style: italic; }

/* ── Images in Article Body ── */
.article-body .wp-block-image,
.article-body figure {
  margin: 36px 0;
}
.article-body .wp-block-image img,
.article-body figure img {
  border-radius: 3px;
  width: 100%;
}
.article-body .wp-block-image figcaption,
.article-body figure figcaption {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}
.article-body figure figcaption a { color: var(--accent); }

/* Wide images — break out of body column */
.article-body .wp-block-image.is-style-wide,
.article-body .alignwide {
  max-width: 920px;
  margin-left: calc((680px - 920px) / 2);
  margin-right: calc((680px - 920px) / 2);
  width: 920px;
}

/* Full-width images */
.article-body .alignfull {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

/* Small/contained images */
.article-body .wp-block-image.is-style-contained img,
.article-body img.contained-frame {
  width: auto;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(42,33,25,.06);
  padding: 8px;
  margin: 0 auto;
  display: block;
}

/* Standard alignment */
.article-body .alignleft {
  float: left;
  margin: 4px 24px 16px 0;
  max-width: 50%;
}
.article-body .alignright {
  float: right;
  margin: 4px 0 16px 24px;
  max-width: 50%;
}
.article-body .aligncenter {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* ── Blockquotes / Pull Quotes ── */
.article-body blockquote,
.article-body .pattern-pull-quote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 28px;
  margin: 36px 0;
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-style: italic;
  line-height: 1.45;
  color: var(--text);
}
.article-body blockquote p,
.article-body .pattern-pull-quote p {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-style: italic;
  line-height: 1.45;
  margin-bottom: 0;
}
.article-body blockquote cite {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-style: normal;
  color: var(--text-muted);
  margin-top: 12px;
  letter-spacing: 0.02em;
}

/* ── Pattern Rule (diamond divider) ── */
hr,
.pattern-rule {
  border: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0;
}
hr::before, hr::after,
.pattern-rule::before, .pattern-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}
hr .diamond,
.pattern-rule .diamond {
  width: 7px;
  height: 7px;
  background: var(--accent);
  transform: rotate(45deg);
  opacity: 0.5;
  flex-shrink: 0;
}
/* For plain <hr> elements, use a pseudo-element trick */
.article-body hr {
  border: none;
  height: auto;
  display: flex;
  align-items: center;
  margin: 40px 0;
  background: none;
}
.article-body hr::before {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}
.article-body hr::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}
/* The diamond is injected via JS for plain hr elements, or use box-shadow trick */

/* ── Product Box ── */
.pattern-product-box {
  background: var(--accent-pale);
  border-radius: 6px;
  padding: 24px;
  margin: 36px 0;
}
.pattern-product-box .product-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.pattern-product-box .product-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.pattern-product-box .product-desc {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-sec);
}
.pattern-product-box a { color: var(--accent); font-weight: 600; }

/* ── Special Labels ── */
.pattern-category-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.pattern-room-label {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  color: var(--accent);
}
.pattern-rule-label {
  font-weight: 700;
  color: var(--text);
}

/* ── Article Footer ── */
.article-footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.article-credits {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.article-tags a {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sec);
}
.article-tags a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.article-disclosure {
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Homepage Hero Feature ── */
.hero-feature {
  position: relative;
  margin: 0 0 40px;
  overflow: hidden;
  border-radius: 3px;
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 0 24px;
}
.hero-feature-inner {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
}
.hero-feature img {
  width: 100%;
  display: block;
  min-height: 400px;
  object-fit: cover;
}
.hero-feature-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(42,33,25,.75) 0%, rgba(42,33,25,.2) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
}
.hero-feature-overlay .article-category { color: var(--accent-soft); margin-bottom: 10px; }
.hero-feature-overlay .hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.12;
  color: var(--nav-text);
  text-shadow: 0 2px 8px rgba(0,0,0,.25);
  margin-bottom: 12px;
}
.hero-feature-overlay .hero-title a { color: var(--nav-text); }
.hero-feature-overlay .hero-deck {
  font-size: 18px;
  font-weight: 300;
  color: rgba(250,248,244,.85);
  margin-bottom: 12px;
  max-width: 600px;
}
.hero-feature-overlay .hero-meta {
  font-size: 13px;
  color: rgba(250,248,244,.6);
}
.hero-feature-overlay .hero-meta a { color: rgba(250,248,244,.7); }

/* ── Content Grid (Homepage) ── */
.content-grid {
  max-width: 1100px;
  margin: 40px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
}
.story-list { display: flex; flex-direction: column; gap: 28px; }

/* ── Story Card ── */
.story-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: flex-start;
}
.story-card-image {
  border-radius: 3px;
  overflow: hidden;
  aspect-ratio: 4/3;
}
.story-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story-card-body { padding: 4px 0; }
.story-card-category {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}
.story-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}
.story-card-title a { color: var(--text); }
.story-card-title a:hover { color: var(--accent); }
.story-card-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.story-card-meta a { color: var(--text-muted); }

/* ── Sidebar ── */
.sidebar { display: flex; flex-direction: column; gap: 28px; }

.sidebar-editors-desk {
  background: var(--surface-alt);
  border-left: 3px solid var(--accent);
  padding: 24px;
  border-radius: 0 6px 6px 0;
}
.sidebar-editors-desk .sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.sidebar-editors-desk blockquote {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-style: italic;
  line-height: 1.5;
  color: var(--text);
  border: none;
  padding: 0;
  margin: 0;
}
.sidebar-editors-desk cite {
  display: block;
  font-family: 'Source Sans 3', sans-serif;
  font-style: normal;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}

.sidebar-trending {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 24px;
}
.sidebar-trending .sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.trending-list { list-style: none; counter-reset: trending; }
.trending-list li {
  counter-increment: trending;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.trending-list li:last-child { border-bottom: none; }
.trending-list li::before {
  content: counter(trending);
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-soft);
  line-height: 1;
  min-width: 28px;
}
.trending-list li a {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.trending-list li a:hover { color: var(--accent); }

.sidebar-newsletter {
  background: var(--nav-bg);
  border-radius: 6px;
  padding: 28px 24px;
  color: var(--nav-text);
  text-align: center;
}
.sidebar-newsletter .sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 10px;
}
.sidebar-newsletter p {
  font-size: 14px;
  color: rgba(250,248,244,.7);
  margin-bottom: 16px;
  line-height: 1.5;
}
.sidebar-newsletter input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(250,248,244,.2);
  border-radius: 4px;
  background: rgba(250,248,244,.08);
  color: var(--nav-text);
  font-size: 14px;
  margin-bottom: 10px;
}
.sidebar-newsletter input[type="email"]::placeholder { color: rgba(250,248,244,.4); }
.sidebar-newsletter button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-newsletter button:hover { background: var(--accent-hover); }

/* ── Site Footer ── */
.site-footer {
  background: var(--text);
  color: rgba(250,248,244,.6);
  padding: 60px 24px 0;
  margin-top: 80px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}
.footer-brand .footer-logo {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--nav-text);
  margin-bottom: 8px;
}
.footer-brand .footer-logo .dot { color: var(--accent); }
.footer-brand .footer-motto {
  font-size: 13px;
  color: rgba(250,248,244,.5);
  line-height: 1.5;
}
.footer-links h4 {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 12px;
}
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a {
  font-size: 14px;
  color: rgba(250,248,244,.6);
}
.footer-links a:hover { color: var(--nav-text); }
.footer-bottom {
  border-top: 1px solid rgba(250,248,244,.1);
  padding: 16px 0;
  text-align: center;
  max-width: 1100px;
  margin: 0 auto;
}
.footer-bottom p {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250,248,244,.35);
}

/* ── Category Archive ── */
.archive-header {
  text-align: center;
  padding: 48px 24px 28px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 40px;
}
.archive-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
}
.archive-header p {
  font-size: 16px;
  color: var(--text-sec);
  margin-top: 8px;
}
.archive-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}
.archive-grid .story-card {
  grid-template-columns: 1fr;
}
.archive-grid .story-card-image {
  aspect-ratio: 16/10;
}

/* ── Page Template ── */
.page-content {
  max-width: 720px;
  margin: 48px auto;
  padding: 0 24px;
}
.page-content h1 {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ── 404 ── */
.four-oh-four {
  max-width: 600px;
  margin: 80px auto;
  text-align: center;
  padding: 0 24px;
}
.four-oh-four h1 {
  font-family: 'Playfair Display', serif;
  font-size: 72px;
  color: var(--accent-soft);
}
.four-oh-four p {
  font-size: 18px;
  color: var(--text-sec);
  margin-top: 16px;
}
.four-oh-four a {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .story-card { grid-template-columns: 120px 1fr; gap: 14px; }
  .story-card-image { aspect-ratio: 1; }
  .hero-feature-overlay .hero-title { font-size: 28px; }
  .hero-feature-overlay { padding: 24px; }
  .article-title { font-size: 32px; }
  .article-body h2 { font-size: 24px; }
  .article-body .alignwide,
  .article-body .wp-block-image.is-style-wide {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .utility-bar { display: none; }
  .masthead-logo { font-size: 40px; }
  .article-nav-links { display: none; }
  .archive-grid { grid-template-columns: 1fr; }
}
