/*
Theme Name: KRV Prime
Theme URI: https://krvprime.com
Author: KRV Prime
Author URI: https://krvprime.com
Description: A clean, institutional WordPress theme for KRV Prime — Systematic Financial-Market Education. Deep navy, charcoal, white, slate and subtle gold, with Playfair Display headings and IBM Plex Sans body text. Faithfully mirrors the KRV Prime web app layout.
Version: 1.0.0
Requires at least: 6.0
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: krvprime
*/

/* ============================================================
   1. Design tokens
   ============================================================ */
:root {
  --navy: #0A192F;
  --navy-light: #122845;
  --navy-deep: #050E1C;
  --gold: #D4AF37;
  --gold-soft: #E4C766;
  --slate: #475569;
  --slate-light: #64748b;
  --slate-lighter: #94a3b8;
  --border: #e2e8f0;
  --subtle: #F8FAFC;
  --white: #ffffff;
  --ink: #0F172A;
  --radius: 0.5rem;
  --container: 1280px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
}

/* ============================================================
   2. Base
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5 { font-family: var(--font-display); color: var(--navy); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.375rem; font-weight: 700; }
p { margin: 0 0 1rem; color: var(--slate); }
a { color: var(--navy); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--gold); }
img { max-width: 100%; height: auto; }
::selection { background: var(--gold); color: var(--navy); }

.font-display { font-family: var(--font-display); }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 600; color: var(--gold);
}
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.grain {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ============================================================
   3. Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 44px; padding: 0 1.5rem; border-radius: var(--radius);
  font-weight: 600; font-size: .95rem; cursor: pointer; border: 1px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); color: #fff; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-soft); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { background: var(--subtle); }

/* ============================================================
   4. Announcement bar
   ============================================================ */
.announcement-bar {
  background: var(--navy-deep); color: var(--gold-soft);
  font-size: .8rem; letter-spacing: .04em; text-align: center; padding: .55rem 1rem;
}

/* ============================================================
   5. Header / navigation
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50; background: #fff;
  border-bottom: 1px solid transparent; transition: background .3s ease, box-shadow .3s ease;
}
.site-header.scrolled {
  background: rgba(255,255,255,.85); backdrop-filter: blur(20px);
  border-bottom-color: var(--border); box-shadow: 0 1px 3px rgba(10,25,47,.06);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; }
.site-brand { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; }
.site-brand .brand-krv { color: var(--gold); }
.site-brand .brand-prime { color: var(--navy); }
.site-brand img { max-height: 44px; width: auto; }
.main-nav { display: flex; align-items: center; gap: 1.75rem; }
.main-nav a { font-size: .9rem; font-weight: 500; color: var(--slate); }
.main-nav a:hover, .main-nav .current-menu-item > a { color: var(--navy); }
.main-nav ul { list-style: none; display: flex; align-items: center; gap: 1.75rem; margin: 0; padding: 0; }
.main-nav li { position: relative; }
.main-nav .sub-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 200px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(10,25,47,.10); padding: .5rem; flex-direction: column; gap: 0;
}
.main-nav li:hover > .sub-menu { display: flex; }
.main-nav .sub-menu a { display: block; padding: .5rem .75rem; border-radius: 6px; }
.main-nav .sub-menu a:hover { background: var(--subtle); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.nav-toggle { display: none; background: none; border: none; color: var(--navy); cursor: pointer; font-size: 1.5rem; }

/* ============================================================
   6. Hero + page header
   ============================================================ */
.page-hero { background: var(--navy); color: #fff; padding: 4rem 0; }
.page-hero .eyebrow { color: var(--gold); }
.page-hero h1 { color: #fff; margin-top: .5rem; }
.page-hero p { color: var(--slate-lighter); max-width: 42rem; }
.hero {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff; padding: 6rem 0; position: relative;
}
.hero h1 { color: #fff; }
.hero p { color: var(--slate-lighter); font-size: 1.125rem; max-width: 40rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }

/* ============================================================
   7. Sections + cards
   ============================================================ */
.section { padding: 5rem 0; }
.section-subtle { background: var(--subtle); }
.section-label { color: var(--gold); font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem;
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.card:hover { box-shadow: 0 12px 30px rgba(10,25,47,.08); transform: translateY(-2px); border-color: #d4d9e0; }
.card .card-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--gold); }
.card h3 { margin: .5rem 0; }
.card .card-meta { font-size: .8rem; color: var(--slate-lighter); }
.card-thumb { border-radius: 10px; overflow: hidden; margin: -1.5rem -1.5rem 1rem; }
.card-thumb img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }

/* ============================================================
   8. Post / page content (also styles AI-published HTML)
   ============================================================ */
.entry { padding: 3.5rem 0; }
.entry-content { font-size: 1.02rem; color: #33475b; }
.entry-content h2 { margin-top: 2rem; padding-bottom: .5rem; border-bottom: 2px solid var(--gold); }
.entry-content h3 { margin-top: 1.5rem; }
.entry-content ul, .entry-content ol { color: #33475b; line-height: 1.7; padding-left: 1.25rem; }
.entry-content img { border-radius: 10px; margin: 1rem 0; }
.entry-content blockquote {
  border-left: 4px solid var(--gold); margin: 1.5rem 0; padding: .5rem 1.25rem;
  background: var(--subtle); border-radius: 0 8px 8px 0; font-style: italic; color: var(--navy);
}
.entry-meta { font-size: .85rem; color: var(--slate-lighter); margin-bottom: 1.5rem; }
.entry-meta .cat { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }

/* AI-agent published research HTML (scoped classes reused from the app) */
.entry-content .krv-section-header {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--navy);
  margin: 2rem 0 .75rem; padding-bottom: .5rem; border-bottom: 2px solid var(--gold);
}
.entry-content .krv-card-grid { width: 100%; border-collapse: separate; border-spacing: 10px; margin: .5rem 0 1.25rem; }
.entry-content .krv-metric-card { background: #f7f9fb; border: 1px solid #e1e4e8; border-radius: 10px; padding: 14px 16px; vertical-align: top; }
.entry-content .krv-metric-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #64748b; font-weight: 700; margin-bottom: 4px; }
.entry-content .krv-metric-value { font-size: 1.15rem; font-weight: 800; color: #1a3a5c; }
.entry-content .krv-table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: .9rem; border: 1px solid #e1e4e8; border-radius: 10px; overflow: hidden; }
.entry-content .krv-table thead th { background: var(--navy); color: #fff; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; text-align: left; padding: 11px 14px; }
.entry-content .krv-table tbody td { padding: 10px 14px; border-top: 1px solid #eef1f4; color: #334155; }
.entry-content .krv-table tbody tr:nth-child(even) { background: #f7f9fb; }
.entry-content .krv-disclaimer { font-size: .82rem; color: #64748b; font-style: italic; background: #f7f9fb; border: 1px solid #e1e4e8; border-radius: 8px; padding: 12px 14px; margin-top: 1.5rem; }

/* ============================================================
   9. Pagination
   ============================================================ */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 3rem; flex-wrap: wrap; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px;
  padding: 0 .75rem; border: 1px solid var(--border); border-radius: 8px; color: var(--slate); font-size: .9rem;
}
.pagination .page-numbers.current { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination .page-numbers:hover:not(.current) { background: var(--subtle); }

/* ============================================================
   10. Footer
   ============================================================ */
.site-footer { background: var(--navy-deep); color: #cbd5e1; }
.site-footer .footer-inner { padding: 4rem 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem; }
.footer-brand .brand-krv { color: var(--gold); }
.footer-brand .brand-prime { color: #fff; }
.footer-brand .tagline { font-family: var(--font-display); font-size: 1.125rem; color: #fff; margin-top: 1rem; }
.footer-brand .subtag { color: var(--gold); font-weight: 500; letter-spacing: .02em; margin-top: .25rem; font-size: .9rem; }
.footer-col h4 { color: #fff; font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: .65rem; }
.footer-col a { font-size: .9rem; color: var(--slate-lighter); }
.footer-col a:hover { color: #fff; }
.footer-social { display: flex; gap: .75rem; margin-top: 1.5rem; }
.footer-social a {
  height: 36px; width: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.1); border-radius: 8px; color: var(--slate-lighter);
}
.footer-social a:hover { color: var(--gold); border-color: rgba(212,175,55,.4); }
.footer-apps { margin-top: 1.75rem; }
.footer-apps .apps-label {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gold); font-weight: 600; margin: 0 0 .75rem;
}
.apps-badges { display: flex; flex-wrap: wrap; gap: .75rem; }
.store-badge {
  display: inline-flex; align-items: center; gap: .75rem; height: 56px; padding: 0 1rem;
  border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05);
  border-radius: 12px; min-width: 176px; transition: border-color .2s ease;
}
.store-badge:hover { border-color: rgba(212,175,55,.5); color: inherit; }
.store-badge--soon { opacity: .7; }
.store-badge .store-badge-text { display: flex; flex-direction: column; line-height: 1.2; }
.store-badge .top { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.store-badge .bottom { font-size: .9rem; font-weight: 600; color: #fff; }
.store-badge .soon-pill {
  margin-left: auto; font-style: normal; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--gold); background: rgba(212,175,55,.1);
  border: 1px solid rgba(212,175,55,.3); border-radius: 4px; padding: 2px 6px;
}
.footer-apps .apps-note { margin-top: .75rem; font-size: .75rem; color: #64748b; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 3.5rem; padding-top: 2rem; }
.footer-bottom p { text-align: center; font-size: .75rem; color: var(--slate-lighter); margin: 0; }

/* ============================================================
   11. Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .main-nav.open {
    display: block; position: absolute; top: 80px; left: 0; right: 0; background: #fff;
    border-top: 1px solid var(--border); box-shadow: 0 10px 30px rgba(10,25,47,.08); padding: 1rem 1.5rem;
  }
  .main-nav.open ul { flex-direction: column; align-items: flex-start; gap: .25rem; width: 100%; }
  .main-nav.open .sub-menu { position: static; display: block; border: none; box-shadow: none; padding: 0 0 0 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .header-actions .btn { display: none; }
}

/* ============================================================
   12. Tools calculators
   ============================================================ */
.calc .calc-formula {
  font-size: .78rem; color: var(--slate-light); background: var(--subtle);
  border: 1px solid var(--border); border-radius: 6px; padding: .5rem .65rem;
  margin: .25rem 0 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.5;
}
.calc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.calc-fields label { font-size: .72rem; font-weight: 600; color: var(--navy); display: block; margin-bottom: .25rem; }
.calc-fields input, .calc-fields textarea {
  width: 100%; height: 38px; padding: 0 .6rem; border: 1px solid var(--border);
  border-radius: 7px; font-family: inherit; font-size: .9rem; background: #fff;
}
.calc-fields input:focus, .calc-fields textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.calc-fields textarea { height: auto; min-height: 84px; padding: .5rem .6rem; resize: vertical; }
.calc-full { grid-column: 1 / -1; }
.calc-out { font-size: .85rem; margin-top: .85rem; }
.calc-out table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.calc-out td { padding: .35rem .5rem; border-top: 1px solid var(--border); color: var(--slate); }
.calc-out td:last-child { text-align: right; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.calc-badge { display: inline-block; font-weight: 700; font-size: .8rem; padding: .25rem .7rem; border-radius: 999px; margin-top: .6rem; }
.calc-badge.bull { background: #dcfce7; color: #166534; }
.calc-badge.bear { background: #fee2e2; color: #991b1b; }
.calc-badge.neutral { background: #fef3c7; color: #92400e; }
.calc-btn { height: 38px; font-size: .85rem; }
