/*
Theme Name:   NumShelf
Theme URI:    https://numshelf.com/
Description:  NumShelf child theme for GeneratePress: squared-paper look, self-hosted fonts, category navigation, header search and site footer. Works with the NumShelf Calculators plugin.
Author:       Fauzan Global LLC
Template:     generatepress
Version:      1.0.0
Requires at least: 6.5
Requires PHP: 8.0
License:      GPL-2.0-or-later
Text Domain:  numshelf
*/

/* ---------- Fonts (self-hosted, SIL Open Font License; see assets/fonts) ---------- */
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(assets/fonts/public-sans-latin-wght-normal.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(assets/fonts/archivo-latin-wght-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(assets/fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url(assets/fonts/ibm-plex-mono-latin-600-normal.woff2) format('woff2'); }

/* ---------- Tokens ----------
   GeneratePress styles itself from --contrast/--base/--accent; redefining them here
   recolours the whole theme. The calculator plugin reads the --ns-* tokens. */
html:root {
  --paper: #f6f8f6;
  --sheet: #ffffff;
  --ink: #14202b;
  --muted: #55626b;
  --line: #d4ddd8;
  --pine: #0e6b57;
  --pine-soft: #e2efe9;
  --amber: #f2b33d;
  --danger: #b42318;
  --series-a: #a9cbbf;

  --font-display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  --max: 1160px;

  --contrast: var(--ink);
  --contrast-2: var(--muted);
  --contrast-3: var(--line);
  --base: var(--pine-soft);
  --base-2: var(--paper);
  --base-3: var(--sheet);
  --accent: var(--pine);

  --ns-ink: var(--ink); --ns-muted: var(--muted); --ns-line: var(--line); --ns-field: var(--sheet);
  --ns-panel: var(--paper); --ns-display: var(--pine-soft); --ns-accent: var(--pine); --ns-on-accent: var(--sheet);
  --ns-danger: var(--danger); --ns-focus: var(--amber); --ns-mono: var(--font-mono); --ns-radius: var(--radius);
  --ns-series-a: var(--series-a); --ns-series-b: var(--pine); --ns-display-font: var(--font-display);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  html:root {
    --paper: #0f1714; --sheet: #16211d; --ink: #e6ede9; --muted: #9aa8a1; --line: #2a3832;
    --pine: #5cc7a8; --pine-soft: #1c3029; --danger: #ff8a7a; --series-a: #2f5a4c;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
body { background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
body, button, input, select, textarea { font-family: var(--font-body); }
body { font-size: 1rem; line-height: 1.6; }
a { color: var(--pine); text-underline-offset: 3px; }
a:hover, a:focus { color: var(--ink); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
h1, h2, h3, h4, .entry-title, .page-title { font-family: var(--font-display); color: var(--ink); line-height: 1.15; text-wrap: balance; letter-spacing: -0.01em; }
h1, .entry-title, .page-title { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 750; }
h2 { font-size: 1.5rem; font-weight: 700; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 1.2em 0 0.4em; }
code, kbd, pre, samp { font-family: var(--font-mono); }

/* GeneratePress containers on the paper ground */
.site, .one-container .container, .one-container .site-content, .separate-containers .inside-article,
.site-main > article, .inside-article { background: transparent; }
.grid-container { max-width: var(--max); }
.one-container .site-content { padding: 32px 16px 56px; }
@media (min-width: 769px) { .one-container .site-content { padding: 40px 24px 64px; } }

/* ---------- Header ---------- */
.site-header { background: var(--sheet); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.admin-bar .site-header { top: var(--wp-admin--admin-bar--height, 32px); }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; position: relative; } }
.site-header .inside-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding: 12px 16px; }
@media (min-width: 769px) { .site-header .inside-header { padding: 12px 24px; } }
.site-header .site-branding, .site-header .site-logo { display: none; }
.ns-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.01em; }
.ns-logo:hover, .ns-logo:focus { color: var(--ink); }
.ns-logo__mark { width: 28px; height: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 7px; background: var(--ink); }
.ns-logo__mark i { background: var(--paper); border-radius: 1.5px; }
.ns-logo__mark i:nth-child(9) { background: var(--pine); }
.ns-nav ul { display: flex; gap: 4px 18px; list-style: none; margin: 0; padding: 0; font-size: 0.9375rem; }
.ns-nav a { color: var(--ink); text-decoration: none; white-space: nowrap; }
.ns-nav a:hover, .ns-nav a[aria-current] { color: var(--pine); text-decoration: underline; }
.ns-header-search { margin-left: auto; width: min(100%, 280px); }
@media (max-width: 960px) {
  .ns-nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .ns-nav::-webkit-scrollbar { display: none; }
  .ns-nav ul { flex-wrap: nowrap; padding-bottom: 2px; padding-right: 32px; }
  .ns-header-search { width: auto; flex: 1 1 180px; }
}

/* ---------- Breadcrumbs ---------- */
.ns-crumbs { font-size: 0.8125rem; margin-bottom: 14px; }
.ns-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.ns-crumbs li { margin: 0; }
.ns-crumbs li + li::before { content: '›'; margin-right: 4px; color: var(--muted); }
.ns-crumbs [aria-current] { color: var(--muted); }

/* ---------- Content ---------- */
.entry-header { margin-bottom: 8px; }
.entry-content > * { max-width: 100%; }
.entry-content > .ns-hero { max-width: none; }
.entry-content p, .entry-content li { max-width: 68ch; }
.entry-content > p:first-child { font-size: 1.125rem; color: var(--muted); max-width: 62ch; }
.entry-content ol, .entry-content ul.wp-block-list { padding-left: 1.3em; margin-left: 0; }
.entry-content li { margin-bottom: 6px; }
.wp-block-preformatted { font-family: var(--font-mono); font-size: 0.9375rem; line-height: 1.8; background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; white-space: pre; max-width: 100%; }
.wp-block-table { overflow-x: auto; margin: 1em 0 1.5em; }
.wp-block-table table, .wp-block-table .has-fixed-layout { table-layout: auto; border-collapse: collapse; width: 100%; max-width: 640px; background: var(--sheet); font-variant-numeric: tabular-nums; }
.wp-block-table th, .wp-block-table td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.wp-block-table th { background: var(--pine-soft); font-weight: 700; }
.wp-block-details { border-bottom: 1px solid var(--line); padding: 12px 0; max-width: 68ch; }
h2 + .wp-block-details { border-top: 1px solid var(--line); }
.wp-block-details summary { cursor: pointer; font-weight: 600; }
.wp-block-details summary:hover { color: var(--pine); }
.wp-block-details > p { margin: 8px 0 0; }
.nsc-disclaimer { font-size: 0.8125rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; margin-top: 14px; }
.entry-content > p.nsc-disclaimer:first-child { font-size: 0.8125rem; }

/* Tool pages: calculator-first, readable column */
.single-tool .inside-article { max-width: 900px; margin-inline: auto; }
.single-tool .entry-content > .nsc-calculator { margin: 24px 0 8px; }

/* ---------- Homepage ---------- */
.home .inside-article { padding: 0; }
.home .one-container .site-content, .home.one-container .site-content { padding-top: 0; }
.ns-hero {
  width: 100vw; margin-left: calc(50% - 50vw); margin-top: 0; margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
  background-color: var(--paper);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
}
.ns-hero__inner { max-width: 760px; margin: 0 auto; padding: 56px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.ns-hero__inner > * { margin: 0; }
.ns-hero .nsc-search label { font-family: var(--font-display); font-weight: 780; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; text-wrap: balance; margin-bottom: 8px; }
.ns-hero .nsc-search input[type="search"] { min-height: 60px; font-size: 1.125rem; padding: 14px 22px; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); }
.ns-eyebrow { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); background: var(--paper); align-self: flex-start; padding: 2px 6px; margin: 0; }
.home .entry-content > h2 { margin-top: 48px; }
.home .entry-content > h2:first-of-type { margin-top: 0; }
.ns-section-note { color: var(--muted); font-size: 0.875rem; margin-top: -4px; }
.home .wp-block-columns { gap: 32px; margin-top: 40px; }
.home .wp-block-column > h2 { margin-top: 0; }

/* ---------- Category pages and search results ---------- */
.tax-tool_category .page-header, .search .page-header { margin-bottom: 24px; }
.tax-tool_category .taxonomy-description { color: var(--muted); font-size: 1.125rem; max-width: 62ch; }
.tax-tool_category .site-main, .search-results .site-main { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); align-items: stretch; }
.tax-tool_category .site-main > :not(article), .search-results .site-main > :not(article) { grid-column: 1 / -1; }
.tax-tool_category .site-main > article, .search-results .site-main > article { margin: 0; }
.tax-tool_category .site-main > article .inside-article, .search-results .site-main > article .inside-article { height: 100%; padding: 18px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.tax-tool_category article .entry-title, .search-results article .entry-title { font-size: 1.125rem; margin: 0 0 6px; }
.tax-tool_category article .entry-title a, .search-results article .entry-title a { color: var(--ink); text-decoration: none; }
.tax-tool_category article .entry-title a:hover, .search-results article .entry-title a:hover { color: var(--pine); }
.tax-tool_category article .entry-summary, .search-results article .entry-summary { color: var(--muted); font-size: 0.9375rem; margin: 0; }
.tax-tool_category article .entry-summary p, .search-results article .entry-summary p { margin: 0; }
.tax-tool_category .read-more-container, .search-results .read-more-container, .tax-tool_category .entry-meta, .search-results .entry-meta { display: none; }
.ns-empty { max-width: 68ch; }

/* ---------- Footer ---------- */
.ns-footer { border-top: 1px solid var(--line); background: var(--sheet); font-size: 0.9375rem; }
.ns-footer__inner { max-width: var(--max); margin: 0 auto; padding: 32px 16px; display: grid; grid-template-columns: 1.2fr 2fr 1fr; gap: 24px; }
@media (max-width: 760px) { .ns-footer__inner { grid-template-columns: minmax(0, 1fr); } }
.ns-footer h2 { font-family: var(--font-body); font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.ns-footer ul { list-style: none; margin: 0; padding: 0; }
.ns-footer li { padding: 3px 0; margin: 0; }
.ns-footer__cats { columns: 2 160px; column-gap: 24px; }
.ns-footer p { color: var(--muted); margin: 10px 0 0; }
.site-footer .site-info { background: var(--sheet); color: var(--muted); border-top: 1px solid var(--line); font-size: 0.8125rem; }
.site-footer .site-info a { color: var(--muted); }

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
  h1, .entry-title, .page-title { font-size: 2rem; }
  .ns-hero__inner { padding: 40px 16px 36px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
