/*
Theme Name: AISagely
Theme URI: https://aisagely.com/
Author: AISagely
Author URI: https://aisagely.com/
Description: Fast, SEO-first editorial theme for AISagely — AI tool reviews and guides. Zero JavaScript, one small stylesheet, system fonts, automatic dark mode.
Version: 1.3.1
Requires at least: 6.0
Tested up to: 6.6
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: aisagely
*/

/* ---------- tokens ---------- */
:root {
  --bg: #ffffff;
  --panel: #f7f8fb;
  --panel-2: #eef1f7;
  --ink: #101828;
  --muted: #52607a;
  --line: #e4e8f0;
  --brand: #4338ca;
  --brand-ink: #ffffff;
  --brand-soft: #eef0fd;
  --violet: #7c3aed;
  --amber: #f59e0b;
  --teal: #0d9488;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px -12px rgba(16, 24, 40, .18);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --panel: #101a2e;
    --panel-2: #16223a;
    --ink: #e6eaf2;
    --muted: #9aa7bd;
    --line: #1f2b44;
    --brand: #818cf8;
    --brand-ink: #0b1220;
    --brand-soft: #171f3d;
    --shadow: none;
    --shadow-lg: none;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--violet); }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.7rem); font-weight: 800; margin: .3em 0 .5em; }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.17rem; font-weight: 700; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: var(--brand-ink);
  padding: 10px 16px; border-radius: 0 0 10px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex; align-items: center; gap: 18px;
  min-height: 62px;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.18rem; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.logo svg { flex: none; }
.logo .tld { color: var(--brand); }

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: 8px 13px; border-radius: 99px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .93rem;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--panel-2); }

.nav-toggle-box, .nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle {
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; width: 42px; height: 42px;
    border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  }
  .nav-toggle svg { pointer-events: none; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 10px 20px 16px;
  }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { padding: 11px 12px; font-size: 1rem; }
  .nav-toggle-box:checked ~ .site-nav { display: block; }
}

/* ---------- hero (homepage) ---------- */
.hero {
  position: relative;
  padding: clamp(48px, 9vw, 96px) 0 clamp(32px, 5vw, 60px);
  text-align: center;
  background:
    radial-gradient(720px 340px at 30% -90px, var(--brand-soft), transparent 70%),
    radial-gradient(640px 300px at 78% -60px, color-mix(in srgb, var(--violet) 12%, transparent), transparent 70%);
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 75%);
}
.hero > .wrap { position: relative; }
.hero h1 { margin: 0 0 .35em; font-size: clamp(2.2rem, 1.4rem + 3.6vw, 3.4rem); }
.hero h1 .grad {
  background: linear-gradient(92deg, var(--brand), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub {
  max-width: 620px; margin: 0 auto 26px;
  color: var(--muted); font-size: clamp(1rem, .95rem + .4vw, 1.15rem);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 26px; }
.chip {
  display: inline-block; padding: 9px 18px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font-weight: 650; font-size: .93rem; text-decoration: none;
  box-shadow: var(--shadow);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.trust-row {
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center;
  color: var(--muted); font-size: .9rem; font-weight: 550;
}
.trust-row span::before { content: "✓ "; color: var(--teal); font-weight: 800; }

/* ---------- sections ---------- */
.section { padding: 34px 0 10px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; }
.section-head .more { margin-left: auto; font-weight: 650; font-size: .92rem; text-decoration: none; }

/* ---------- cards ---------- */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin-bottom: 34px;
}
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 22px 22px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
/* first card of the main grid is the featured story */
@media (min-width: 700px) {
  .section .grid > .card:first-child { grid-column: span 2; }
  .section .grid > .card:first-child h3 { font-size: 1.45rem; line-height: 1.3; }
  .section .grid > .card:first-child p { -webkit-line-clamp: 4; font-size: 1rem; }
}
.card .meta::after { content: " · Read →"; color: var(--brand); font-weight: 650; }
.card h2, .card h3 { margin: 0; font-size: 1.13rem; line-height: 1.35; }
.card h2 a, .card h3 a { color: var(--ink); text-decoration: none; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; padding-top: 6px; color: var(--muted); font-size: .82rem; }

.cat-chip {
  align-self: flex-start;
  display: inline-block; padding: 3px 11px; border-radius: 99px;
  font-size: .74rem; font-weight: 750; letter-spacing: .03em; text-transform: uppercase;
  text-decoration: none; position: relative; z-index: 1;
  background: var(--brand-soft); color: var(--brand);
}
.cat-chip.cat-tool-reviews { background: color-mix(in srgb, var(--violet) 12%, var(--bg)); color: var(--violet); }
.cat-chip.cat-how-to-guides { background: color-mix(in srgb, var(--teal) 12%, var(--bg)); color: var(--teal); }
.cat-chip.cat-ai-news { background: color-mix(in srgb, var(--amber) 14%, var(--bg)); color: #b45309; }
@media (prefers-color-scheme: dark) {
  .cat-chip.cat-ai-news { color: var(--amber); }
}

/* ---------- why-trust band ---------- */
.trust-band {
  margin: 30px 0 44px; padding: 30px clamp(20px, 4vw, 40px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.trust-band h2 { margin: 0 0 8px; font-size: 1.3rem; }
.trust-band p { margin: 0 0 14px; color: var(--muted); max-width: 70ch; }
.trust-band ul {
  display: grid; gap: 8px 26px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 0; padding: 0; list-style: none; color: var(--ink); font-size: .95rem;
}
.trust-band li::before { content: "✓ "; color: var(--teal); font-weight: 800; }

/* ---------- single article ---------- */
.breadcrumb {
  margin: 22px 0 4px; font-size: .85rem; color: var(--muted);
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { margin: 0 7px; opacity: .6; }

.post-meta-row {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  margin: 10px 0 6px; color: var(--muted); font-size: .88rem;
}

.entry-content { font-size: 1.03rem; }
.entry-content > * { margin-block: 0 1.15em; }
.entry-content h2 {
  margin-top: 2em; padding-top: .4em; scroll-margin-top: 84px;
}
.entry-content h2::before {
  content: ""; display: block; width: 44px; height: 4px; border-radius: 4px;
  margin-bottom: 12px;
  background: linear-gradient(92deg, var(--brand), var(--violet));
}
/* h3 = FAQ questions in our articles — style them as question cards */
.entry-content h3 {
  margin-top: 1.4em; padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px 10px 0 0; border-bottom: 0;
  font-size: 1.05rem;
}
.entry-content h3 + p {
  padding: 12px 16px 14px; margin-top: 0;
  background: var(--panel); border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 10px 10px;
  color: var(--muted);
}
/* article images: framed screenshots */
.entry-content figure { margin: 1.7em 0; }
.entry-content img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* "In this guide" table of contents */
.toc {
  margin: 20px 0 26px; padding: 18px 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.toc-title {
  margin: 0 0 8px; font-size: .8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.toc ol {
  margin: 0; padding: 0; list-style: none;
  columns: 2; column-gap: 28px;
}
@media (max-width: 620px) { .toc ol { columns: 1; } }
.toc li { margin-bottom: 6px; break-inside: avoid; font-size: .93rem; }
.toc a { text-decoration: none; color: var(--ink); font-weight: 550; }
.toc a::before { content: "→ "; color: var(--brand); }
.toc a:hover { color: var(--brand); }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li { margin-bottom: .35em; }
.entry-content li::marker { color: var(--brand); }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.entry-content code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: .12em .4em; border-radius: 6px; }

/* engine byline (first paragraph of content) */
.entry-content .byline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0 14px; margin-bottom: 1.6em;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: .9rem;
}
.entry-content .byline::before {
  content: "";
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: url("https://aisagely.com/wp-content/uploads/2026/07/vishal-swami-1.jpg") center 20%/cover no-repeat,
              linear-gradient(135deg, var(--brand), var(--violet));
  border: 2px solid color-mix(in srgb, var(--brand) 40%, var(--line));
}
.entry-content .byline a { color: var(--ink); font-weight: 700; text-decoration: none; }
.entry-content .byline a:hover { color: var(--brand); }

/* "Short answer" callout */
.entry-content blockquote {
  margin: 1.6em 0; padding: 18px 22px;
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.entry-content blockquote p { margin: 0; }
.entry-content blockquote strong { color: var(--brand); }
@media (prefers-color-scheme: dark) {
  .entry-content blockquote strong { color: #a5b4fc; }
}

/* disclosure line */
.entry-content em:only-child { color: var(--muted); font-size: .88em; }

/* affiliate CTA buttons ({{aff:...}} tokens resolved by the engine) */
.entry-content .aff-cta {
  display: inline-block; padding: 9px 18px; margin: 2px 0;
  border-radius: 10px;
  background: linear-gradient(92deg, var(--brand), var(--violet));
  color: #fff; font-weight: 700; font-size: .93rem;
  text-decoration: none; box-shadow: var(--shadow);
}
.entry-content .aff-cta:hover { filter: brightness(1.1); color: #fff; }

/* tables */
.entry-content table {
  display: block; overflow-x: auto;
  width: 100%; max-width: 100%;
  border-collapse: collapse; margin: 1.6em 0;
  font-size: .95rem; line-height: 1.5;
  border: 1px solid var(--line); border-radius: 10px;
}
.entry-content th, .entry-content td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line);
  min-width: 110px;
}
.entry-content thead th, .entry-content tr:first-child th {
  background: var(--panel-2); color: var(--ink); font-weight: 750;
  white-space: nowrap;
}
.entry-content tbody tr:nth-child(even) { background: var(--panel); }
.entry-content tbody tr:last-child td { border-bottom: 0; }

/* FAQ headings */
.entry-content h3 + p { color: var(--ink); }

/* ---------- author box ---------- */
.author-box {
  display: flex; gap: 18px; align-items: flex-start;
  margin: 44px 0 10px; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
img.avatar, .author-box .avatar {
  flex: none; width: 62px; height: 62px; border-radius: 50%;
  object-fit: cover; object-position: center 20%;
  border: 2px solid color-mix(in srgb, var(--brand) 40%, var(--line));
  box-shadow: var(--shadow);
}
.author-box h2 { margin: 0 0 2px; font-size: 1.08rem; }
.author-box .role { color: var(--brand); font-weight: 650; font-size: .85rem; margin: 0 0 8px; }
.author-box p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.6; }
.author-box .creds { margin-top: 8px; font-size: .84rem; }

/* ---------- related ---------- */
.related { margin: 34px 0 20px; }
.related h2 { font-size: 1.25rem; margin-bottom: 16px; }

/* ---------- archive header ---------- */
.archive-head { padding: 40px 0 8px; }
.archive-head h1 { margin: 0 0 6px; }
.archive-head p { margin: 0 0 10px; color: var(--muted); max-width: 70ch; }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 44px; }
.pagination .page-numbers {
  padding: 8px 15px; border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem;
}
.pagination .page-numbers.current { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pagination a.page-numbers:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 46px; padding: 40px 0 30px;
  background: var(--panel); border-top: 1px solid var(--line);
  color: var(--muted); font-size: .92rem;
}
.footer-grid {
  display: grid; gap: 28px; grid-template-columns: 2fr 1fr 1fr;
  margin-bottom: 26px;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 7px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }
.site-footer .brand-blurb { max-width: 44ch; }
.site-footer .fine {
  border-top: 1px solid var(--line); padding-top: 18px;
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between;
  font-size: .84rem;
}

/* ---------- misc ---------- */
.page-404 { text-align: center; padding: 70px 0 30px; }
.page-404 .big { font-size: 5rem; font-weight: 800; letter-spacing: -.04em;
  background: linear-gradient(92deg, var(--brand), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent; margin: 0; }
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  height: 1px; width: 1px; overflow: hidden; position: absolute;
}
@media print {
  .site-header, .site-footer, .related, .nav-toggle { display: none; }
}
