/*
Theme Name: The Strategic Codex
Theme URI: https://thestrategiccodex.com
Author: The Strategic Codex
Author URI: https://thestrategiccodex.com
Description: A minimalist, content-focused theme for The Strategic Codex, designed to bridge the intelligence gap for small businesses. Based on the "Little Black Book" design concept.
Version: 1.0.1
Requires at least: 5.9
Requires PHP: 7.4
License: Copyright (c) 2025 The Strategic Codex. All rights reserved.
Tags: blog, one-column, custom-header, custom-menu, featured-images, theme-options, translation-ready
Text Domain: the-strategic-codex
*/

/* --- 1. VARIABLES & THEME DEFINITIONS --- */
:root {
  color-scheme: light dark;
  --header-height: 60px; /* The height of your theme's header */
  --wp-admin-bar-height: 0px; /* Default to 0, no admin bar */
}

/* Set the admin bar height variable only when the body has the .admin-bar class */
body.admin-bar {
  --wp-admin-bar-height: 32px;
}
@media screen and (max-width: 782px) {
  body.admin-bar {
    --wp-admin-bar-height: 46px;
  }
}

[data-theme="light"] {
  --font-sans: "Inter", sans-serif;
  --radius: 0.2rem;
  --color-primary: oklch(15% 0.01 240);
  --color-secondary: oklch(40% 0.01 240);
  --color-background: oklch(98% 0.01 85);
  --color-subtle-bg: oklch(95% 0.01 85);
  --color-border: oklch(88% 0.01 85);
  --color-primary-fg: oklch(98% 0.01 85);
  --color-accent: oklch(60% 0.15 85);
  --color-link-hover-bg: oklch(85% 0.15 80 / 30%);
}

[data-theme="dark"] {
  --font-sans: "Inter", sans-serif;
  --radius: 0.2rem;
  --color-primary: oklch(95% 0.01 240);
  --color-secondary: oklch(65% 0.01 240);
  --color-background: oklch(15% 0.01 240);
  --color-subtle-bg: oklch(20% 0.01 240);
  --color-border: oklch(30% 0.01 240);
  --color-primary-fg: oklch(15% 0.01 240);
  --color-accent: oklch(75% 0.15 85);
  --color-link-hover-bg: oklch(85% 0.15 80 / 10%);
}

/* --- 2. BASE & RESET STYLES --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-secondary);
  background-color: var(--color-background);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

/* --- 3. LAYOUT & STRUCTURE --- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section {
  padding: 5rem 0;
}
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}
.footer {
  text-align: center;
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.footer p {
  max-width: none;
}

/* --- 4. TYPOGRAPHY & SPACING --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-primary);
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}
h1 {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}
h2 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
}
h3 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}
h4 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}
p {
  margin: 0 0 1.5rem;
  max-width: 70ch;
}
p:last-child {
  margin-bottom: 0;
}
.lede {
  font-size: 1.25rem;
  color: var(--color-secondary);
  max-width: 65ch;
  margin-bottom: 2.5rem;
}
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: all 0.2s;
  border-radius: 2px;
}
a:hover,
a:focus {
  color: var(--color-accent);
  background-color: var(--color-link-hover-bg);
}
strong {
  font-weight: 700;
  color: var(--color-accent);
}
hr {
  border: none;
  height: 1px;
  background-color: var(--color-border);
  margin: 3rem 0;
}
.section-title p {
  margin: 1rem auto 0;
}
.final-cta .lede {
  margin: 1.5rem auto 2.5rem;
}

/* --- 5. COMPONENT STYLES --- */
/* Header & Navigation */
.header-container {
  padding: 1rem 1.5rem;
  position: fixed;
  top: var(--wp-admin-bar-height); /* Respects the admin bar */
  left: 0;
  width: 100%;
  background-color: color-mix(
    in srgb,
    var(--color-background) 80%,
    transparent
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
  transition: top 0.2s ease-in-out;
}
.header-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.2rem;
  text-decoration: none;
}
#theme-toggle {
  appearance: none;
  width: 50px;
  height: 26px;
  background-color: var(--color-subtle-bg);
  border: 1px solid var(--color-border);
  border-radius: 13px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}
#theme-toggle::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background-color: var(--color-secondary);
  transition: all 0.2s;
}
#theme-toggle:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
#theme-toggle:checked::before {
  background-color: var(--color-primary-fg);
  transform: translateX(24px);
}

/* Button */
.btn {
  display: inline-block;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  border: 2px solid var(--color-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.btn.primary {
  background-color: var(--color-primary);
  color: var(--color-primary-fg);
}
.btn.primary:hover,
.btn.primary:focus {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-primary-fg);
}

/* Cards - REVISED FOR PROFESSIONAL DESIGN */
.feature-grid {
  display: grid;
  /* Adjusted minmax to give cards more space on larger screens */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem; /* Increased gap for more breathing room */
}

.feature-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem; /* Increased padding for a more spacious feel */
  background-color: var(--color-background);
  text-align: left; /* Switched to left-align for better readability */
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

/* Icon Container: Gives the icon a shape and background */
.feature-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-bottom: 1.5rem;
  background-color: color-mix(in srgb, var(--color-accent) 15%, transparent);
  color: var(--color-accent);
  font-size: 1.8rem;
}

/* Card Title (h5): Makes it the primary text focal point */
.feature-card h5 {
  color: var(--color-primary);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.75rem; /* Tighter spacing to connect with the paragraph */
}

/* Card Paragraph: De-emphasized slightly to support the title */
.feature-card p {
  color: var(--color-secondary);
  font-size: 0.95rem;
  margin: 0;
  max-width: 100%; /* Ensure it fills the card width */
}

/* Pricing Card */
.pricing-card {
  max-width: 650px;
  margin: 0 auto;
  padding: 3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-background);
  text-align: center;
}
.pricing-card h2 {
  margin-bottom: 0.5rem;
}
.pricing-card .price {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}
.pricing-card .price-term {
  color: var(--color-secondary);
  margin-bottom: 2rem;
}
.pricing-card .value-prop {
  margin-top: 2rem;
  margin-bottom: 2rem;
  font-weight: 600;
}
.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  max-width: 450px;
  display: inline-block;
}
.pricing-card li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.pricing-card li:last-child {
  margin-bottom: 0;
}
.pricing-card li i {
  color: var(--color-accent);
  font-size: 1rem;
  margin-top: 5px;
}
.pricing-card li strong {
  display: block;
  margin-bottom: 0.25rem;
}
.pricing-card li .description {
  font-size: 0.95em;
  color: var(--color-secondary);
  line-height: 1.5;
}
.pricing-card .revenue-note {
  font-size: 0.9rem;
  color: var(--color-secondary);
  max-width: 50ch;
  margin: 2rem auto 0;
}
.pricing-card .btn {
  margin-top: 2.5rem;
}

/* Lists */
.recent-intel-list {
  list-style: none;
  padding-left: 0;
  margin-top: 3rem;
}
.recent-intel-list li {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.recent-intel-list li:last-child {
  margin-bottom: 0;
}
.recent-intel-list li::before {
  content: "✓";
  color: var(--color-accent);
  font-weight: bold;
  margin-right: 1rem;
}

/* Table (Desktop) */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}
thead {
  border-bottom: 2px solid var(--color-border);
}
th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--color-primary);
}
td {
  text-align: left;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
tbody tr:last-child td {
  border-bottom: none;
}

/* --- 6. SECTION-SPECIFIC & WORDPRESS STYLES --- */
.hero-section {
  text-align: center;
  padding: 8rem 1rem 6rem;
  /* margin-top: calc(
    var(--wp-admin-bar-height) + var(--header-height)
  ); */
}
.main-content {
  /* margin-top: calc(
    var(--wp-admin-bar-height) + var(--header-height)
  ); */
  padding: 5rem 0;
}
.media-text-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.media-text-block img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: var(--radius);
}
.media-text-block p {
  margin-left: auto;
  margin-right: auto;
}
.final-cta p {
  font-style: italic;
  color: var(--color-secondary);
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}
.wp-block-image img,
.post-content-area img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 2rem 0;
}
.post-meta {
  color: var(--color-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  display: block;
}
.post-thumbnail {
  margin-bottom: 3rem;
  text-align: center;
}
.post-content-area a {
  color: var(--color-accent);
}
.alignwide {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.alignfull {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* --- 7. MEDIA QUERIES & RESPONSIVE STYLES --- */
@media screen and (max-width: 768px) {
  .main-content > .container {
    padding: 0;
  }
  .section {
    padding: 4rem 0;
  }
  h1 {
    font-size: 2.5rem;
  }
  h2 {
    font-size: 2rem;
  }
  .media-text-block {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .pricing-card {
    padding: 2rem;
  }

  /* Responsive Table: Stacking Card Method */
  table {
    border: 0;
  }
  thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  tr {
    display: block;
    margin-bottom: 2rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
  }
  tr:last-child {
    margin-bottom: 0;
  }
  td {
    display: block;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
    position: relative;
    padding: 1rem 1rem 1rem 50%;
  }
  td:last-child {
    border-bottom: 0;
  }
  td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    width: 45%;
    text-align: left;
    font-weight: 600;
    color: var(--color-primary);
  }
}
