/*
Theme Name:  Accidental Expert
Theme URI:   https://accidentalexpert.ai
Author:      accidentalexpert.ai
Description: A clean, editorial WordPress theme for accidentalexpert.ai — AI explained by someone who accidentally became an expert. Purple palette, DM Sans + DM Serif Display typography, Tabler Icons.
Version:     1.0.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: accidentalexpert
Tags:        blog, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --purple-50:  #EEEDFE;
  --purple-100: #CECBF6;
  --purple-200: #AFA9EC;
  --purple-400: #7F77DD;
  --purple-600: #534AB7;
  --purple-800: #3C3489;
  --purple-900: #26215C;

  --green-50:   #E1F5EE;
  --green-600:  #0F6E56;

  --coral-50:   #FAECE7;
  --coral-600:  #993C1D;

  --amber-50:   #FAEEDA;
  --amber-600:  #854F0B;

  --blue-50:    #E6F1FB;
  --blue-600:   #185FA5;

  --gray-50:    #F7F7FB;
  --gray-100:   #EDEDF5;
  --gray-200:   #D5D4E8;
  --gray-600:   #6B6A8A;
  --gray-900:   #1a1a2e;

  --border:     rgba(83,74,183,0.12);
  --border-md:  rgba(83,74,183,0.25);
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(83,74,183,0.08);

  --nav-height: 64px;
  --max-width:  1140px;
  --content-w:  760px;
}

/* ============================================================
   RESET + BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--gray-900);
  background: #fff;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 32px; }
.section { padding: 56px 0; }
.section-alt { background: var(--gray-50); }
.section-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gray-600); margin-bottom: 24px;
}
.section-header {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px;
}
.section-header .view-all { font-size: 13px; color: var(--purple-600); font-weight: 500; }
.section-header .view-all:hover { text-decoration: underline; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-height);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center;
}
.site-header .container {
  display: flex; align-items: center;
  justify-content: space-between; width: 100%;
}
.site-branding { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-branding a { display: flex; align-items: center; gap: 10px; }
.logo-svg { display: block; flex-shrink: 0; }
.site-title-text { font-size: 16px; font-weight: 500; color: var(--gray-900); letter-spacing: -0.01em; }
.site-title-text .tld { color: var(--purple-600); }
.site-tagline-pill {
  background: var(--purple-50); color: var(--purple-600);
  font-size: 11px; font-weight: 500; padding: 2px 9px;
  border-radius: 20px; white-space: nowrap;
}
.main-navigation ul { display: flex; align-items: center; gap: 28px; }
.main-navigation a { font-size: 13px; color: var(--gray-600); transition: color 0.15s; }
.main-navigation a:hover,
.main-navigation .current-menu-item > a { color: var(--purple-600); font-weight: 500; }
.nav-subscribe {
  background: var(--purple-600); color: #fff; border: none;
  padding: 8px 18px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap; display: inline-block;
  transition: background 0.15s;
}
.nav-subscribe:hover { background: var(--purple-800); color: #fff; }
.menu-toggle {
  display: none; background: none; border: none;
  cursor: pointer; padding: 4px; color: var(--gray-900); font-size: 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block; padding: 11px 24px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none; transition: background 0.15s, color 0.15s;
}
.btn-primary { background: var(--purple-600); color: #fff; }
.btn-primary:hover { background: var(--purple-800); color: #fff; }
.btn-secondary {
  background: transparent; color: var(--gray-900);
  border: 0.5px solid var(--border-md);
}
.btn-secondary:hover { background: var(--gray-50); }

/* ============================================================
   HERO (front page)
   ============================================================ */
.hero {
  padding: 80px 0 72px; text-align: center;
  border-bottom: 0.5px solid var(--border); background: #fff;
}
.hero-eyebrow {
  display: inline-block; font-size: 11px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--purple-600); margin-bottom: 20px;
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(32px, 5vw, 52px); font-weight: 400;
  line-height: 1.15; color: var(--gray-900);
  max-width: 680px; margin: 0 auto 20px; letter-spacing: -0.02em;
}
.hero h1 em { font-style: italic; color: var(--purple-600); }
.hero-sub {
  font-size: 16px; color: var(--gray-600); max-width: 500px;
  margin: 0 auto 36px; line-height: 1.7;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   CARDS: FEATURED
   ============================================================ */
.featured-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.feat-card {
  background: #fff; border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column;
}
.feat-card:hover { border-color: var(--border-md); box-shadow: var(--shadow-sm); }
.feat-card.large h3 { font-size: 21px; }
.feat-card h3 { font-size: 16px; font-weight: 500; color: var(--gray-900); line-height: 1.4; margin-bottom: 10px; }
.feat-card p { font-size: 13px; color: var(--gray-600); line-height: 1.65; flex: 1; }
.feat-card .meta {
  margin-top: 18px; font-size: 12px; color: var(--gray-600);
  padding-top: 14px; border-top: 0.5px solid var(--border);
}

/* Category tags */
.cat-tag {
  display: inline-block; font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px; margin-bottom: 14px; width: fit-content;
}
.cat-origins  { background: var(--green-50);  color: var(--green-600);  }
.cat-legal    { background: var(--coral-50);  color: var(--coral-600);  }
.cat-current  { background: var(--amber-50);  color: var(--amber-600);  }
.cat-blog     { background: var(--blue-50);   color: var(--blue-600);   }
.cat-mechanics{ background: var(--purple-50); color: var(--purple-600); }

/* ============================================================
   CARDS: TOPIC GRID
   ============================================================ */
.topic-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.topic-card {
  background: #fff; border: 0.5px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s; display: block;
}
.topic-card:hover { border-color: var(--purple-200); box-shadow: var(--shadow-sm); }
.topic-icon { font-size: 20px; color: var(--purple-600); margin-bottom: 10px; display: block; }
.topic-card h4 { font-size: 13px; font-weight: 500; color: var(--gray-900); margin-bottom: 4px; }
.topic-card p { font-size: 12px; color: var(--gray-600); line-height: 1.55; }

/* ============================================================
   LISTING (archive / category pages)
   ============================================================ */
.listing-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.listing-card {
  background: #fff; border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column;
}
.listing-card:hover { border-color: var(--border-md); box-shadow: var(--shadow-sm); }
.listing-card h2 { font-size: 16px; font-weight: 500; color: var(--gray-900); line-height: 1.4; margin: 10px 0 8px; }
.listing-card h2 a { color: inherit; }
.listing-card h2 a:hover { color: var(--purple-600); }
.listing-card .excerpt { font-size: 13px; color: var(--gray-600); line-height: 1.65; flex: 1; }
.listing-card .card-meta { margin-top: 16px; font-size: 12px; color: var(--gray-600); }

/* ============================================================
   SINGLE POST / PAGE
   ============================================================ */
.page-hero { padding: 56px 0 40px; border-bottom: 0.5px solid var(--border); }
.page-hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(28px,4vw,42px); font-weight: 400;
  line-height: 1.2; color: var(--gray-900);
  max-width: var(--content-w); letter-spacing: -0.02em; margin-bottom: 14px;
}
.page-meta { font-size: 13px; color: var(--gray-600); }
.article-wrap {
  display: grid; grid-template-columns: 1fr 280px;
  gap: 48px; padding: 48px 0 80px; align-items: start;
}
.entry-content h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 26px; font-weight: 400; color: var(--gray-900);
  margin: 40px 0 16px; letter-spacing: -0.01em;
}
.entry-content p { font-size: 16px; color: #2d2d4a; line-height: 1.8; margin-bottom: 20px; }
.entry-content p:first-child { font-size: 18px; line-height: 1.75; color: var(--gray-900); }
.entry-content a { color: var(--purple-600); text-decoration: underline; }
.entry-content ul, .entry-content ol { padding-left: 24px; margin-bottom: 20px; }
.entry-content li { font-size: 16px; color: #2d2d4a; line-height: 1.8; margin-bottom: 6px; }
.entry-content blockquote {
  border-left: 3px solid var(--purple-200); padding: 4px 0 4px 20px;
  margin: 28px 0; font-style: italic; color: var(--gray-600);
}

/* Sidebar */
.article-sidebar { position: sticky; top: calc(var(--nav-height) + 24px); }
.sidebar-card {
  background: var(--gray-50); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
}
.sidebar-card h3 { font-size: 13px; font-weight: 500; color: var(--gray-900); margin-bottom: 12px; }
.sidebar-card ul li {
  font-size: 13px; color: var(--gray-600); padding: 6px 0;
  border-bottom: 0.5px solid var(--border); transition: color 0.15s;
}
.sidebar-card ul li:last-child { border-bottom: none; }
.sidebar-card ul li a:hover { color: var(--purple-600); }

/* ============================================================
   GLOSSARY (custom page template)
   ============================================================ */
.glossary-term { padding: 20px 0; border-bottom: 0.5px solid var(--border); }
.glossary-term dt { font-size: 15px; font-weight: 500; color: var(--purple-600); margin-bottom: 6px; }
.glossary-term dd { font-size: 14px; color: #2d2d4a; line-height: 1.75; margin: 0; }

/* ============================================================
   NEWSLETTER BAR
   ============================================================ */
.newsletter-bar {
  background: var(--purple-50); padding: 28px 0;
  border-top: 0.5px solid var(--border); border-bottom: 0.5px solid var(--border);
}
.newsletter-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.newsletter-copy p { font-size: 15px; font-weight: 500; color: var(--purple-800); }
.newsletter-copy small { font-size: 12px; color: var(--purple-600); display: block; margin-top: 2px; }
.newsletter-form { display: flex; gap: 8px; flex-shrink: 0; }
.newsletter-form input[type="email"] {
  border: 0.5px solid var(--purple-200); border-radius: var(--radius-md);
  padding: 9px 14px; font-size: 13px; font-family: inherit;
  width: 240px; background: #fff; color: var(--purple-800); outline: none;
}
.newsletter-form input[type="email"]:focus { border-color: var(--purple-600); }
.newsletter-form input::placeholder { color: var(--purple-200); }
.newsletter-form button {
  background: var(--purple-600); color: #fff; border: none;
  padding: 9px 18px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;
}
.newsletter-form button:hover { background: var(--purple-800); }

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
  padding: 24px 0; background: var(--gray-50);
  border-top: 0.5px solid var(--border);
}
.site-footer .container { display: flex; align-items: center; justify-content: space-between; }
.footer-copy { font-size: 12px; color: var(--gray-600); }
.footer-nav ul { display: flex; gap: 20px; }
.footer-nav a { font-size: 12px; color: var(--gray-600); transition: color 0.15s; }
.footer-nav a:hover { color: var(--purple-600); }

/* WordPress default elements */
.wp-block-image { margin: 28px 0; }
.aligncenter { text-align: center; }
.screen-reader-text { @extend .sr-only; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .featured-grid { grid-template-columns: 1fr 1fr; }
  .feat-card.large { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .topic-grid { grid-template-columns: repeat(2,1fr); }
  .article-wrap { grid-template-columns: 1fr; }
  .article-sidebar { display: none; }
  .listing-grid { grid-template-columns: repeat(2,1fr); }
  .newsletter-bar .container { flex-direction: column; align-items: flex-start; }
  .newsletter-form { width: 100%; }
  .newsletter-form input[type="email"] { flex: 1; width: auto; }
}
@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .main-navigation, .site-tagline-pill { display: none; }
  .main-navigation.toggled { display: block; position: absolute; top: var(--nav-height); left: 0; right: 0; background: #fff; border-bottom: 0.5px solid var(--border); padding: 16px 20px; }
  .main-navigation.toggled ul { flex-direction: column; gap: 14px; }
  .menu-toggle { display: block; }
  .featured-grid { grid-template-columns: 1fr; }
  .listing-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: repeat(2,1fr); }
  .site-footer .container { flex-direction: column; gap: 12px; }
}
