/*
Theme Name: Pashtowal
Theme URI: https://pashtowal.com
Author: Farrukh Khan
Author URI: https://pashtowal.com
Description: A minimal, parchment-and-ink theme for Pashtowal — warm manuscript tones, Fraunces and Source Serif typography, and a single lapis-blue accent, matching the Pashto Alphabet Book landing page.
Version: 1.0.0
Requires at least: 5.9
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: pashtowal
*/

/* ---------- Design tokens ---------- */

:root {
  --bg: #f2e8d8;
  --bg-panel: #fbf5e9;
  --bg-panel-edge: #e7d9bd;
  --ink: #3b2a1e;
  --ink-soft: #70594a;
  --ink-faint: #9a8369;
  --rule: #c9b493;
  --accent: #284e78;
  --accent-hover: #1d3c5e;
  --accent-ink: #fbf5e9;
  --gold: #ad7f2e;
  --shadow: 37 26 18;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #241a12;
    --bg-panel: #2e2117;
    --bg-panel-edge: #1a120c;
    --ink: #ecdfc7;
    --ink-soft: #bfa989;
    --ink-faint: #8a7256;
    --rule: #4a3826;
    --accent: #7db0e0;
    --accent-hover: #9cc4ea;
    --accent-ink: #1b2a3a;
    --gold: #d9a94b;
    --shadow: 0 0 0;
  }
}

:root[data-theme="dark"] {
  --bg: #241a12;
  --bg-panel: #2e2117;
  --bg-panel-edge: #1a120c;
  --ink: #ecdfc7;
  --ink-soft: #bfa989;
  --ink-faint: #8a7256;
  --rule: #4a3826;
  --accent: #7db0e0;
  --accent-hover: #9cc4ea;
  --accent-ink: #1b2a3a;
  --gold: #d9a94b;
  --shadow: 0 0 0;
}

/* ---------- Reset & base ---------- */

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

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgb(255 255 255 / 0.25), transparent 60%);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.65;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration-color: rgb(var(--shadow) / 0.25); }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4, h5, h6 {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  color: var(--ink);
  line-height: 1.15;
  text-wrap: balance;
  margin: 1.6em 0 0.5em;
}
h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }

p { margin: 0 0 1.2em; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }

blockquote {
  margin: 2em 0;
  padding: 0 0 0 0;
  text-align: center;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ink);
}
blockquote::before {
  content: "\201C";
  display: block;
  font-family: "Fraunces", serif;
  font-style: normal;
  font-size: 2.6rem;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 0.2em;
}
blockquote p:last-child { margin-bottom: 0; }

hr { border: none; border-top: 1px solid var(--rule); margin: 2.5em 0; }

code, pre {
  font-family: "Source Code Pro", Consolas, monospace;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
}
code { padding: 0.1em 0.4em; border-radius: 3px; font-size: 0.92em; }
pre { padding: 1em; overflow-x: auto; border-radius: 4px; }
pre code { border: none; padding: 0; background: none; }

table { border-collapse: collapse; width: 100%; margin: 1.5em 0; }
th, td { text-align: left; padding: 0.6em 0.8em; border-bottom: 1px solid var(--rule); }
th { font-family: "Work Sans", sans-serif; font-weight: 600; font-size: 0.85rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- Utility ---------- */

.wrap { max-width: 880px; margin: 0 auto; padding: 0 1.5rem; }

.eyebrow {
  font-family: "Work Sans", sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.nastaliq { font-family: "Noto Nastaliq Urdu", "Source Serif 4", serif; direction: rtl; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.screen-reader-text:focus {
  position: fixed !important;
  top: 0.75rem; left: 0.75rem;
  width: auto; height: auto;
  z-index: 1000;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 3px;
  clip-path: none;
}

/* ---------- Buttons (also styles core Gutenberg buttons) ---------- */

.btn,
.wp-block-button__link {
  font-family: "Work Sans", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.85rem 1.6rem;
  border-radius: 3px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  border: 1.5px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 0 rgb(var(--shadow) / 0.15);
  cursor: pointer;
}
.btn:hover,
.wp-block-button__link:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgb(var(--shadow) / 0.18);
}

.btn-secondary,
.is-style-outline .wp-block-button__link {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
  box-shadow: none;
}
.btn-secondary:hover,
.is-style-outline .wp-block-button__link:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: rgb(var(--shadow) / 0.04);
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 1.5rem;
  flex-wrap: wrap;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
}
.site-brand:hover { color: var(--ink); }

.brand-mark { width: 26px; height: 26px; flex: none; color: var(--gold); }

.brand-word {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.custom-logo-link img { max-height: 48px; width: auto; display: block; }

.site-nav .nav-menu {
  list-style: none;
  display: flex;
  gap: 1.8rem;
  margin: 0;
  padding: 0;
}
.site-nav .nav-menu a {
  font-family: "Work Sans", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav .nav-menu a:hover,
.site-nav .nav-menu .current-menu-item > a {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.site-nav .nav-menu ul { list-style: none; margin: 0; padding: 0; }

.nav-toggle-input { display: none; }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.4rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    width: 100%;
    order: 3;
    border-top: 1px solid var(--rule);
    margin-top: 1rem;
    padding-top: 1rem;
  }
  .site-nav .nav-menu { flex-direction: column; gap: 0.3rem; }
  .nav-toggle-input:checked ~ .site-nav { display: block; }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
}
.site-footer-inner {
  padding: 1.8rem 1.5rem;
  font-family: "Work Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer-inner p { margin: 0; }
.footer-menu {
  list-style: none;
  display: flex;
  gap: 1.2rem;
  margin: 0;
  padding: 0;
}
.footer-menu a { color: var(--ink-faint); text-decoration: underline; text-underline-offset: 2px; }
.footer-menu a:hover { color: var(--ink); }

/* ---------- Content area ---------- */

.site-main { display: block; }

.content-area { padding: 3rem 1.5rem 4rem; max-width: 720px; margin: 0 auto; }

.page-title { margin-top: 0; }

.page-content figure { margin: 2em 0; }
.page-content figcaption {
  font-family: "Work Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 0.5em;
}

/* ---------- Post list / single ---------- */

.post-list { display: flex; flex-direction: column; gap: 2.5rem; }
.post-card { border-bottom: 1px solid var(--rule); padding-bottom: 2.5rem; }
.post-card:last-child { border-bottom: none; }
.post-card-title { margin-top: 0; }
.post-card-title a { color: var(--ink); text-decoration: none; }
.post-card-title a:hover { color: var(--accent); }
.post-card-meta {
  font-family: "Work Sans", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin: 0.2em 0 1em;
}
.post-card-link {
  font-family: "Work Sans", sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.post-meta {
  font-family: "Work Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: -0.3em;
  margin-bottom: 2em;
}

.pagination { margin-top: 2.5rem; display: flex; gap: 1rem; font-family: "Work Sans", sans-serif; font-size: 0.9rem; }
.pagination .page-numbers { color: var(--ink-soft); text-decoration: none; }
.pagination .page-numbers.current { color: var(--ink); font-weight: 700; }

.post-nav .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 1.5rem;
	padding-top: 2rem;
	margin-top: 2rem;
	border-top: 1px solid var(--rule);
	font-family: "Work Sans", sans-serif;
	font-size: 0.9rem;
	font-weight: 600;
}

/* ---------- 404 ---------- */

.not-found { text-align: center; padding-top: 5rem; padding-bottom: 5rem; }
.not-found h1 { margin-top: 0.3em; }

/* ---------- Book library ---------- */

.book-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 2.2rem 1.6rem;
	margin: 2rem 0;
}

.book-card { display: flex; flex-direction: column; }

.book-cover {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 2 / 3;
	border-radius: 2px;
	overflow: hidden;
	background: var(--bg-panel);
	box-shadow: 0 0.75rem 1.5rem -0.75rem rgb(var(--shadow) / 0.4), 0 0.15rem 0.3rem rgb(var(--shadow) / 0.1);
	text-decoration: none;
}

.book-cover img { width: 100%; height: 100%; object-fit: cover; }

.book-cover-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	text-align: center;
	font-family: "Fraunces", serif;
	font-weight: 600;
	color: var(--ink-soft);
}

/* A fixed dark scrim + light text, independent of the site's light/dark
   theme tokens -- this composites over an arbitrary cover photo, so it
   needs to stay readable no matter what colors that cover happens to use. */
.book-blurb {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.1rem;
	background: rgba(26, 18, 12, 0.92);
	opacity: 0;
	transition: opacity 0.2s ease;
	overflow-y: auto;
}

.book-cover:hover .book-blurb,
.book-cover:focus-visible .book-blurb,
.book-cover.is-open .book-blurb {
	opacity: 1;
}

.book-blurb-text {
	font-family: "Source Serif 4", serif;
	font-size: 0.88rem;
	line-height: 1.5;
	color: #fbf5e9;
	text-align: left;
}

.book-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0.9rem 0 0.1rem;
}
.book-title a { color: var(--ink); text-decoration: none; }
.book-title a:hover { color: var(--accent); }

.book-downloads { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.8rem; }

/* Single book page */

.book-detail { display: grid; grid-template-columns: 220px 1fr; gap: 2.5rem; align-items: start; }
.book-detail .book-cover-static {
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border-radius: 2px;
	box-shadow: 0 1rem 2rem -1rem rgb(var(--shadow) / 0.4);
}
.book-detail .book-downloads { margin-top: 1.5rem; }

@media (max-width: 620px) {
	.book-detail { grid-template-columns: 1fr; }
	.book-detail .book-cover-static { max-width: 220px; }
}

/* ---------- Lexlingo dictionary / language learning ---------- */

.lx-wrap { margin: 2rem 0; }

.lx-search {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 1.8rem;
}
.lx-search input[type="text"] {
	flex: 1;
	min-width: 180px;
	padding: 0.65rem 0.9rem;
	border: 1px solid var(--rule);
	border-radius: 3px;
	background: var(--bg-panel);
	color: var(--ink);
	font-family: "Source Serif 4", serif;
}
.lx-search select {
	padding: 0.6rem 0.8rem;
	border: 1px solid var(--rule);
	border-radius: 3px;
	background: var(--bg-panel);
	color: var(--ink);
	font-family: "Work Sans", sans-serif;
	font-size: 0.85rem;
}
.lx-search button {
	font-family: "Work Sans", sans-serif;
	font-weight: 600;
	font-size: 0.85rem;
	padding: 0.65rem 1.2rem;
	border-radius: 3px;
	border: none;
	background: var(--accent);
	color: var(--accent-ink);
	cursor: pointer;
}
.lx-search button:hover { background: var(--accent-hover); }
.lx-clear-filters {
	font-family: "Work Sans", sans-serif;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--ink-faint);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.lx-clear-filters:hover { color: var(--ink); }

.lx-empty { color: var(--ink-faint); font-style: italic; }

.lx-dictionary-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1.5rem;
}

.lx-word-card,
.lx-sentence-card {
	background: var(--bg-panel);
	border: 1px solid var(--rule);
	border-left: 4px solid var(--accent);
	border-radius: 5px;
	padding: 1.25rem 1.3rem;
	box-shadow: 0 2px 6px rgb(var(--shadow) / 0.08);
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.lx-word-card:hover,
.lx-sentence-card:hover {
	box-shadow: 0 4px 14px rgb(var(--shadow) / 0.14);
	transform: translateY(-1px);
}

.lx-word-title { font-family: "Fraunces", serif; font-size: 1.3rem; font-weight: 700; color: var(--ink); margin: 0; }
.lx-word-category {
	display: inline-block;
	font-family: "Work Sans", sans-serif;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--gold);
	background: rgb(var(--shadow) / 0.06);
	border-radius: 999px;
	padding: 0.15rem 0.6rem;
	margin: 0.45em 0 1em;
}

.lx-sentence-list { display: flex; flex-direction: column; gap: 1.2rem; }
.lx-sentence-english { font-family: "Fraunces", serif; font-size: 1.2rem; font-weight: 600; color: var(--ink); margin: 0 0 0.9em; }

.lx-recordings { display: flex; flex-direction: column; gap: 0.7rem; }

.lx-recording {
	border-top: 1px solid var(--rule);
	padding-top: 0.7rem;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
}
.lx-recording audio { height: 32px; max-width: 220px; }

.lx-recording-text { display: flex; flex-direction: column; min-width: 0; }
.lx-native-text { font-family: "Noto Nastaliq Urdu", serif; font-size: 1.05rem; direction: rtl; }
.lx-romanization { font-family: "Work Sans", sans-serif; font-size: 0.78rem; color: var(--ink-faint); }

.lx-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-left: auto; }
.lx-badge {
	font-family: "Work Sans", sans-serif;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	background: rgb(var(--shadow) / 0.06);
	color: var(--accent);
	border: 1px solid var(--accent);
}
.lx-badge-grammar { color: var(--gold); border-color: var(--gold); }

.lx-related {
	margin-top: 0.9rem;
	padding-top: 0.7rem;
	border-top: 1px solid var(--rule);
	font-family: "Source Serif 4", serif;
	font-size: 0.85rem;
	color: var(--ink-soft);
}
.lx-related-label {
	font-family: "Work Sans", sans-serif;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--gold);
	margin-right: 0.4em;
}
.lx-related a { font-weight: 600; text-decoration: none; }
.lx-related a:hover { text-decoration: underline; }
.lx-related-sep { color: var(--ink-faint); }

.lx-details {
	margin-left: auto;
	font-family: "Work Sans", sans-serif;
	font-size: 0.72rem;
}
.lx-details summary {
	cursor: pointer;
	list-style: none;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	border: 1px solid var(--rule);
	color: var(--ink-soft);
	font-weight: 600;
	white-space: nowrap;
}
.lx-details summary::-webkit-details-marker { display: none; }
.lx-details[open] summary { background: var(--bg); color: var(--ink); }
.lx-details dl {
	margin: 0.5rem 0 0;
	padding: 0.6rem 0.75rem;
	background: var(--bg);
	border: 1px solid var(--rule);
	border-radius: 3px;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.2rem 0.7rem;
	min-width: 160px;
}
.lx-details dt { color: var(--ink-faint); font-weight: 600; }
.lx-details dd { margin: 0; color: var(--ink); }

.lx-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.2rem;
	margin-top: 2rem;
	font-family: "Work Sans", sans-serif;
	font-size: 0.85rem;
}
.lx-pagination a { font-weight: 600; text-decoration: none; }
.lx-pagination span { color: var(--ink-faint); }

/* ---------- Core block compatibility ---------- */

.alignwide { max-width: 1040px; margin-left: auto; margin-right: auto; }
.alignfull { max-width: none; width: 100vw; margin-left: calc(50% - 50vw); }
.aligncenter { margin-left: auto; margin-right: auto; }
.has-text-align-center { text-align: center; }

.wp-block-quote { border-left: none; padding-left: 0; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-family: "Work Sans", sans-serif; font-size: 0.82rem; color: var(--ink-faint); text-align: center; }
