/*
Theme Name: NotesNepal v2
Description: Lightweight, mobile-first theme for NotesNepal: classic NotesNepal look (blue + crimson, round tool icons, category columns) rebuilt with new code.
Version: 0.2.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: notesnepal
License: GPLv2 or later
*/

:root {
	--blue: #1f63b0;
	--blue-2: #2f7fd1;
	--red: #c62f3a;
	--red-2: #a8252f;
	--ink: #1c2430;
	--muted: #5f6b7a;
	--bg: #ffffff;
	--soft: #f3f5f8;
	--circle: #e6eaf0;
	--line: #e0e5ec;
	--radius: 14px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
	--font-head: "Jost", "Noto Sans Devanagari", system-ui, sans-serif;
	--font-body: "Mulish", "Noto Sans Devanagari", system-ui, sans-serif;
	/* Shared with the notesnepal-tools plugin */
	--brand-primary: var(--blue);
	--brand-primary-hover: var(--blue-2);
	--brand-accent: var(--red);
	--surface: var(--bg);
	--surface-soft: var(--soft);
	--text: var(--ink);
	--text-muted: var(--muted);
}
:root[data-theme="dark"] {
	--blue: #6aa7ec; --blue-2: #8dbdf2; --red: #ef6b74; --red-2: #f28b92;
	--ink: #e8edf3; --muted: #a3afbd; --bg: #10151d; --soft: #171e28; --circle: #1f2835; --line: #2a3442;
	--shadow: 0 1px 2px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.65 var(--font-body); color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--blue); }
a:hover { color: var(--red); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--blue); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }
.tt-a { color: var(--blue); }
.tt-b { color: var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .45rem 1.1rem; border-radius: 999px; border: 0; background: var(--blue); color: #fff; font: 600 .92rem var(--font-head); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--blue-2); color: #fff; }
.btn--red { background: var(--red); }
.btn--red:hover { background: var(--red-2); }
.btn--muted { background: var(--circle); color: var(--muted); cursor: default; }

/* Header: centred logo, menu bar beneath (classic NotesNepal) */
.site-header { background: var(--bg); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 var(--line); }
.site-header__top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 70px; }
.logo { grid-column: 2; font: 700 2rem/1 var(--font-head); letter-spacing: -.01em; text-decoration: none; }
.logo__a { color: var(--blue); }
.logo__b { color: var(--red); }
.custom-logo-link { grid-column: 2; }
.custom-logo { max-height: 56px; width: auto; }
.site-header__actions { grid-column: 3; justify-self: end; display: flex; gap: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--soft); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-toggle { grid-column: 1; grid-row: 1; justify-self: start; display: none; }

.primary-nav { background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.primary-nav .menu { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 6px 0; }
.primary-nav .menu a { display: block; padding: 8px 14px; border-radius: 8px; color: var(--ink); text-decoration: none; font: 500 .95rem var(--font-head); }
.primary-nav .menu a:hover { color: var(--blue); background: var(--bg); }
.primary-nav .current-menu-item > a, .primary-nav .current-cat > a { background: var(--bg); color: var(--blue); box-shadow: var(--shadow); }
.primary-nav .sub-menu { display: none; }
.site-search { padding: 12px 0; background: var(--soft); border-bottom: 1px solid var(--line); }
.search-form { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; }
.search-form input { flex: 1; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; font: inherit; background: var(--bg); color: var(--ink); }

/* Featured: three big round tools */
.featured { padding: 48px 0 24px; }
.featured__grid { display: grid; gap: 32px; grid-template-columns: repeat(3, 1fr); text-align: center; }
.feat__title { font-size: 1.35rem; margin: 0 0 16px; }
.feat__circle { display: grid; place-items: center; width: 150px; height: 150px; margin: 0 auto 16px; border-radius: 50%; background: var(--circle); color: var(--blue); transition: transform .2s, background .2s; }
.feat:nth-child(2) .feat__circle { color: var(--red); }
a.feat__circle:hover { transform: translateY(-3px); background: color-mix(in srgb, var(--blue) 12%, var(--circle)); }
.feat__circle svg { width: 64px; height: 64px; stroke-width: 1.5; }
.feat p { color: var(--muted); max-width: 32ch; margin: 0 auto 16px; }

/* All tools: round icons */
.tools-wrap { padding: 24px 0 40px; }
.tools-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 28px; }
.tools-head h2, .section-title { font-size: 1.7rem; margin: 0; }
.tools-head h2 span[lang], .tool-group h3 span[lang] { font-size: .6em; color: var(--muted); font-weight: 500; margin-left: 6px; }
.tool-search { position: relative; flex: 0 1 360px; }
.tool-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
.tool-search input { width: 100%; min-height: 46px; padding: 0 16px 0 42px; border: 1px solid var(--line); border-radius: 999px; font: inherit; background: var(--bg); color: var(--ink); }
.tool-search__empty { text-align: center; color: var(--muted); padding: 24px 0; }
.tool-group h3 { font-size: 1.1rem; margin: 28px 0 14px; color: var(--ink); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.tool__link { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; padding: 14px 8px; border-radius: var(--radius); text-align: center; text-decoration: none; color: var(--ink); }
a.tool__link:hover { background: var(--soft); color: var(--ink); }
a.tool__link:hover .tool__icon { background: var(--blue); color: #fff; }
.tool__icon { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--circle); color: var(--blue); transition: background .15s, color .15s; }
.tool-group:nth-child(odd) .tool__icon { color: var(--red); }
.tool__name { font: 600 .9rem/1.3 var(--font-head); }
.tool__np { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.is-soon .tool__link { opacity: .55; }
.tool__badge { position: absolute; top: 8px; right: 8px; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: var(--soft); color: var(--muted); border-radius: 4px; padding: 1px 5px; }

/* Category columns (classic red-header lists) */
.cat-cols { background: var(--soft); padding: 40px 0 48px; }
.cat-cols .section-title { margin-bottom: 20px; }
.cat-cols__grid { display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr); }
.cat-col { background: var(--bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.cat-col__head { margin: 0; background: var(--red); text-align: center; font-size: 1.1rem; }
.cat-col__head a { display: block; padding: 14px; color: #fff; text-decoration: none; }
.cat-col ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.cat-col li a { display: block; padding: 11px 16px; border-bottom: 1px solid var(--line); text-decoration: none; font-size: .93rem; line-height: 1.4; }
.cat-col__more { padding: 12px 16px; font-weight: 600; font-size: .9rem; text-decoration: none; }

/* Inner pages */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; padding: 24px 16px 48px; }
.page-narrow { max-width: 900px; padding-top: 16px; padding-bottom: 48px; }
.crumb { font-size: .87rem; color: var(--muted); margin: 8px 0 4px; }
.crumb a { color: var(--muted); }
.entry__head h1, .page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: .3rem 0 .4rem; }
.entry__meta { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }
.entry__content { font-size: 1.05rem; }
.entry__content h2 { margin-top: 2rem; }
.entry__content img { border-radius: 10px; }
.entry__content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry__content th, .entry__content td { border: 1px solid var(--line); padding: 8px 10px; }
.tags a { display: inline-block; margin: 0 6px 6px 0; padding: 3px 10px; border-radius: 999px; background: var(--soft); font-size: .85rem; text-decoration: none; }
.related h2 { font-size: 1.3rem; margin-top: 2.5rem; }

.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card__media { display: block; aspect-ratio: 16 / 9; background: var(--circle); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__fallback { display: grid; place-items: center; height: 100%; color: var(--blue); }
.card__body { padding: 12px 14px 16px; }
.card__cat { font: 600 .75rem var(--font-head); text-transform: uppercase; color: var(--red); text-decoration: none; }
.card__title { font-size: 1.02rem; margin: 4px 0 6px; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--blue); }
.card__date { font-size: .82rem; color: var(--muted); }

.widget { background: var(--soft); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.widget-title { margin: 0 0 12px; font-size: 1rem; border-left: 4px solid var(--red); padding-left: 10px; }
.mini-tools { list-style: none; margin: 0; padding: 0; }
.mini-tools a { display: flex; align-items: center; gap: 10px; padding: 6px 0; text-decoration: none; color: var(--ink); font: 500 .95rem var(--font-head); }
.mini-tools .tool__icon { width: 38px; height: 38px; }
.mini-tools svg { width: 20px; height: 20px; }
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px; }
.nav-links .page-numbers { padding: 6px 12px; border-radius: 8px; background: var(--soft); text-decoration: none; }
.nav-links .current { background: var(--blue); color: #fff; }
.notfound { text-align: center; padding: 60px 16px; }

/* Footer */
.site-footer { background: #13233b; color: #c9d3e0; margin-top: 0; padding-top: 40px; }
.site-footer a { color: #e3e9f1; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .logo__a { color: #8cc0ff; }
.site-footer .logo__b { color: #ff7d86; }
.site-footer__cols { display: grid; gap: 28px; grid-template-columns: 1.3fr 1fr 1fr 1fr; }
.site-footer h4 { color: #fff; margin: 0 0 10px; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; line-height: 2; font-size: .93rem; }
.site-footer__about { font-size: .93rem; margin: 12px 0 18px; }
.site-footer__copy { text-align: center; font-size: .85rem; padding: 18px 16px; margin-top: 32px; border-top: 1px solid rgba(255,255,255,.1); }

/* Dropdown menu */
.primary-nav .menu > li { position: relative; }
.primary-nav .menu-item-has-children > a::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-3px) rotate(45deg); }
.primary-nav .sub-menu { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 220px; max-height: 70vh; overflow: auto; list-style: none; margin: 0; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.primary-nav li:hover > .sub-menu, .primary-nav li:focus-within > .sub-menu, .primary-nav li.is-open > .sub-menu { display: block; }

/* Ads: reserved space so the page does not jump */
.ad { margin: 16px auto; text-align: center; min-height: 100px; }
.ad--top { min-height: 100px; }
.ad--tool, .ad--article { min-height: 280px; margin: 24px 0; }
.ad--sidebar { min-height: 600px; }
.ad--sticky { position: sticky; top: 90px; }
.fb-wrap { margin-top: 2.5rem; min-height: 200px; }

/* Responsive */
@media (max-width: 1000px) {
	.cat-cols__grid { grid-template-columns: repeat(2, 1fr); }
	.layout { grid-template-columns: 1fr; }
	.site-footer__cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
	.menu-toggle { display: inline-grid; }
	.logo { font-size: 1.6rem; }
	.primary-nav { display: none; }
	.primary-nav.is-open { display: block; }
	.primary-nav .menu { flex-direction: column; padding: 8px 0; }
	.primary-nav .sub-menu { position: static; box-shadow: none; border: 0; padding-left: 16px; max-height: none; }
	.ad--sidebar { min-height: 250px; }
	.featured { padding: 20px 0 8px; }
	.featured__grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
	.feat { display: flex; flex-direction: column; }
	.feat__circle { order: -1; width: 84px; height: 84px; margin-bottom: 8px; }
	.feat__circle svg { width: 38px; height: 38px; }
	.feat__title { font-size: .95rem; margin: 0 0 8px; }
	.feat p { display: none; }
	.feat .btn { min-height: 32px; padding: .25rem .7rem; font-size: .78rem; margin: auto auto 0; }
	.tools-head { flex-direction: column; align-items: stretch; }
	.tool-search { flex-basis: auto; }
	.tool-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
	.tool__link { padding: 10px 4px; }
	.tool__icon { width: 56px; height: 56px; }
	.tool__name { font-size: .82rem; }
	.tool__np { display: none; }
	.tool__badge { top: 4px; right: 4px; }
	.cat-cols__grid, .site-footer__cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
