/*
Theme Name: NotOnlyBook Modern
Theme URI: https://notonlybook.com/
Author: NotOnlyBook
Description: A fast, modern educational resource theme for IGCSE, Cambridge books, notes, worksheets and past papers. Built with AdSense-safe placement zones, Gutenberg compatibility, accessibility and responsive performance in mind.
Version: 1.0.1
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 8.1
Text Domain: notonlybook-modern
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: education, blog, news, grid-layout, custom-logo, custom-menu, featured-images, rtl-language-support
*/

:root {
  --nob-bg: #f7f9fc;
  --nob-surface: #ffffff;
  --nob-surface-soft: #eef4ff;
  --nob-ink: #12203a;
  --nob-muted: #60708d;
  --nob-line: #dfe6f0;
  --nob-primary: #1557d6;
  --nob-primary-strong: #0e3f9f;
  --nob-accent: #11a97d;
  --nob-warning: #f0a202;
  --nob-radius-sm: 12px;
  --nob-radius: 20px;
  --nob-radius-lg: 30px;
  --nob-shadow: 0 18px 50px rgba(23, 50, 93, .09);
  --nob-container: 1180px;
  --nob-reading: 760px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--nob-ink);
  background: var(--nob-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: var(--nob-primary); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--nob-primary-strong); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
  clip: auto !important;
  width: auto; height: auto; margin: 8px; padding: 12px 16px;
  background: #fff; color: #111; z-index: 99999; border-radius: 8px;
}

.nob-container { width: min(calc(100% - 32px), var(--nob-container)); margin-inline: auto; }
.nob-reading { width: min(100%, var(--nob-reading)); margin-inline: auto; }
.nob-section { padding: 64px 0; }
.nob-section--tight { padding: 40px 0; }
.nob-section--white { background: var(--nob-surface); }
.nob-section--soft { background: linear-gradient(180deg, #eef4ff 0%, #f8fbff 100%); }
.nob-section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  margin-bottom: 28px;
}
.nob-section-head h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.15; letter-spacing: -.035em; }
.nob-section-head p { margin: 8px 0 0; color: var(--nob-muted); max-width: 680px; }
.nob-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 10px; font-size: .78rem; line-height: 1;
  font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--nob-primary);
}
.nob-kicker::before { content: ""; width: 22px; height: 3px; border-radius: 999px; background: var(--nob-accent); }

/* Header */
.nob-site-header {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid rgba(223,230,240,.86);
  backdrop-filter: blur(14px);
}
.admin-bar .nob-site-header { top: 32px; }
.nob-header-inner {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 28px;
}
.nob-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--nob-ink); text-decoration: none; min-width: max-content; }
.nob-brand img { max-height: 46px; width: auto; }
.nob-brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  color: #fff; background: linear-gradient(135deg, var(--nob-primary), #6f52ed);
  font-weight: 900; letter-spacing: -.08em; box-shadow: 0 8px 24px rgba(21,87,214,.25);
}
.nob-brand-copy { display: grid; line-height: 1.05; }
.nob-brand-copy strong { font-size: 1.03rem; letter-spacing: -.02em; }
.nob-brand-copy span { margin-top: 5px; color: var(--nob-muted); font-size: .72rem; font-weight: 600; }

.nob-main-nav ul { display: flex; align-items: center; justify-content: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nob-main-nav li { position: relative; }
.nob-main-nav a {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: #263753; text-decoration: none; font-size: .92rem; font-weight: 700;
}
.nob-main-nav a:hover, .nob-main-nav .current-menu-item > a, .nob-main-nav .current-menu-ancestor > a { color: var(--nob-primary); background: var(--nob-surface-soft); }
.nob-main-nav .sub-menu {
  position: absolute; inset-inline-start: 0; top: calc(100% + 8px);
  min-width: 230px; display: none; padding: 10px;
  background: #fff; border: 1px solid var(--nob-line); border-radius: 14px; box-shadow: var(--nob-shadow);
}
.nob-main-nav li:hover > .sub-menu, .nob-main-nav li:focus-within > .sub-menu { display: block; }
.nob-main-nav .sub-menu li { width: 100%; }
.nob-main-nav .sub-menu a { width: 100%; }

.nob-header-actions { display: flex; gap: 8px; align-items: center; }
.nob-icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid var(--nob-line); border-radius: 12px; background: #fff; color: var(--nob-ink);
}
.nob-icon-btn:hover { border-color: #b8c7df; background: #f8fbff; }
.nob-menu-toggle { display: none; }
.nob-mobile-panel { display: none; }
.nob-header-search {
  padding: 16px 0 18px; border-top: 1px solid var(--nob-line); background: #fff;
}
.nob-header-search[hidden] { display: none; }

.search-form { display: flex; gap: 8px; width: min(100%, 680px); }
.search-form label { flex: 1; }
.search-field {
  width: 100%; min-height: 48px; padding: 0 15px;
  border: 1px solid #cfd9e8; border-radius: 13px; color: var(--nob-ink); background: #fff;
}
.search-field:focus { outline: 3px solid rgba(21,87,214,.14); border-color: var(--nob-primary); }
.search-submit, .nob-btn {
  min-height: 48px; padding: 0 18px; border: 0; border-radius: 13px;
  background: var(--nob-primary); color: #fff; font-weight: 800; text-decoration: none;
}
.search-submit:hover, .nob-btn:hover { background: var(--nob-primary-strong); color: #fff; }
.nob-btn--ghost { color: var(--nob-primary); background: #eaf1ff; }
.nob-btn--ghost:hover { color: #fff; }

/* Hero */
.nob-hero {
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 20%, rgba(17,169,125,.14), transparent 30%),
    radial-gradient(circle at 10% 10%, rgba(111,82,237,.13), transparent 34%),
    linear-gradient(180deg, #f9fbff 0%, #edf4ff 100%);
  border-bottom: 1px solid #dde7f6;
}
.nob-hero-inner { min-height: 580px; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr); gap: 54px; align-items: center; padding: 70px 0; }
.nob-hero-copy h1 { margin: 0; max-width: 840px; font-size: clamp(2.7rem, 6vw, 5.7rem); line-height: .98; letter-spacing: -.065em; }
.nob-hero-copy h1 span { color: var(--nob-primary); }
.nob-hero-copy > p { max-width: 720px; margin: 24px 0; color: #52637f; font-size: clamp(1.02rem, 2vw, 1.18rem); }
.nob-hero-search { display: flex; gap: 8px; max-width: 720px; padding: 8px; background: #fff; border: 1px solid #dce5f2; border-radius: 17px; box-shadow: 0 20px 60px rgba(34,64,112,.12); }
.nob-hero-search input { flex: 1; min-width: 0; min-height: 52px; padding: 0 14px; border: 0; outline: 0; color: var(--nob-ink); }
.nob-hero-search button { min-width: 120px; border: 0; border-radius: 12px; background: var(--nob-primary); color: #fff; font-weight: 800; }
.nob-hero-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.nob-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid #cfdaea; background: rgba(255,255,255,.72); color: #38506f; text-decoration: none; font-size: .84rem; font-weight: 700;
}
.nob-chip:hover { background: #fff; color: var(--nob-primary); }
.nob-hero-panel { position: relative; padding: 28px; background: rgba(255,255,255,.9); border: 1px solid #dce7f5; border-radius: var(--nob-radius-lg); box-shadow: 0 30px 80px rgba(28,57,101,.15); }
.nob-hero-panel::before { content: ""; position: absolute; width: 120px; height: 120px; top: -22px; inset-inline-end: -18px; border-radius: 36px; transform: rotate(14deg); background: linear-gradient(135deg, rgba(21,87,214,.11), rgba(17,169,125,.17)); }
.nob-panel-title { position: relative; margin: 0 0 18px; font-size: 1.12rem; }
.nob-stat-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nob-stat { min-height: 118px; padding: 18px; border-radius: 18px; background: #f5f8fd; border: 1px solid #e3eaf4; }
.nob-stat strong { display: block; font-size: 2rem; line-height: 1; letter-spacing: -.04em; color: var(--nob-primary); }
.nob-stat span { display: block; margin-top: 10px; color: var(--nob-muted); font-size: .8rem; font-weight: 700; }

/* Cards */
.nob-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 22px; }
.nob-card {
  min-width: 0; overflow: hidden; background: var(--nob-surface);
  border: 1px solid var(--nob-line); border-radius: var(--nob-radius); box-shadow: 0 8px 24px rgba(26,53,93,.04);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.nob-card:hover { transform: translateY(-4px); border-color: #cbd7e9; box-shadow: var(--nob-shadow); }
.nob-card-media { display: block; position: relative; aspect-ratio: 16/10; overflow: hidden; background: #eaf0f8; }
.nob-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.nob-card:hover .nob-card-media img { transform: scale(1.035); }
.nob-card-placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg,#e7effe,#effaf6); color: var(--nob-primary); font-weight: 900; font-size: 2rem; }
.nob-card-body { padding: 20px; }
.nob-card-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; color: var(--nob-muted); font-size: .77rem; font-weight: 700; }
.nob-card-meta a { color: var(--nob-primary); text-decoration: none; }
.nob-card-title { margin: 0; font-size: 1.14rem; line-height: 1.35; letter-spacing: -.02em; }
.nob-card-title a { color: var(--nob-ink); text-decoration: none; }
.nob-card-title a:hover { color: var(--nob-primary); }
.nob-card-excerpt { margin: 10px 0 0; color: var(--nob-muted); font-size: .9rem; line-height: 1.65; }

.nob-topic-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.nob-topic {
  display: flex; align-items: center; gap: 13px; min-height: 94px; padding: 18px;
  border: 1px solid var(--nob-line); border-radius: 17px; background: #fff; color: var(--nob-ink); text-decoration: none;
}
.nob-topic:hover { border-color: #b8c8df; box-shadow: 0 12px 30px rgba(36,61,99,.08); }
.nob-topic-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 13px; background: var(--nob-surface-soft); color: var(--nob-primary); font-weight: 900; }
.nob-topic strong { display: block; line-height: 1.25; }
.nob-topic small { display: block; margin-top: 4px; color: var(--nob-muted); }

.nob-years { display: grid; grid-template-columns: repeat(9, minmax(0,1fr)); gap: 10px; }
.nob-year {
  display: grid; place-items: center; min-height: 84px; padding: 10px;
  border: 1px solid #d8e3f1; border-radius: 16px; background: #fff; color: var(--nob-ink); text-decoration: none; font-weight: 800;
}
.nob-year span { display: block; color: var(--nob-primary); font-size: 1.45rem; line-height: 1; }
.nob-year:hover { background: var(--nob-primary); border-color: var(--nob-primary); color: #fff; }
.nob-year:hover span { color: #fff; }

/* Content layout */
.nob-page-header { padding: 52px 0 36px; background: #fff; border-bottom: 1px solid var(--nob-line); }
.nob-page-header h1 { margin: 6px 0 0; font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.08; letter-spacing: -.05em; }
.nob-page-header p { max-width: 760px; color: var(--nob-muted); }
.nob-breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--nob-muted); font-size: .82rem; }
.nob-breadcrumbs a { color: var(--nob-muted); text-decoration: none; }
.nob-breadcrumbs a:hover { color: var(--nob-primary); }

.nob-content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 42px; align-items: start; }
.nob-main-panel { min-width: 0; }
.nob-sidebar { position: sticky; top: 104px; }
.admin-bar .nob-sidebar { top: 136px; }
.nob-widget {
  margin-bottom: 18px; padding: 20px; border: 1px solid var(--nob-line); border-radius: 18px; background: #fff;
}
.nob-widget h2, .nob-widget h3 { margin: 0 0 14px; font-size: 1rem; }
.nob-widget ul { list-style: none; margin: 0; padding: 0; }
.nob-widget li + li { margin-top: 9px; }
.nob-widget a { text-decoration: none; }

.nob-article {
  overflow: hidden; background: #fff; border: 1px solid var(--nob-line); border-radius: 24px;
}
.nob-article-header { padding: 34px 38px 28px; }
.nob-article-header h1 { margin: 10px 0 16px; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.08; letter-spacing: -.05em; }
.nob-article-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; color: var(--nob-muted); font-size: .84rem; font-weight: 650; }
.nob-article-hero { aspect-ratio: 16/8.7; overflow: hidden; background: #eaf0f8; }
.nob-article-hero img { width: 100%; height: 100%; object-fit: cover; }
.entry-content { padding: 34px 38px 42px; color: #263753; overflow-wrap: anywhere; }
.entry-content > * { max-width: 100%; }
.entry-content p, .entry-content ul, .entry-content ol, .entry-content blockquote { margin-top: 0; margin-bottom: 1.35em; }
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 {
  color: var(--nob-ink); line-height: 1.2; letter-spacing: -.028em; scroll-margin-top: 110px;
}
.entry-content h2 { margin: 2.1em 0 .75em; font-size: clamp(1.55rem, 3vw, 2rem); }
.entry-content h3 { margin: 1.8em 0 .7em; font-size: 1.35rem; }
.entry-content a { overflow-wrap: anywhere; }
.entry-content img { border-radius: 14px; }
.entry-content figure { margin: 1.5em auto; }
.entry-content figcaption { margin-top: 8px; color: var(--nob-muted); font-size: .8rem; text-align: center; }
.entry-content blockquote { padding: 18px 22px; border-inline-start: 4px solid var(--nob-primary); border-radius: 0 14px 14px 0; background: #f5f8ff; }
.entry-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { padding: 12px; border: 1px solid var(--nob-line); text-align: start; }
.entry-content .wp-block-button__link {
  padding: 12px 20px; border-radius: 12px; background: var(--nob-primary); color: #fff; font-weight: 800; text-decoration: none;
}
.entry-content h1 > a[href*="drive.google.com"],
.entry-content h2 > a[href*="drive.google.com"] {
  display: inline-flex; padding: 12px 20px; border-radius: 12px; background: var(--nob-primary); color: #fff; font-size: 1rem; text-decoration: none;
}
.entry-content .wp-block-rank-math-toc-block,
.entry-content #rank-math-toc {
  padding: 20px 22px; margin: 24px 0; border: 1px solid #dce6f3; border-radius: 16px; background: #f8fbff;
}
.entry-content .wp-block-rank-math-toc-block ul { margin-bottom: 0; }
.entry-content iframe { max-width: 100%; border: 0; border-radius: 14px; }

.nob-post-footer { padding: 0 38px 36px; }
.nob-post-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.nob-post-tags a { padding: 6px 10px; border-radius: 999px; background: #eef3fb; color: #425671; text-decoration: none; font-size: .75rem; font-weight: 700; }
.nob-related { margin-top: 34px; }
.nob-related h2 { margin-bottom: 18px; }

.nob-reading-progress { position: fixed; top: 0; inset-inline-start: 0; z-index: 2000; width: 0; height: 3px; background: var(--nob-accent); pointer-events: none; }
.admin-bar .nob-reading-progress { top: 32px; }

/* Ads */
.nob-ad {
  clear: both; width: 100%; min-height: 90px; margin: 28px auto;
  display: flex; flex-direction: column; justify-content: center;
}
.nob-ad-label { margin-bottom: 6px; color: #8b97aa; font-size: .67rem; text-align: center; text-transform: uppercase; letter-spacing: .08em; }
.nob-ad .adsbygoogle { width: 100%; }
.nob-sidebar .nob-ad { min-height: 250px; margin: 0; }

/* Pagination */
.navigation.pagination { margin-top: 34px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.page-numbers { display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 10px; border: 1px solid var(--nob-line); border-radius: 10px; background: #fff; color: var(--nob-ink); text-decoration: none; font-weight: 700; }
.page-numbers.current, .page-numbers:hover { background: var(--nob-primary); border-color: var(--nob-primary); color: #fff; }

/* Footer */
.nob-site-footer { margin-top: 50px; padding: 58px 0 24px; background: #0f1d34; color: #c7d2e4; }
.nob-footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 44px; padding-bottom: 38px; }
.nob-site-footer h2, .nob-site-footer h3 { color: #fff; margin: 0 0 14px; font-size: 1rem; }
.nob-site-footer p { color: #aab8ce; max-width: 520px; }
.nob-site-footer ul { list-style: none; margin: 0; padding: 0; }
.nob-site-footer li + li { margin-top: 8px; }
.nob-site-footer a { color: #d8e2f0; text-decoration: none; }
.nob-site-footer a:hover { color: #fff; }
.nob-footer-bottom { display: flex; justify-content: space-between; gap: 18px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); color: #8fa0b9; font-size: .8rem; }

/* Empty / utility pages */
.nob-empty { padding: 70px 20px; text-align: center; background: #fff; border: 1px solid var(--nob-line); border-radius: 22px; }
.nob-empty h1, .nob-empty h2 { margin: 0 0 12px; }
.nob-empty p { margin: 0 auto 22px; max-width: 580px; color: var(--nob-muted); }

.woocommerce .button, .woocommerce button.button, .woocommerce input.button {
  border-radius: 10px !important; background: var(--nob-primary) !important; color: #fff !important;
}

@media (max-width: 980px) {
  .nob-main-nav { display: none; }
  .nob-menu-toggle { display: inline-grid; }
  .nob-header-inner { grid-template-columns: 1fr auto; }
  .nob-header-actions { grid-column: 2; }
  .nob-mobile-panel {
    display: block; padding: 12px 16px 18px; border-top: 1px solid var(--nob-line); background: #fff;
  }
  .nob-mobile-panel[hidden] { display: none; }
  .nob-mobile-panel ul { list-style: none; margin: 0; padding: 0; }
  .nob-mobile-panel li + li { margin-top: 4px; }
  .nob-mobile-panel a { display: block; padding: 10px 8px; border-radius: 9px; color: var(--nob-ink); text-decoration: none; font-weight: 700; }
  .nob-mobile-panel .sub-menu { padding-inline-start: 14px; }
  .nob-hero-inner { grid-template-columns: 1fr; min-height: auto; }
  .nob-hero-panel { max-width: 660px; }
  .nob-topic-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .nob-years { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .nob-content-grid { grid-template-columns: 1fr; }
  .nob-sidebar { position: static; }
}

@media (max-width: 720px) {
  .admin-bar .nob-site-header { top: 46px; }
  .admin-bar .nob-reading-progress { top: 46px; }
  .nob-container { width: min(calc(100% - 22px), var(--nob-container)); }
  .nob-section { padding: 46px 0; }
  .nob-header-inner { min-height: 66px; gap: 10px; }
  .nob-brand-copy span { display: none; }
  .nob-brand img { max-height: 40px; }
  .nob-hero-inner { padding: 52px 0; gap: 32px; }
  .nob-hero-copy h1 { font-size: clamp(2.6rem, 14vw, 4.4rem); }
  .nob-hero-search { flex-direction: column; padding: 7px; }
  .nob-hero-search button { min-height: 48px; }
  .nob-stat-grid { grid-template-columns: 1fr 1fr; }
  .nob-stat { min-height: 105px; padding: 15px; }
  .nob-card-grid { grid-template-columns: 1fr; }
  .nob-topic-grid { grid-template-columns: 1fr; }
  .nob-years { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .nob-section-head { display: block; }
  .nob-section-head .nob-btn { display: inline-flex; align-items: center; margin-top: 16px; }
  .nob-article-header, .entry-content, .nob-post-footer { padding-inline: 20px; }
  .nob-article-header { padding-top: 24px; }
  .entry-content { padding-top: 24px; }
  .nob-footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .nob-footer-bottom { flex-direction: column; }
  .search-form { flex-direction: column; }
}

@media (max-width: 430px) {
  .nob-brand-copy { display: none; }
  .nob-stat-grid { grid-template-columns: 1fr; }
  .nob-years { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Broken-image resilience (v1.0.1). */
.nob-fallback-image{width:100%;height:100%;object-fit:cover;display:block;background:#eef4ff}
.entry-content img.nob-fallback-image{width:100%;aspect-ratio:16/9;object-fit:cover;border:1px solid var(--nob-line)}
