/*
Theme Name: TopTut
Theme URI: https://toptut.com
Author: TopTut
Author URI: https://toptut.com
Description: TopTut — Your Blueprint for AI-Driven WordPress Automation. A fast, glassmorphic, mobile-optimised custom theme: plugin splash homepage, recent-posts blog feed, affiliate banner slot, dynamic author bios, protected contact form, comments closed by default.
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: toptut
Tags: blog, news, two-columns, custom-logo, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   TOPTUT — DESIGN TOKENS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  /* ===== PALETTE — swap this block to recolour the whole theme ===== */
  /* Default: "Iris" — indigo-violet → periwinkle (AI mood, no magenta) */
  --purple: oklch(53% 0.18 282);
  --purple-light: oklch(66% 0.14 280);
  --purple-dim: oklch(95% 0.035 286);
  --pink: oklch(67% 0.14 252);          /* accent (periwinkle-blue) */
  --blue: oklch(62% 0.15 246);
  --grad-mid: oklch(60% 0.17 268);
  /* ================================================================ */
  --navy: oklch(18% 0.05 270);
  --navy-mid: oklch(38% 0.07 270);
  --muted: oklch(56% 0.04 270);
  --bg: oklch(98% 0.008 285);
  --bg-2: oklch(96.5% 0.012 285);
  --card: oklch(100% 0 0);
  --border: oklch(91% 0.015 285);
  --ink: oklch(16% 0.035 280);

  /* Gradients */
  --grad-brand: linear-gradient(100deg, var(--purple) 0%, var(--grad-mid) 52%, var(--pink) 100%);
  --grad-brand-soft: linear-gradient(120deg, oklch(94% 0.045 285) 0%, oklch(95% 0.04 262) 100%);

  /* Glass */
  --glass-bg: oklch(100% 0 0 / 0.55);
  --glass-bg-strong: oklch(100% 0 0 / 0.72);
  --glass-border: oklch(100% 0 0 / 0.65);
  --glass-blur: blur(22px) saturate(1.5);

  /* Shadows */
  /* Shadows — neutral & soft (not purple-tinted) */
  --shadow-sm: 0 1px 2px oklch(25% 0 0 / 0.05), 0 1px 3px oklch(25% 0 0 / 0.04);
  --shadow-md: 0 2px 8px oklch(25% 0 0 / 0.05), 0 6px 18px oklch(25% 0 0 / 0.06);
  --shadow-lg: 0 6px 18px oklch(25% 0 0 / 0.06), 0 14px 40px oklch(25% 0 0 / 0.08);
  --shadow-xl: 0 10px 28px oklch(25% 0 0 / 0.08), 0 24px 56px oklch(25% 0 0 / 0.1);
  --shadow-purple: 0 5px 18px oklch(50% 0.08 282 / 0.2);

  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Hanken Grotesk', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, monospace;
  --max-w: 1260px;
  --measure: 720px;
  --radius: 16px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
}

/* ============================================================
   BASE
   ============================================================ */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--navy);
  line-height: 1.68;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, .stat-num, .font-display { font-family: var(--font-display); }
img { max-width: 100%; height: auto; }
a { color: var(--purple); }
::selection { background: oklch(62% 0.18 340 / 0.25); }

.wrap { max-width: var(--max-w); margin: 0 auto; padding-left: 48px; padding-right: 48px; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 12px; z-index: 9999; background: var(--purple); color:#fff; padding: 8px 14px; border-radius: 8px; }

/* Aurora background field — GPU-cheap, paused when reduced motion */
.aurora {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.aurora::before, .aurora::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: 0.55; will-change: transform;
}
.aurora::before {
  width: 46vw; height: 46vw; left: -6vw; top: -14vw;
  background: radial-gradient(circle at 30% 30%, oklch(72% 0.16 300 / 0.55), transparent 65%);
  animation: drift1 22s ease-in-out infinite alternate;
}
.aurora::after {
  width: 40vw; height: 40vw; right: -8vw; top: -10vw;
  background: radial-gradient(circle at 60% 40%, oklch(74% 0.15 250 / 0.5), transparent 65%);
  animation: drift2 26s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate3d(6vw, 6vw, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(-5vw, 5vw, 0) scale(1.08); } }

.grid-overlay {
  position: absolute; inset: 0; z-index: 0; opacity: 0.5; pointer-events: none;
  background-image:
    linear-gradient(oklch(65% 0.1 285 / 0.1) 1px, transparent 1px),
    linear-gradient(90deg, oklch(65% 0.1 285 / 0.1) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 0%, transparent 78%);
}

/* Glass utility */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), inset 0 1px 0 oklch(100% 0 0 / 0.6);
}

/* Gradient text */
.grad-text {
  background: linear-gradient(100deg, oklch(50% 0.25 286), oklch(54% 0.22 268), oklch(58% 0.2 244));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple); color: #fff;
  padding: 13px 26px; border-radius: 12px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
  box-shadow: var(--shadow-purple);
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, oklch(100% 0 0 / 0.22) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform 0.5s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px oklch(25% 0 0 / 0.16); }
.btn-primary:hover::before { transform: translateX(120%); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--navy-mid); font-size: 14px; font-weight: 600;
  text-decoration: none; padding: 13px 18px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--card);
  transition: all 0.2s; cursor: pointer; font-family: var(--font-body);
}
.btn-ghost:hover { color: var(--purple); border-color: oklch(80% 0.1 285); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--grad-brand); z-index: 200;
  box-shadow: 0 0 12px oklch(54% 0.2 312 / 0.6);
  transition: width 0.08s linear;
}

/* ============================================================
   NAV
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: oklch(99% 0.006 285 / 0.78);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), 0 4px 24px oklch(50% 0.1 285 / 0.05);
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 48px; height: 78px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; transition: opacity 0.2s; flex-shrink: 0; }
.nav-logo:hover { opacity: 0.82; }
.nav-logo img { height: 34px; width: auto; display: block; }
.nav-logo-mark { height: 32px !important; width: auto; }
.nav-logo .wordmark { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.5px; color: var(--navy); }
.nav-links { display: flex; gap: 30px; list-style: none; align-items: center; }
.nav-links a {
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  color: var(--navy-mid); text-decoration: none;
  position: relative; padding-bottom: 3px; transition: color 0.2s;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -1px; left: 50%; right: 50%; height: 2px;
  background: var(--grad-brand); border-radius: 2px;
  transition: left 0.25s var(--ease-out), right 0.25s var(--ease-out);
}
.nav-links a:hover, .nav-links a.active { color: var(--navy); }
.nav-links a:hover::after, .nav-links a.active::after { left: 0; right: 0; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-cta {
  background: var(--purple); color: #fff;
  padding: 10px 20px; border-radius: 10px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  text-decoration: none; position: relative; overflow: hidden; white-space: nowrap;
  transition: box-shadow 0.25s, transform 0.2s; box-shadow: var(--shadow-purple);
}
.nav-cta::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, oklch(100% 0 0 / 0.2) 50%, transparent 65%);
  transform: translateX(-100%); transition: transform 0.45s ease;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 22px oklch(25% 0 0 / 0.15); }
.nav-cta:hover::before { transform: translateX(100%); }
.nav-toggle {
  display: none; width: 42px; height: 42px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  align-items: center; justify-content: center; cursor: pointer; flex-direction: column; gap: 4px;
}
.nav-toggle span { width: 18px; height: 2px; background: var(--navy); border-radius: 2px; transition: 0.25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Expandable search */
.nav-search-toggle {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--navy-mid); transition: color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s; flex-shrink: 0;
}
.nav-search-toggle:hover { color: var(--purple); border-color: oklch(80% 0.1 285); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.nav-search-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.nav-search-toggle[aria-expanded="true"] { color: var(--purple); border-color: var(--purple); background: var(--purple-dim); }
.nav-search-panel {
  position: absolute; top: 100%; left: 0; right: 0;
  background: oklch(99% 0.006 285 / 0.95);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  max-height: 0; overflow: hidden; transition: max-height 0.32s var(--ease-out);
}
.nav-search-panel.open { max-height: 92px; box-shadow: var(--shadow-md); }
.nav-search-panel form { max-width: var(--max-w); margin: 0 auto; padding: 16px 48px; display: flex; gap: 12px; align-items: center; }
.nav-search-panel form > svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; flex-shrink: 0; }
.nav-search-panel input { flex: 1; min-width: 0; border: 1.5px solid var(--border); border-radius: 11px; padding: 12px 16px; font-family: var(--font-body); font-size: 15px; color: var(--navy); outline: none; background: var(--card); transition: border-color 0.2s, box-shadow 0.2s; }
.nav-search-panel input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px oklch(48% 0.22 285 / 0.1); }
.nav-search-panel .btn-primary { padding: 11px 20px; }

/* ============================================================
   CATEGORY SUB-NAV
   ============================================================ */
.cat-nav { border-bottom: 1px solid var(--border); background: var(--card); }
.cat-nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 48px;
  display: flex; gap: 0; align-items: stretch; overflow-x: auto; scrollbar-width: none;
}
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-nav-link {
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--muted); text-decoration: none; padding: 14px 20px;
  position: relative; transition: color 0.2s; white-space: nowrap;
}
.cat-nav-link::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 100%;
  height: 2px; background: var(--grad-brand); transition: right 0.25s ease;
}
.cat-nav-link:hover { color: var(--navy); }
.cat-nav-link:hover::after, .cat-nav-link.active::after { right: 0; }
.cat-nav-link.active { color: var(--navy); font-weight: 600; }

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
  font-family: var(--font-display); font-size: 19px; font-weight: 700;
  letter-spacing: -0.5px; color: var(--navy); margin-bottom: 26px;
  display: flex; align-items: center; gap: 14px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--purple); font-family: var(--font-body);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer-outer {
  position: relative; overflow: hidden;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 90% at 82% 0%, oklch(95% 0.04 262 / 0.6), transparent 60%),
    radial-gradient(ellipse 50% 90% at 8% 0%, oklch(94% 0.05 285 / 0.6), transparent 55%),
    var(--card);
  box-shadow: 0 -2px 24px oklch(50% 0.1 285 / 0.05);
}
.footer-outer::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(oklch(50% 0.12 282 / 0.05) 1px, transparent 1px), linear-gradient(90deg, oklch(50% 0.12 282 / 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 130% 95% at 50% 0%, black, transparent 80%);
  mask-image: radial-gradient(ellipse 130% 95% at 50% 0%, black, transparent 80%);
}
.site-footer {
  position: relative; z-index: 1;
  max-width: var(--max-w); margin: 0 auto;
  padding: 136px 48px 46px;
  display: flex; flex-direction: column;
}
.footer-brand { max-width: 560px; margin-bottom: 44px; }
.footer-brand-name {
  font-family: var(--font-display); font-size: clamp(24px, 3.2vw, 36px); font-weight: 700;
  color: var(--navy); text-decoration: none; letter-spacing: -0.8px;
  display: block; margin-bottom: 14px; line-height: 1.12; transition: color 0.2s;
}
.footer-brand-name:hover { color: var(--purple); }
.footer-tagline { font-size: 15.5px; color: var(--muted); line-height: 1.6; max-width: 470px; }
.footer-nav { display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap; padding-top: 40px; border-top: 1px solid var(--border); }
.footer-links { display: flex; gap: 26px; list-style: none; flex-wrap: wrap; }
.footer-links a {
  font-size: 13.5px; color: var(--navy-mid); text-decoration: none;
  font-weight: 500; transition: color 0.2s; position: relative;
}
.footer-links a::after {
  content: ''; position: absolute; bottom: -3px; left: 0; right: 100%;
  height: 1.5px; background: var(--grad-brand); border-radius: 2px; transition: right 0.25s ease;
}
.footer-links a:hover { color: var(--purple); }
.footer-links a:hover::after { right: 0; }
.footer-socials { display: flex; gap: 10px; }
.social-icon {
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--navy-mid);
  transition: all 0.22s var(--ease-spring); box-shadow: var(--shadow-sm);
}
.social-icon:hover {
  background: var(--purple); color: #fff; border-color: var(--purple);
  box-shadow: var(--shadow-purple);
  transform: translateY(-3px) scale(1.06);
}
.social-icon svg { width: 16px; height: 16px; fill: currentColor; }
.footer-bottom {
  margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.footer-copy { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
/* Base state is VISIBLE — hidden only once JS confirms it can animate (html.js-on),
   so content is never lost if scripts fail or are blocked. */
.reveal { transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
html.js-on .reveal { opacity: 0; transform: translateY(22px); }
html.js-on .reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.07s; }
.reveal[data-delay="2"] { transition-delay: 0.14s; }
.reveal[data-delay="3"] { transition-delay: 0.21s; }
.reveal[data-delay="4"] { transition-delay: 0.28s; }

/* ============================================================
   RESPONSIVE CHROME
   ============================================================ */
@media (max-width: 900px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .nav-inner { padding: 0 20px; height: 66px; }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-links.open {
    display: flex; position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 20px 16px;
    background: oklch(99% 0.006 285 / 0.97);
    -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
  }
  .nav-links.open li { width: 100%; }
  .nav-links.open a { display: block; padding: 13px 0; border-bottom: 1px solid var(--border); }
  .nav-links.open a::after { display: none; }
  .cat-nav-inner { padding: 0 20px; }
  .nav-search-panel form { padding: 14px 20px; }
  .nav-search-panel .btn-primary { padding: 11px 16px; }
  .site-footer { padding: 90px 20px 36px; }
  .footer-nav { flex-direction: column; align-items: flex-start; gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  html.js-on .reveal { opacity: 1 !important; transform: none !important; }
  .aurora::before, .aurora::after { animation: none; }
}
