/*
Theme Name: Master Theme
Theme URI: https://yoursite.com
Author: Your Name
Author URI: https://yoursite.com
Description: A powerful master theme with deep ACF integration, custom block support, and a clean developer-first architecture.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: master-theme
Tags: acf, custom-fields, blocks, gutenberg, developer

/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
# Generic
  - Normalize
  - Box Sizing
# Base
  - Typography
  - Elements
  - Links
# Layouts
  - Container
  - Grid
# Components
  - Navigation
  - Posts/Archive
  - Pagination
# Utilities
----------------------------------------------------------------*/

/* =====================
   CSS CUSTOM PROPERTIES
   ===================== */
:root {
  /* Colors */
  --color-primary:     #1a1a2e;
  --color-secondary:   #16213e;
  --color-accent:      #e94560;
  --color-accent-alt:  #0f3460;
  --color-text:        #1a1a1a;
  --color-text-muted:  #6b7280;
  --color-bg:          #ffffff;
  --color-bg-alt:      #f9fafb;
  --color-border:      #e5e7eb;
  --color-white:       #ffffff;
  --color-black:       #000000;

  /* Typography */
  --font-heading:      'Georgia', 'Times New Roman', serif;
  --font-body:         system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:         'Courier New', Courier, monospace;

  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   1.875rem;
  --text-4xl:   2.25rem;
  --text-5xl:   3rem;
  --text-6xl:   3.75rem;

  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Spacing */
  --space-1:   0.25rem;
  --space-2:   0.5rem;
  --space-3:   0.75rem;
  --space-4:   1rem;
  --space-5:   1.25rem;
  --space-6:   1.5rem;
  --space-8:   2rem;
  --space-10:  2.5rem;
  --space-12:  3rem;
  --space-16:  4rem;
  --space-20:  5rem;
  --space-24:  6rem;
  --space-32:  8rem;

  /* Layout */
  --container-sm:   640px;
  --container-md:   768px;
  --container-lg:   1024px;
  --container-xl:   1280px;
  --container-2xl:  1536px;
  --container-max:  1200px;

  /* Borders */
  --radius-sm:   0.125rem;
  --radius:      0.25rem;
  --radius-md:   0.375rem;
  --radius-lg:   0.5rem;
  --radius-xl:   0.75rem;
  --radius-2xl:  1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow:     0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast:    150ms ease;
  --transition:         250ms ease;
  --transition-slow:    350ms ease;

  /* Z-index */
  --z-below:   -1;
  --z-base:     0;
  --z-above:    1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
}

/* =====================
   RESET & BASE
   ===================== */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* =====================
   TYPOGRAPHY
   ===================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-4);
  color: var(--color-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-accent);
  text-decoration: underline;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary); }

/* =====================
   LAYOUT
   ===================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--sm  { max-width: var(--container-sm); }
.container--md  { max-width: var(--container-md); }
.container--lg  { max-width: var(--container-lg); }
.container--xl  { max-width: var(--container-xl); }
.container--full { max-width: 100%; }

.grid {
  display: grid;
  gap: var(--space-6);
}
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }
}

/* =====================
   HEADER
   ===================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding-block: var(--space-4);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.site-branding__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  text-decoration: none;
}

/* =====================
   NAVIGATION
   ===================== */
.nav-primary ul {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-primary a {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text);
  text-decoration: none;
  padding-block: var(--space-1);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

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

/* =====================
   MAIN CONTENT
   ===================== */
.site-main {
  min-height: 60vh;
}

/* =====================
   FOOTER
   ===================== */
.site-footer {
  background: var(--color-primary);
  color: var(--color-white);
  padding-block: var(--space-12);
  margin-top: var(--space-16);
}

.site-footer a {
  color: var(--color-white);
  opacity: 0.8;
}
.site-footer a:hover { opacity: 1; }

/* =====================
   BUTTONS
   ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-white);
  border-color: var(--color-accent);
}
.btn--primary:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

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

.btn--lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn--sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }

/* =====================
   CARDS
   ===================== */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

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

.card__body { padding: var(--space-6); }
.card__title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}
.card__excerpt { color: var(--color-text-muted); }

/* =====================
   ACF BLOCK STYLES
   ===================== */
.acf-block {
  position: relative;
}

/* Hero Block */
.block-hero {
  padding-block: var(--space-24);
  background: var(--color-primary);
  color: var(--color-white);
  text-align: center;
}
.block-hero h1,
.block-hero h2 { color: var(--color-white); }
.block-hero__subtitle {
  font-size: var(--text-xl);
  opacity: 0.8;
  margin-bottom: var(--space-8);
}

/* CTA Block */
.block-cta {
  padding-block: var(--space-16);
  background: var(--color-accent);
  color: var(--color-white);
  text-align: center;
}
.block-cta h2 { color: var(--color-white); }

/* Feature Grid Block */
.block-features {
  padding-block: var(--space-16);
}
.feature-item {
  text-align: center;
  padding: var(--space-8);
}
.feature-item__icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
}

/* Testimonial Block */
.block-testimonial {
  padding-block: var(--space-16);
  background: var(--color-bg-alt);
}
.testimonial-item {
  background: var(--color-bg);
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  border-left: 4px solid var(--color-accent);
}
.testimonial-item__quote {
  font-size: var(--text-lg);
  font-style: italic;
  margin-bottom: var(--space-4);
}
.testimonial-item__author { font-weight: var(--font-bold); }
.testimonial-item__role { color: var(--color-text-muted); font-size: var(--text-sm); }

/* Content + Image Block */
.block-content-image {
  padding-block: var(--space-16);
}
.block-content-image__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
}
.block-content-image--reverse .block-content-image__inner {
  direction: rtl;
}
.block-content-image--reverse .block-content-image__content {
  direction: ltr;
}
@media (max-width: 768px) {
  .block-content-image__inner { grid-template-columns: 1fr; }
  .block-content-image--reverse .block-content-image__inner { direction: ltr; }
}

/* =====================
   FORMS
   ===================== */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgb(233 69 96 / 0.15);
}

/* =====================
   UTILITIES
   ===================== */
.text-center   { text-align: center; }
.text-left     { text-align: left; }
.text-right    { text-align: right; }

.text-primary  { color: var(--color-primary); }
.text-accent   { color: var(--color-accent); }
.text-muted    { color: var(--color-text-muted); }
.text-white    { color: var(--color-white); }

.bg-primary    { background-color: var(--color-primary); }
.bg-alt        { background-color: var(--color-bg-alt); }
.bg-accent     { background-color: var(--color-accent); }

.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.my-8  { margin-block: var(--space-8); }
.my-16 { margin-block: var(--space-16); }

.py-8  { padding-block: var(--space-8); }
.py-12 { padding-block: var(--space-12); }
.py-16 { padding-block: var(--space-16); }
.py-24 { padding-block: var(--space-24); }

.hidden  { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* =====================
   WORDPRESS CORE
   ===================== */
.wp-block-image img { border-radius: var(--radius-lg); }

.alignleft  { float: left; margin-right: var(--space-6); }
.alignright { float: right; margin-left: var(--space-6); }
.aligncenter { margin-inline: auto; text-align: center; }
.alignwide  { max-width: var(--container-xl); margin-inline: auto; }
.alignfull  { max-width: 100%; margin-inline: calc(-1 * var(--space-6)); }

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 1024px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
}

@media (max-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  .container { padding-inline: var(--space-4); }
}
