/*
Theme Name: Roundel
Description: One theme for Paul's sites. Category blocks on the front page, a category menu, no comments. Accent colour, fonts, logo and favicon are set per site in inc/sites.php.
Author: Paul
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: roundel
*/

:root {
  --ink: #16161a;
  --paper: #fbfbf9;
  --card: #ffffff;
  --line: #e4e4e0;
  --dim: #666662;
  --accent: #c0392b;
  --accent-dark: #962d22;
  --tint: color-mix(in srgb, var(--accent) 8%, white);
  --font-head: 'Josefin Sans', system-ui, sans-serif;
  --font-body: 'Rubik', system-ui, sans-serif;
  --thumb-ratio: 16 / 9;
  --max: 1200px;
  --radius: 6px;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1.2em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 8px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.site-main { padding: 36px 0 64px; min-height: 50vh; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--card); }
.site-head .wrap { display: flex; align-items: center; gap: 28px; min-height: 72px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand img { height: 38px; width: 38px; display: block; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.01em; line-height: 1; }

.main-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.main-nav a {
  color: var(--ink); font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 8px 12px; border-radius: var(--radius);
}
.main-nav a:hover { background: var(--tint); text-decoration: none; }
.main-nav a.active { color: var(--accent); }

.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; font: inherit; color: var(--ink); cursor: pointer; }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; padding-bottom: 12px; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 10px 12px; }
}

/* hero (only when a site sets one) */
.hero { max-width: 820px; padding: 8px 0 12px; margin-bottom: 40px; }
.hero p { font-size: 1.1rem; }

/* sections and grids */
.section { margin: 56px 0 0; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; gap: 16px; border-bottom: 3px solid var(--accent); padding-bottom: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; }
.section-head h2 a { color: var(--ink); }
.section-head h2 a:hover { color: var(--accent); text-decoration: none; }
.section-head .more { margin-left: auto; font-size: 0.92rem; font-weight: 500; white-space: nowrap; }

.grid { display: grid; gap: 22px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1020px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .eyebrow { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.card h3 { margin: 0; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card .excerpt { font-size: 0.92rem; color: var(--dim); margin: 0; }
.card .thumb { display: block; margin: -16px -16px 6px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; aspect-ratio: var(--thumb-ratio); background: var(--tint); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb.placeholder { display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 3rem; font-weight: 700; color: var(--accent); }
.card .thumb.placeholder:hover { text-decoration: none; }

.term-intro { max-width: 820px; margin-bottom: 28px; font-size: 1.05rem; color: var(--dim); }

.pagination { display: flex; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--card); }
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { border-color: var(--accent); text-decoration: none; }

/* single post and page */
.single-post-head, .entry-content, .post-nav { max-width: 760px; }
.single-post-head { margin-bottom: 28px; }
.breadcrumbs { font-size: 0.85rem; color: var(--dim); margin-bottom: 14px; }
.breadcrumbs a { color: var(--dim); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 6px; }
.meta-line { font-size: 0.88rem; color: var(--dim); margin: 0; }

.entry-content img { border-radius: var(--radius); }
.entry-content figure { margin: 0 0 1.4em; }
.entry-content blockquote { border-left: 3px solid var(--accent); margin: 1.2em 0; padding: 0.2em 0 0.2em 1.2em; color: var(--dim); }
.entry-content iframe { max-width: 100%; border: 0; }
.entry-content .wp-block-embed__wrapper, .entry-content .wp-has-aspect-ratio { position: relative; }

.post-nav { display: flex; justify-content: space-between; gap: 20px; margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.post-nav a { font-size: 0.95rem; max-width: 48%; }
.post-nav .next { margin-left: auto; text-align: right; }
.post-nav .dir { display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--card); padding: 28px 0; font-size: 0.9rem; color: var(--dim); }
.foot-links { display: flex; gap: 20px; margin-bottom: 10px; }
.foot-links a { color: var(--dim); }
.foot-links a:hover { color: var(--accent); }
.site-foot .legal { margin: 0; }

.error-404 { text-align: center; padding: 80px 0; }
.error-404 .big { font-family: var(--font-head); font-size: 5rem; font-weight: 700; color: var(--accent); line-height: 1; }
