/*
Theme Name: Masters AI
Theme URI: https://mastersconference.ai
Description: Custom theme for Masters AI legal AI platform
Author: Masters AI
Author URI: https://mastersconference.ai
Version: 1.0.0
Text Domain: masters-ai
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* ==========================================================================
   Google Fonts
   ========================================================================== */

/* Fonts are loaded via wp_enqueue_style() in inc/enqueue.php with a
   preconnect hint to fonts.googleapis.com. The @import below was removed
   to eliminate a duplicate (render-blocking) HTTP request. */

/* ==========================================================================
   Design Tokens -- CSS Custom Properties (Single Source of Truth)
   ========================================================================== */

:root {
  /* -------------------------------------------------------
   * Colors -- Primary accent (teal)
   * Variable names kept as --color-crimson/* for backwards-compat
   * with all component/signal/block CSS that references them.
   * Red lives ONLY in --color-red (footer logo use only).
   * ----------------------------------------------------- */
  --color-crimson:          #1BBDC4;   /* teal — primary accent */
  --color-crimson-dark:     #149BA1;   /* teal dark */
  --color-crimson-darker:   #0E7A80;   /* teal darker */
  --color-crimson-light:    #2DCDD4;   /* teal light */
  --color-crimson-lighter:  #4DEFD6;   /* teal lighter */
  --color-crimson-deep:     #096165;   /* teal deep */

  /* Colors -- Magenta / Conference accent */
  --color-magenta:          #ff00ea;
  --color-magenta-dark:     #cc00bb;
  --color-magenta-light:    #ff44ef;
  --color-magenta-glow:     rgba(255, 0, 234, 0.45);

  /* Colors -- Green / Emerald accent */
  --color-green:            #00DC82;
  --color-green-dark:       #00A85F;
  --color-green-light:      #4DEAA8;
  --color-green-glow:       rgba(0, 220, 130, 0.45);

  /* Colors -- Electric Blue accent */
  --color-blue:             #0066FF;
  --color-blue-dark:        #0047CC;
  --color-blue-light:       #4D94FF;
  --color-blue-glow:        rgba(0, 102, 255, 0.45);

  /* Colors -- Indigo accent */
  --color-indigo:           #4F46E5;
  --color-indigo-dark:      #3730CA;
  --color-indigo-light:     #7B75F0;
  --color-indigo-glow:      rgba(79, 70, 229, 0.45);

  /* Colors -- OG Red (footer logo use only — do not use elsewhere) */
  --color-red:              #B60000;

  /* Colors -- Backgrounds */
  --color-bg:               #050505;
  --color-bg-raised:        #111111;
  --color-bg-surface:       #1a1a1a;
  --color-bg-subtle:        #0d0d0d;
  --color-bg-overlay:       rgba(5, 5, 5, 0.85);

  /* Colors -- Text hierarchy */
  --color-text:             #ebebeb;
  --color-text-secondary:   #999999;
  --color-text-muted:       #666666;
  --color-text-faint:       #444444;
  --color-text-inverse:     #050505;
  --color-text-tertiary:    #666666;

  /* Colors -- Grays */
  --color-gray-50:          #fafafa;
  --color-gray-100:         #f5f5f5;
  --color-gray-200:         #e5e5e5;
  --color-gray-300:         #d4d4d4;
  --color-gray-400:         #a3a3a3;
  --color-gray-500:         #737373;
  --color-gray-600:         #525252;
  --color-gray-700:         #404040;
  --color-gray-800:         #262626;
  --color-gray-900:         #171717;

  /* Colors -- Borders */
  --color-border:           #222222;
  --color-border-subtle:    #1a1a1a;
  --color-border-strong:    #333333;

  /* Colors -- Utility */
  --color-white:            #ffffff;
  --color-black:            #000000;

  /* -------------------------------------------------------
   * Typography -- Font families
   * ----------------------------------------------------- */
  --font-heading:           'Plus Jakarta Sans', sans-serif;
  --font-headline:          'Plus Jakarta Sans', sans-serif;
  --font-body:              'Source Serif 4', Georgia, serif;
  --font-ui:                'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent:            'Instrument Serif', Georgia, serif;
  --font-sans:              'DM Sans', sans-serif;

  /* Typography -- Font sizes (modular scale) */
  --text-xs:                0.75rem;
  --text-sm:                0.875rem;
  --text-base:              1rem;
  --text-md:                1.125rem;
  --text-lg:                1.25rem;
  --text-xl:                1.5rem;
  --text-2xl:               1.875rem;
  --text-3xl:               2.25rem;
  --text-4xl:               3rem;
  --text-5xl:               3.75rem;
  --text-6xl:               4.5rem;

  /* Typography -- Font weights */
  --weight-regular:         400;
  --weight-medium:          500;
  --weight-semibold:        600;
  --weight-bold:            700;
  --weight-extrabold:       800;

  /* Typography -- Line heights */
  --leading-none:           1;
  --leading-tight:          1.15;
  --leading-snug:           1.3;
  --leading-normal:         1.6;
  --leading-relaxed:        1.75;

  /* Typography -- Letter spacings */
  --tracking-tighter:       -1px;
  --tracking-tight:         -0.5px;
  --tracking-normal:        0;
  --tracking-wide:          0.5px;
  --tracking-wider:         1.5px;
  --tracking-widest:        3px;
  --tracking-ultra:         4px;

  /* -------------------------------------------------------
   * Spacing scale
   * ----------------------------------------------------- */
  --space-1:                4px;
  --space-2:                8px;
  --space-3:                12px;
  --space-4:                16px;
  --space-5:                20px;
  --space-6:                24px;
  --space-8:                32px;
  --space-10:               40px;
  --space-12:               48px;
  --space-16:               64px;
  --space-20:               80px;
  --space-24:               96px;
  --space-30:               120px;

  /* Legacy spacing aliases */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 8rem;

  /* -------------------------------------------------------
   * Border radii
   * ----------------------------------------------------- */
  --radius-sm:              4px;
  --radius-md:              8px;
  --radius-lg:              16px;
  --radius-xl:              24px;
  --radius-pill:            999px;

  /* -------------------------------------------------------
   * Shadows
   * ----------------------------------------------------- */
  --shadow-sm:              0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:              0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:              0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-hover:           0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-stack:           0 -4px 20px rgba(0, 0, 0, 0.3);

  /* -------------------------------------------------------
   * Transitions
   * ----------------------------------------------------- */
  --transition-fast:        0.2s ease;
  --transition-default:     0.4s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-slow:        0.6s cubic-bezier(0.22, 1, 0.36, 1);

  /* Legacy transition aliases */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 600ms;

  /* -------------------------------------------------------
   * Z-index layers
   * ----------------------------------------------------- */
  --z-base:                 1;
  --z-dropdown:             100;
  --z-sticky:               200;
  --z-overlay:              900;
  --z-nav:                  1000;
  --z-modal:                1100;
  --z-noise:                9999;

  /* -------------------------------------------------------
   * Container widths
   * ----------------------------------------------------- */
  --container-sm:           640px;
  --container-md:           768px;
  --container-lg:           1024px;
  --container-xl:           1400px;
  --container-max:          1400px;
  --container-padding:      2rem;

  /* Layout */
  --nav-height:             72px;
}

/* ==========================================================================
   Base Reset & Defaults
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  overflow-x: hidden; /* prevent any child overflow from creating horizontal scroll */
}

body {
  font-family: var(--font-ui); /* Plus Jakarta Sans via the Studio font pair */
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Film Grain Noise Overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-noise);
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-extrabold); /* 800 across the board */
  line-height: var(--leading-tight);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

h4 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: var(--weight-bold); /* 700 for h4 to preserve hierarchy */
}

h5 {
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
}

h6 {
  font-size: 1rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p {
  margin-bottom: 1.25em;
}

p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Links & Buttons
   ========================================================================== */

a {
  color: var(--color-crimson-light);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover,
a:focus-visible {
  color: var(--color-crimson);
}

button,
.btn {
  font-family: var(--font-ui);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-default);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--color-crimson);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-crimson-light);
  color: var(--color-white);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-border-strong);
}

.btn-magenta {
  background: var(--color-magenta);
  color: var(--color-white);
}

.btn-magenta:hover {
  background: #e600d2;
  color: var(--color-white);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: 0.5rem 1rem;
}

.btn-ghost:hover {
  color: var(--color-text);
}

/* ==========================================================================
   Images & Media
   ========================================================================== */

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

figure {
  margin: 0;
}

figcaption {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  margin-top: var(--space-sm);
}

/* ==========================================================================
   Layout -- Container
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-12);
  padding-right: var(--space-12);
}

@media (max-width: 768px) {
  .container {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
  }
}

.container-narrow {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
  width: 100%;
}

/* ==========================================================================
   Scroll Progress Bar
   ========================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1001;
}

.scroll-progress__bar {
  height: 100%;
  background: var(--color-crimson);
  width: 0%;
  transition: width 0.05s linear;
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  height: var(--nav-height);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.3s, box-shadow 0.3s;
}

.site-header.scrolled {
  background: rgba(5, 5, 5, 0.98);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.5);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-header__logo-text {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--color-crimson);
  text-transform: uppercase;
  white-space: nowrap;
}

.site-header__logo-img {
  height: 40px;
  width: auto;
}

/* On dark bg: hide the black logo, show the white logo */
.site-header__logo-img--default {
  display: none;
}

.site-header__logo-img--white {
  display: block;
}

.site-header__nav {
  display: flex;
  align-items: center;
}

.site-header__menu {
  display: flex;
  list-style: none;
  gap: 32px;
  margin: 0;
  padding: 0;
}

.site-header__menu li {
  list-style: none;
}

.site-header__menu a {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.site-header__menu a:hover,
.site-header__menu a:focus-visible {
  color: var(--color-text);
}

/* WordPress generates sub-menu lists */
.site-header__menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: rgba(5, 5, 5, 0.98);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) 0;
  min-width: 200px;
  list-style: none;
  z-index: var(--z-dropdown);
}

.site-header__menu li:hover > .sub-menu {
  display: block;
}

.site-header__menu .sub-menu a {
  display: block;
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.site-header__cta {
  font-size: 13px !important;
  padding: 10px 24px !important;
}

/* Mobile menu toggle -- hidden on desktop */
.site-header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 10;
}

.site-header__toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: all 0.3s ease;
}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */

@media (max-width: 768px) {
  .site-header__nav {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 5, 0.98);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: var(--z-overlay);
  }

  .site-header__nav.open {
    transform: translateX(0);
  }

  .site-header__menu {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  .site-header__menu a {
    font-size: 18px;
  }

  .site-header__actions {
    display: none;
  }

  .site-header__toggle {
    display: flex;
  }
}

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

.site-footer {
  background: #1A1A1A;
  padding: 80px 0 40px;
  border-top: 1px solid #222;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 48px;
}

.site-footer__logo-wrap {
  height: 80px;
  overflow: hidden;
  margin-bottom: 16px;
}

.site-footer__logo {
  height: 160px;
  width: auto;
  margin-top: -68px;
  margin-left: -16px;
}

.site-footer__tagline {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 280px;
}

.site-footer__heading {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-text);
  margin-bottom: 20px;
}

.site-footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer__links li {
  margin-bottom: 10px;
}

.site-footer__links a {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer__links a:hover {
  color: var(--color-text);
}

.site-footer__social {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.site-footer__social-link {
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.site-footer__social-link:hover {
  color: var(--color-text);
}

.site-footer__bottom {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid #222;
}

.site-footer__copyright {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Footer responsive */
@media (max-width: 1024px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 40px;
  }

  .site-footer__col--brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .site-footer {
    padding: 60px 0 32px;
  }

  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 480px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Animation Utilities
   ========================================================================== */

.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.fade-in.visible {
  opacity: 1;
}

/* ==========================================================================
   Selection & Focus
   ========================================================================== */

::selection {
  background: var(--color-crimson);
  color: var(--color-white);
}

:focus-visible {
  outline: 2px solid var(--color-crimson);
  outline-offset: 2px;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ==========================================================================
   Screen Reader Text
   ========================================================================== */

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--color-bg-raised);
  clip: auto !important;
  color: var(--color-text);
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* ==========================================================================
   Body padding for fixed header
   ========================================================================== */

.site-main {
  padding-top: var(--nav-height);
}

/* ==========================================================================
   Signal Content Labels — shared across homepage widget + Signal pages
   ========================================================================== */

.signal-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.signal-label {
  display: inline-block;
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.6;
  border: 1px solid transparent;
}

/* Hide paid immediately; DB migration will delete the term */
.signal-label--paid { display: none !important; }

/* Dark / default */
/* --sponsored is a CSS alias until DB migration renames it to --partner */
.signal-label--partner,
.signal-label--sponsored {
  background: rgba(12, 45, 107, 0.3);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.2);
}
.signal-label--cat-casey {
  background: rgba(61, 0, 53, 0.35);
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.2);
}
.signal-label--masters-media {
  background: rgba(90, 10, 10, 0.3);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.2);
}

/* Light theme overrides */
[data-theme="light"] .signal-label--partner,
[data-theme="light"] .signal-label--sponsored {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
[data-theme="light"] .signal-label--cat-casey {
  background: #fce7f3;
  color: #9d174d;
  border-color: #f9a8d4;
}
[data-theme="light"] .signal-label--masters-media {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
