/*
Theme Name: FixMyPhoneSpeaker
Theme URI: https://fixmyphonespeaker.com/
Author: FixMyPhoneSpeaker
Author URI: https://fixmyphonespeaker.com/
Description: A light, fast, mobile-first theme for the FixMyPhoneSpeaker free browser speaker-cleaner tool. No jQuery, no external requests, no Google Fonts. Modern gradient hero, scroll-reveal animations, rounded-2xl cards.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fixmyphonespeaker
Tags: fast, mobile-first, minimal, tool, light
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --psc-bg: #FFFFFF;
  --psc-bg-alt: #F6FAFD;
  --psc-text: #0B1B33;
  --psc-muted: #5B6B84;
  --psc-blue: #2563EB;
  --psc-blue-dark: #1D4ED8;
  --psc-blue-ink: #123B9E;
  --psc-teal: #14B8A6;
  --psc-teal-dark: #0D9488;
  --psc-gradient: linear-gradient(135deg, #2563EB 0%, #0EA5E9 55%, #14B8A6 100%);
  --psc-radius: 1.25rem;            /* rounded-2xl cards */
  --psc-radius-sm: 0.875rem;
  --psc-shadow: 0 8px 24px rgba(11, 27, 51, 0.07);
  --psc-shadow-lg: 0 16px 44px rgba(11, 27, 51, 0.12);
  --psc-border: #E4EBF5;
  --psc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --psc-content-width: 46rem;
  --psc-tool-width: 56rem;
  --psc-page-width: 68rem;
  --psc-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--psc-font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--psc-text);
  background: var(--psc-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

h1, h2, h3, h4 {
  line-height: 1.22;
  letter-spacing: -0.022em;
  margin: 1.5em 0 0.55em;
  color: var(--psc-text);
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 3vw, 2.75rem); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.4vw, 1.9rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; }

a {
  color: var(--psc-blue);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: var(--psc-blue-dark); text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--psc-teal);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--psc-text);
  color: #fff;
  padding: 0.6em 1.2em;
  border-radius: 0 0 0.6rem 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; text-decoration: none; }

/* ============================================================
   HEADER — sticky slim, backdrop blur
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--psc-border);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.header-inner {
  max-width: var(--psc-page-width);
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--psc-text);
  white-space: nowrap;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }
.site-logo .logo-fix { color: var(--psc-blue); }
.site-logo .logo-mid { color: var(--psc-text); }

/* Mobile-first nav: horizontal scroll, never overflows on 360px */
.main-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.main-nav a {
  color: var(--psc-text);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.1rem;
  position: relative;
}
.main-nav a:hover { color: var(--psc-blue); text-decoration: none; }
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--psc-gradient);
  transition: right 0.22s var(--psc-ease);
}
.main-nav a:hover::after,
.main-nav .current-menu-item > a::after { right: 0; }
.main-nav .current-menu-item > a { color: var(--psc-blue); }

@media (min-width: 760px) {
  .main-nav ul { flex-wrap: wrap; gap: 1.35rem; }
  .main-nav a { font-size: 0.95rem; }
  .main-nav { overflow: visible; mask-image: none; -webkit-mask-image: none; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.site-main { display: block; }

.content-wrap {
  max-width: var(--psc-content-width);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 3.75rem;
}

.tool-wrap {
  max-width: var(--psc-tool-width);
  margin: 0 auto;
  padding: 2.25rem 1.25rem 3.5rem;
}

.alt-section {
  background: var(--psc-bg-alt);
  border-top: 1px solid var(--psc-border);
  border-bottom: 1px solid var(--psc-border);
}

/* ============================================================
   HERO — gradient mesh, entrance animation
   ============================================================ */
.hero {
  text-align: center;
  padding: 4.25rem 1.25rem 3.75rem;
  background:
    radial-gradient(42rem 22rem at 18% -4%, rgba(37, 99, 235, 0.14), transparent 60%),
    radial-gradient(40rem 24rem at 82% -2%, rgba(20, 184, 166, 0.15), transparent 60%),
    radial-gradient(60rem 30rem at 50% 130%, rgba(37, 99, 235, 0.06), transparent 65%),
    linear-gradient(180deg, #F2F7FE 0%, #FFFFFF 78%);
  overflow: hidden;
}

.hero-inner {
  max-width: var(--psc-content-width);
  margin: 0 auto;
}

.hero-inner > * { animation: psc-rise 0.75s var(--psc-ease) both; }
.hero-inner > :nth-child(2) { animation-delay: 0.12s; }
.hero-inner > :nth-child(3) { animation-delay: 0.24s; }
.hero-inner > :nth-child(4) { animation-delay: 0.34s; }

.hero h1 { margin: 0 0 0.7rem; }
.hero h1 .hero-accent {
  background: var(--psc-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .hero-sub {
  color: var(--psc-muted);
  font-size: 1.12rem;
  max-width: 37rem;
  margin: 0 auto 1.9rem;
  text-wrap: balance;
}

@keyframes psc-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Simple centered title block for subpages */
.page-hero {
  text-align: center;
  padding: 3rem 1.25rem 2.25rem;
  background:
    radial-gradient(38rem 20rem at 50% -10%, rgba(20, 184, 166, 0.10), transparent 60%),
    linear-gradient(180deg, #F2F7FE 0%, #FFFFFF 85%);
}
.page-hero h1 { margin: 0 0 0.5rem; }
.page-hero p {
  color: var(--psc-muted);
  max-width: 40rem;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* ============================================================
   SCROLL REVEAL (wired by reveal.js)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s var(--psc-ease), transform 0.65s var(--psc-ease);
  transition-delay: var(--psc-reveal-delay, 0s);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   BUTTONS — pill, gradient primary
   ============================================================ */
.btn, .wp-block-button__link {
  display: inline-block;
  background: var(--psc-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  padding: 0.9rem 2.2rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.30);
  transition: transform 0.18s var(--psc-ease), box-shadow 0.18s var(--psc-ease), filter 0.18s ease;
}
.btn:hover, .wp-block-button__link:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.36);
  filter: brightness(1.04);
}
.btn:active, .wp-block-button__link:active { transform: translateY(0) scale(0.99); }
.btn-teal { box-shadow: 0 10px 26px rgba(20, 184, 166, 0.30); }
.btn-teal:hover { box-shadow: 0 14px 32px rgba(20, 184, 166, 0.38); }
.btn-ghost {
  background: #fff;
  color: var(--psc-blue-ink);
  border: 1.5px solid var(--psc-border);
  box-shadow: none;
}
.btn-ghost:hover {
  background: #fff;
  color: var(--psc-blue-dark);
  border-color: var(--psc-blue);
  box-shadow: var(--psc-shadow);
  filter: none;
}

/* ============================================================
   CARDS / GRIDS — rounded-2xl, hover lift
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: var(--psc-tool-width);
  margin: 0 auto;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: #fff;
  border: 1px solid var(--psc-border);
  border-radius: var(--psc-radius);
  padding: 2rem 1.6rem;
  box-shadow: var(--psc-shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--psc-ease), box-shadow 0.25s var(--psc-ease), border-color 0.25s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--psc-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--psc-shadow-lg);
  border-color: #CFDCF2;
}
.card:hover::before { opacity: 1; }
.card h3 { margin-top: 0; font-size: 1.15rem; }
.card p { color: var(--psc-muted); margin-bottom: 0; font-size: 0.96rem; }
.card .card-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 0.7rem;
  transition: transform 0.25s var(--psc-ease);
}
.card:hover .card-icon { transform: scale(1.12) rotate(-4deg); }

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 1.6rem;
}
.link-row a {
  display: inline-block;
  border: 1.5px solid var(--psc-border);
  border-radius: 999px;
  padding: 0.6rem 1.35rem;
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--psc-text);
  background: #fff;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s var(--psc-ease), box-shadow 0.18s ease;
}
.link-row a:hover {
  border-color: var(--psc-blue);
  color: var(--psc-blue-dark);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--psc-shadow);
}

.section-title { text-align: center; margin-bottom: 2rem; }
.center { text-align: center; }

/* ============================================================
   BLOG — cards for /blog/ index and related posts
   ============================================================ */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  max-width: var(--psc-page-width);
  margin: 0 auto;
  padding: 0 1.25rem 3.5rem;
}
@media (min-width: 640px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--psc-border);
  border-radius: var(--psc-radius);
  overflow: hidden;
  box-shadow: var(--psc-shadow);
  transition: transform 0.25s var(--psc-ease), box-shadow 0.25s var(--psc-ease);
}
.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--psc-shadow-lg);
}
.blog-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.blog-card .blog-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.35rem 1.5rem 1.5rem;
  flex: 1;
}
.blog-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--psc-teal-dark);
  background: rgba(20, 184, 166, 0.12);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}
.blog-card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.35;
}
.blog-card h3 a { color: var(--psc-text); }
.blog-card h3 a:hover { color: var(--psc-blue-dark); text-decoration: none; }
.blog-excerpt {
  color: var(--psc-muted);
  font-size: 0.94rem;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-meta {
  color: var(--psc-muted);
  font-size: 0.82rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.4rem;
  border-top: 1px solid var(--psc-border);
}

/* ============================================================
   ARTICLE TYPOGRAPHY
   ============================================================ */
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li { margin-bottom: 0.4em; }
.entry-content blockquote {
  border-left: 4px solid var(--psc-teal);
  margin: 1.6em 0;
  padding: 0.7em 1.3em;
  background: var(--psc-bg-alt);
  border-radius: 0 var(--psc-radius-sm) var(--psc-radius-sm) 0;
  color: var(--psc-muted);
}
.entry-meta { color: var(--psc-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* Content figure / callout / safety boxes emitted by the build */
.psc-figure { margin: 1.75rem 0; }
.psc-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--psc-radius);
  box-shadow: var(--psc-shadow-lg);
}
.psc-figure figcaption {
  text-align: center;
  color: var(--psc-muted);
  font-size: 0.88rem;
  margin-top: 0.6rem;
}
.psc-cta {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.08));
  border: 1px solid var(--psc-border);
  border-radius: var(--psc-radius);
  padding: 1.75rem;
  margin: 2rem 0;
  text-align: center;
}
.psc-cta p:last-child { margin-bottom: 0; }
.psc-safety {
  border-left: 4px solid var(--psc-blue);
  background: #F0F5FE;
  border-radius: 0 var(--psc-radius-sm) var(--psc-radius-sm) 0;
  padding: 1.1rem 1.4rem;
  margin: 1.75rem 0;
  font-size: 0.96rem;
}
.psc-safety strong { color: var(--psc-blue-ink); }
/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--psc-border);
  background: var(--psc-bg-alt);
  padding: 3rem 1.25rem 2rem;
  position: relative;
}
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--psc-gradient);
  opacity: 0.5;
}
.footer-inner {
  max-width: var(--psc-page-width);
  margin: 0 auto;
}
.footer-tagline {
  color: var(--psc-muted);
  font-size: 0.96rem;
  margin-bottom: 1.4rem;
  max-width: 44rem;
}
.footer-nav ul {
  list-style: none;
  margin: 0 0 1.4rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
}
.footer-nav a { color: var(--psc-text); font-size: 0.92rem; font-weight: 600; }
.footer-nav a:hover { color: var(--psc-blue); text-decoration: none; }
.footer-copy { color: var(--psc-muted); font-size: 0.84rem; }

/* Sticky anchor ad placeholder (disabled until approval) */
.psc-sticky-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border-top: 1px solid var(--psc-border);
  text-align: center;
  padding: 0.4rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 639px) {
  body { font-size: 16px; }
  .hero { padding: 3.25rem 1.25rem 2.75rem; }
  .hero .hero-sub { font-size: 1.02rem; }
  .header-inner { padding: 0.55rem 1rem; }
  .site-logo { font-size: 1.08rem; }
  .content-wrap { padding: 1.9rem 1.1rem 3rem; }
  .card { padding: 1.6rem 1.25rem; }
  .btn, .wp-block-button__link { width: 100%; max-width: 22rem; padding: 1rem 1.5rem; }
  .psc-cta { padding: 1.35rem 1.1rem; }
}

/* ============================================================
   REDUCED MOTION — disable all movement
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-inner > * { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .card:hover, .blog-card:hover, .btn:hover, .link-row a:hover { transform: none; }
}
