/* =====================================================================
   Gwirachau site stylesheet: the Bran the Crow design.
   Load after any legacy CSS. New components use the gw- prefix so they
   never collide with legacy class names (.hero, .btn, .card ...).
   ===================================================================== */

/* ---------- tokens (taken from the Bran logo) ---------- */
:root {
  --night: #0d1424;        /* raven black-blue: header, hero, footer */
  --night-2: #18233d;
  --night-text: #c9d3e8;
  --night-muted: #8b98b5;
  --feather: #2f56a8;      /* raven sheen: links, focus */
  --feather-2: #24438a;
  --sky: #9db8f2;          /* links on night */
  --mist: #f2f4f8;         /* page background (the logo's smoke) */
  --surface: #ffffff;
  --ink: #141a26;
  --ink-muted: #586174;
  --line: #dde2ea;
  --ember: #c8102e;        /* Welsh red: main call to action only */
  --ember-2: #a50d26;
  --gold: #d4b25a;         /* small highlights on night */
  /* one colour per era, for wayfinding */
  --era-medieval: #2f56a8; --era-tudor: #6b3f7a; --era-modern: #2f6b5a; --era-estate: #8a5a2b;
  /* the logo's smoke, as a faint grain on dark panels */
  --mist-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .02' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(13 20 36 / .06), 0 6px 20px rgb(13 20 36 / .06);
  --gutter: 16px;
  --wrap: 1180px;
  color-scheme: light;
}
@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mist: #0b111d; --surface: #141c2e; --ink: #e8ebf2; --ink-muted: #a3acbe; --line: #26314a;
    --feather: #9db8f2; --feather-2: #c3d4fb; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --mist: #0b111d; --surface: #141c2e; --ink: #e8ebf2; --ink-muted: #a3acbe; --line: #26314a;
  --feather: #9db8f2; --feather-2: #c3d4fb; color-scheme: dark;
}

/* ---------- base (applies to every page, legacy ones included) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.gw { margin: 0; }
body {
  background: var(--mist) !important;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  overflow-x: hidden;
}
@media (min-width: 1024px) { body { font-size: 1.0625rem; } }
body.mobile-nav-open { overflow: hidden; }
:focus-visible { outline: 3px solid var(--feather); outline-offset: 2px; }
img { max-width: 100%; height: auto; }

/* New-style pages opt in with <body class="gw"> */
.gw h1, .gw h2, .gw h3, .gw h4 { font-family: var(--serif); font-variation-settings: "SOFT" 70; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .4em; text-wrap: balance; color: inherit; text-shadow: none; }
.gw h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 3.2rem); }
.gw h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); }
.gw h3 { font-size: 1.12rem; }
.gw p { margin: 0 0 .8em; }
.gw a { color: var(--feather); text-underline-offset: .18em; }
.gw a.gw-card, .gw a.gw-card:hover { color: var(--ink); }
.gw a.gw-card .gw-go { color: var(--feather); }
.gw main { display: block; }

.gw-wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.gw-prose { max-width: 68ch; }
.gw-muted { color: var(--ink-muted); }
.gw-kicker { font: 700 .75rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ember); display: block; margin-bottom: 6px; }
.gw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the white spiral ring from the logo, as a running-scroll border */
.gw-scroll-rule { height: 14px; background: var(--night) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 7c4 0 4-5 8-5s4 5 1 5-2-2 0-2M14 7c4 0 4 5 8 5s4-5 1-5-2 2 0 2' fill='none' stroke='%23ffffff' stroke-opacity='.55' stroke-width='1.4'/%3E%3C/svg%3E") repeat-x center; }

/* ---------- buttons ---------- */
.gw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 10px; border: 1px solid transparent; font: 700 1rem/1 var(--sans); text-decoration: none !important; cursor: pointer; transition: background .15s; }
.gw-btn-ember { background: var(--ember); color: #fff !important; }
.gw-btn-ember:hover { background: var(--ember-2); }
.gw-btn-ghost { border-color: rgb(255 255 255 / .35); color: #fff !important; background: transparent; }
.gw-btn-ghost:hover { background: rgb(255 255 255 / .08); }
.gw-btn-quiet { border-color: var(--line); color: var(--ink) !important; background: var(--surface); }
.gw-btn-quiet:hover { border-color: var(--feather); }
.gw-btn-sm { min-height: 40px; padding: 0 16px; font-size: .95rem; }

/* ---------- header ---------- */
#header-placeholder { min-height: 74px; background: var(--night); }
.gw-header { background: var(--night); color: #fff; position: sticky; top: 0; z-index: 900; font-family: var(--sans); }
.gw-header a { text-decoration: none; }
.gw-bar { display: flex; align-items: center; gap: 20px; min-height: 60px; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.gw-brand { display: flex; align-items: center; gap: 8px; color: #fff !important; }
.gw-brand img { width: 46px; height: 46px; margin: -4px 0; }
.gw-brand b { font: 700 1.35rem/1 var(--serif); font-variation-settings: "SOFT" 100; }
.gw-nav { display: none; gap: 2px; align-items: center; margin: 0; padding: 0; list-style: none; }
.gw-nav > li { position: relative; }
.gw-nav a, .gw-nav button { color: #dfe6f5 !important; font: 600 1rem/1 var(--sans); padding: 10px 12px; border-radius: 8px; background: none; border: 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.gw-nav a:hover, .gw-nav button:hover, .gw-nav a[aria-current="page"] { background: rgb(255 255 255 / .08); color: #fff !important; }
.gw-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / .25); padding: 6px; list-style: none; margin: 0; }
.gw-nav li:hover > .gw-menu, .gw-nav li:focus-within > .gw-menu, .gw-nav li.open > .gw-menu { display: block; }
.gw-menu a { display: block !important; color: var(--ink) !important; padding: 10px 12px; border-radius: 8px; }
.gw-menu a:hover { background: var(--mist) !important; color: var(--ink) !important; }
.gw-menu small { display: block; color: var(--ink-muted); font-weight: 400; font-size: .85rem; margin-top: 3px; }
.gw-bar-end { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.gw-lang { display: inline-flex; border: 1px solid rgb(255 255 255 / .25); border-radius: 999px; padding: 2px; }
.gw-lang .lang-btn, .gw-lang .mobile-lang-btn { border: 0; background: none; color: #c9d3e8; font: 700 .8rem/1 var(--sans); padding: 8px 11px; border-radius: 999px; cursor: pointer; min-height: 32px; box-shadow: none; }
.gw-lang .active { background: #fff !important; color: var(--night) !important; }
.gw-auth { display: none; align-items: center; gap: 12px; }
.gw-auth a.gw-signin { color: #dfe6f5; font-weight: 600; }
.gw-auth a.gw-signin:hover { color: #fff; }
.gw-user { display: none; align-items: center; gap: 8px; }
.gw-user a { color: #fff; font-weight: 600; padding: 8px 10px; border-radius: 8px; }
.gw-user a:hover { background: rgb(255 255 255 / .08); }
.gw-icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgb(255 255 255 / .2); background: transparent; color: #fff; font-size: 1.15rem; cursor: pointer; display: inline-grid; place-items: center; }
@media (min-width: 1000px) {
  .gw-nav { display: flex; }
  .gw-auth { display: flex; }
  .gw-header .gw-menu-toggle { display: none; }
}

/* Shield the shared header/footer from legacy global rules (header {…}, nav ul {…},
   footer {…}, and the old "hide every header img on phones" rule). */
header.gw-header { background: var(--night) !important; padding: 0 !important; margin: 0 !important; min-height: 0 !important; border: 0 !important; box-shadow: none !important; position: sticky !important; text-align: left; }
header.gw-header::before, header.gw-header::after, footer.gw-footer::before, footer.gw-footer::after { content: none !important; display: none !important; }
header.gw-header .gw-brand img, .gw-mobile-nav .gw-brand img, footer.gw-footer .gw-brand img { display: block !important; visibility: visible !important; opacity: 1 !important; position: static !important; width: 46px !important; height: 46px !important; }
.gw-header ul, .gw-mobile-nav ul, .gw-footer ul { list-style: none; margin: 0; padding: 0; }
.gw-header .gw-btn { display: inline-flex !important; align-items: center !important; line-height: 1 !important; padding: 0 16px !important; min-height: 40px; }
footer.gw-footer { background: var(--night) !important; color: var(--night-text) !important; text-align: left !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; }
footer.gw-footer h3 { color: var(--night-muted) !important; }

/* mobile panel */
.gw-mobile-nav { position: fixed; inset: 0; z-index: 1000; background: rgb(5 9 18 / .55); display: none; }
.gw-mobile-nav.active { display: block; }
.gw-mobile-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(88vw, 360px); background: var(--night); color: #fff; overflow-y: auto; padding: 14px 18px 32px; font-family: var(--sans); }
.gw-mobile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gw-mobile-panel ul { list-style: none; margin: 0; padding: 0; }
.gw-mobile-panel li a { display: flex; align-items: center; min-height: 48px; color: #fff; font-weight: 600; font-size: 1.05rem; border-bottom: 1px solid rgb(255 255 255 / .08); text-decoration: none; }
.gw-mobile-panel li a small { color: var(--night-muted); font-weight: 400; margin-left: 8px; font-size: .85rem; }
.gw-mobile-panel h3 { font: 700 .72rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--night-muted); margin: 22px 0 6px; }
.gw-mobile-panel .gw-lang { margin-top: 8px; }
.gw-mobile-panel .gw-btn { width: 100%; margin-top: 18px; }

/* ---------- page header band (inner pages) ---------- */
.gw-page-head { background: radial-gradient(700px 300px at 85% 0%, rgb(255 255 255 / .07), transparent 70%), var(--night); color: #fff; padding: 28px 0 32px; }
.gw-page-head h1 { color: #fff; margin-bottom: .2em; }
.gw-page-head p { color: var(--night-text); font-size: 1.1rem; max-width: 40em; margin: 0; }
.gw-page-head .gw-kicker { color: var(--gold); }
.gw-crumbs { font-size: .9rem; margin-bottom: 10px; }
.gw-crumbs a { color: var(--sky) !important; }

/* ---------- sections + cards ---------- */
.gw-section { padding: 40px 0 8px; }
.gw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.gw-head h2 { margin: 0; }
.gw-head > a { font-weight: 700; white-space: nowrap; text-decoration: none; }
.gw-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gw-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .gw-grid.gw-3 { grid-template-columns: repeat(3, 1fr); } .gw-grid.gw-4 { grid-template-columns: repeat(4, 1fr); } }
.gw-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; color: var(--ink); display: flex; flex-direction: column; text-decoration: none !important; transition: transform .15s, border-color .15s; }
a.gw-card:hover { transform: translateY(-2px); border-color: var(--feather); }
.gw-card h3 { margin: 0 0 6px; color: var(--ink); }
.gw-card p { color: var(--ink-muted); margin: 0; font-size: .97rem; }
.gw-card .gw-go { margin-top: auto; padding-top: 12px; color: var(--feather); font-weight: 700; }
.gw-card-dark { background: var(--night); border-color: var(--night); color: #fff; }
.gw-card-dark h3, .gw-card-dark h2 { color: #fff; }
.gw-card-dark p { color: var(--night-text); }
.gw-card-dark .gw-kicker { color: var(--gold); }
.gw-tag { display: inline-block; align-self: flex-start; font: 700 .7rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--feather) 12%, transparent); color: var(--feather); margin-top: 10px; }
.gw-icon { width: 30px; height: 30px; color: var(--feather); margin-bottom: 10px; }

/* person card */
.gw-person { display: grid; grid-template-columns: 64px 1fr; gap: 14px; }
.gw-crest { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font: 700 1.3rem/1 var(--serif); color: #fff; background: var(--night-2); box-shadow: inset 0 0 0 3px rgb(255 255 255 / .9), 0 0 0 2px var(--night-2); overflow: hidden; }
.gw-crest img { width: 100%; height: 100%; object-fit: cover; }
.gw-years { color: var(--ink-muted); font-size: .88rem; display: block; margin-bottom: 6px; }
.gw-swipe { display: grid; grid-auto-flow: column; grid-auto-columns: 80%; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px var(--gutter) 14px; margin: 0 calc(var(--gutter) * -1); }
.gw-swipe > * { scroll-snap-align: start; }
@media (min-width: 640px) { .gw-swipe { grid-auto-columns: 44%; } }
@media (min-width: 980px) { .gw-swipe { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); overflow: visible; margin: 0; padding: 4px 0 0; } }

/* place card */
.gw-place { padding: 0; overflow: hidden; }
.gw-place .gw-band { height: 80px; background: linear-gradient(135deg, var(--night-2), #33508f); color: #fff; padding: 12px 16px; display: flex; align-items: end; font: 700 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.gw-place .gw-body { padding: 14px 16px 16px; }

/* ---------- ad slots ---------- */
.gw-ad { display: block; text-align: center; margin: 20px auto; max-width: 970px; min-height: 100px; }
.gw-ad::before { content: "Advertisement"; display: block; font: 600 .68rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 6px; }
html[lang="cy"] .gw-ad::before { content: "Hysbyseb"; }
@media (max-width: 639px) { .gw-ad { min-height: 260px; } }
.gw-ad[data-ad="in-feed"] { margin: 0; min-height: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.gw-ad.gw-ad-empty, .gw-ad:has(ins[data-ad-status="unfilled"]) { display: none !important; }
/* local copies only: show where each ad will go */
.gw-ad-dev::after { content: "AdSense · " attr(data-ad-name); display: grid; place-items: center; min-height: inherit; height: calc(100% - 16px); border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-muted); font: 400 .8rem/1 var(--sans); background: repeating-linear-gradient(45deg, transparent 0 10px, rgb(127 127 127 / .05) 10px 20px); }
.gw-ad-dev { min-height: 100px; }
.gw-ad-dev::after { min-height: 90px; }
@media (max-width: 639px) { .gw-ad-dev::after { min-height: 250px; } }

/* ---------- forms ---------- */
.gw input[type=text], .gw input[type=search], .gw input[type=email], .gw input[type=number], .gw select, .gw textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 48px; }
.gw input:focus, .gw select:focus, .gw textarea:focus { outline: 3px solid color-mix(in srgb, var(--feather) 35%, transparent); border-color: var(--feather); }

/* ---------- footer ---------- */
.gw-footer { background: var(--night); color: var(--night-text); margin-top: 48px; font: 400 .95rem/1.55 var(--sans); }
.gw-footer .gw-wrap { padding-top: 32px; padding-bottom: 24px; }
.gw-fgrid { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
@media (min-width: 980px) { .gw-fgrid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.gw-fgrid .gw-fabout { grid-column: 1 / -1; }
@media (min-width: 980px) { .gw-fgrid .gw-fabout { grid-column: auto; } }
.gw-footer h3 { font: 700 .75rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--night-muted); margin: 0 0 12px; text-shadow: none; }
.gw-footer ul { list-style: none; margin: 0; padding: 0; }
.gw-footer li { margin-bottom: 8px; }
.gw-footer a { color: #fff !important; text-decoration: none; }
.gw-footer a:hover { text-decoration: underline; }
.gw-footer p { color: var(--night-text); }
.gw-legal { border-top: 1px solid rgb(255 255 255 / .12); margin-top: 24px; padding-top: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--night-muted); font-size: .85rem; }

/* ---------- notices ---------- */
.gw-notice { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--feather); border-radius: 10px; padding: 16px 18px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* =====================================================================
   Signature pieces (what makes it Gwirachau rather than a template)
   ===================================================================== */

/* the logo's mist as grain on dark surfaces */
.gw-night, .gw-page-head, .gw-card-dark { position: relative; isolation: isolate; }
.gw-night { background-color: var(--night); color: #fff; }
.gw-night::before, .gw-page-head::before, .gw-card-dark::before, .gw-footer > .gw-wrap::before {
  content: ""; position: absolute; inset: 0; background: var(--mist-grain); opacity: .09; z-index: -1; pointer-events: none; }
.gw-footer > .gw-wrap { position: relative; isolation: isolate; }

/* Welsh signpost word above a heading, in both language modes */
.gw-signpost { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font: italic 600 1.15rem/1 var(--serif); font-variation-settings: "SOFT" 100; color: var(--ember); margin-bottom: 6px; }
.gw-signpost::before { content: ""; width: 22px; height: 11px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 14'%3E%3Cpath d='M0 7c4 0 4-5 8-5s4 5 1 5-2-2 0-2M14 7c4 0 4 5 8 5s4-5 1-5-2 2 0 2' fill='none' stroke='%23c8102e' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat center / contain; }
.gw-signpost small { font: 600 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); font-style: normal; }
html[lang="cy"] .gw-signpost small { display: none; }
.gw-night .gw-signpost, .gw-card-dark .gw-signpost, .gw-page-head .gw-signpost { color: var(--gold); }
.gw-night .gw-signpost::before, .gw-card-dark .gw-signpost::before, .gw-page-head .gw-signpost::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 14'%3E%3Cpath d='M0 7c4 0 4-5 8-5s4 5 1 5-2-2 0-2M14 7c4 0 4 5 8 5s4-5 1-5-2 2 0 2' fill='none' stroke='%23d4b25a' stroke-width='1.8'/%3E%3C/svg%3E"); }
.gw-night .gw-signpost small, .gw-card-dark .gw-signpost small, .gw-page-head .gw-signpost small { color: var(--night-muted); }

/* the patronymic chain: Madog ap Maredudd ap Bleddyn ... */
.gw-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; list-style: none; margin: 0; padding: 0; }
.gw-chain li { display: contents; }
.gw-chain a, .gw-chain b { font: 650 1.05rem/1 var(--serif); font-variation-settings: "SOFT" 100; color: #fff !important; text-decoration: none; padding: 9px 14px; border-radius: 999px; border: 1px solid rgb(255 255 255 / .28); background: rgb(255 255 255 / .04); }
.gw-chain a:hover { border-color: var(--gold); }
.gw-chain .gw-ap { font: italic 600 1rem/1 var(--serif); color: var(--gold); }
.gw-chain-light a, .gw-chain-light b { color: var(--ink) !important; border-color: var(--line); background: var(--surface); }
.gw-chain-light .gw-ap { color: var(--ember); }

/* crests framed by Bran's beaded white ring */
.gw-crest { width: 72px; height: 72px; font: 700 1.4rem/1 var(--serif); font-variation-settings: "SOFT" 100; background: radial-gradient(circle at 50% 35%, #2a3b63, var(--night)); position: relative; box-shadow: 0 0 0 2px var(--night); }
.gw-crest::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 2px dotted rgb(255 255 255 / .85); pointer-events: none; }
.gw-person { grid-template-columns: 72px 1fr; gap: 16px; }

/* "Gair i gall": a word from Bran */
.gw-tip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.gw-tip-who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gw-tip-who img { width: 54px; height: 54px; border-radius: 50%; background: var(--night); }
.gw-tip-who .gw-signpost { margin: 0; }
.gw-tip-big { font: 700 1.45rem/1.25 var(--serif); font-variation-settings: "SOFT" 70; margin: 6px 0 10px; }
.gw-tip-big em { color: var(--ember); font-style: italic; }

/* place cards with a small landscape scene */
.gw-scene { height: 96px; position: relative; color: #fff; padding: 12px 16px; background: linear-gradient(180deg, var(--sky-top, #33508f), var(--sky-bot, #18233d)); font: 700 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.gw-scene svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 64px; }
.gw-scene span { position: relative; opacity: .9; }

/* record tiles, colour-coded by era */
.gw-rec { --era: var(--era-medieval); border-top: 4px solid var(--era); }
.gw-rec:hover { border-color: var(--era); }
.gw-rec .gw-icon { color: var(--era); }
.gw-rec b { font: 650 1.05rem/1.2 var(--serif); }
.gw-era-medieval { --era: var(--era-medieval); } .gw-era-tudor { --era: var(--era-tudor); }
.gw-era-modern { --era: var(--era-modern); } .gw-era-estate { --era: var(--era-estate); }
.gw-tag[class*="gw-era-"] { background: color-mix(in srgb, var(--era) 12%, transparent); color: var(--era); }

/* =====================================================================
   Shape language: shapes from Wales, not template rounded boxes
   - chapel arch   (.gw-arch)   people: the arched window of a Welsh capel
   - cut slate     (.gw-slate)  places, records, dark panels, buttons
   - ribbon        (.gw-tag)    heraldic swallowtail banners
   - Bran speaks   (.gw-tip)    a speech bubble from the raven
   ===================================================================== */
:root { --cut: 14px; }
.gw-slate-shape, .gw-slate, .gw-card-dark, .gw-btn, .home-search, .gw-ad[data-ad="in-feed"] {
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  border-radius: 0 !important;
}

/* cut slate card with a real 1px edge that follows the bevel */
.gw-slate { --edge: var(--line); --edge-top: var(--edge); --top: 1px;
  position: relative; isolation: isolate; border: 0 !important; box-shadow: none !important;
  background: linear-gradient(var(--edge-top) 0 var(--top), var(--edge) 0) !important; }
.gw-slate::before { content: ""; position: absolute; inset: var(--top) 1px 1px 1px; z-index: -1; background: var(--surface);
  clip-path: polygon(calc(var(--cut) - 1px) 0, calc(100% - var(--cut) + 1px) 0, 100% calc(var(--cut) - 1px), 100% calc(100% - var(--cut) + 1px), calc(100% - var(--cut) + 1px) 100%, calc(var(--cut) - 1px) 100%, 0 calc(100% - var(--cut) + 1px), 0 calc(var(--cut) - 1px)); }
a.gw-slate:hover { --edge: var(--feather); }
.gw-slate.gw-rec { --top: 5px; --edge-top: var(--era); }
.gw-slate.gw-rec:hover { --edge: var(--era); }
.gw-slate.gw-place .gw-scene { margin: 0; }

/* slate tablets: dark panels get the logo's running scroll along the top */
.gw-card-dark { --cut: 18px; background: var(--night) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 7c4 0 4-5 8-5s4 5 1 5-2-2 0-2M14 7c4 0 4 5 8 5s4-5 1-5-2 2 0 2' fill='none' stroke='%23d4b25a' stroke-opacity='.7' stroke-width='1.4'/%3E%3C/svg%3E") repeat-x 0 8px / 28px 14px !important; padding-top: 34px !important; }

/* buttons: small bevel */
.gw-btn { --cut: 7px; }
.gw-btn-ghost, .gw-btn-quiet { box-shadow: inset 0 0 0 1px currentColor; border: 0 !important; }
.gw-btn-ghost { box-shadow: inset 0 0 0 1px rgb(255 255 255 / .45); }
.gw-btn-quiet { box-shadow: inset 0 0 0 1px var(--line); }

/* chapel arch: people cards, crest set in the arch */
.gw-arch { border-radius: 50% 50% 12px 12px / 96px 96px 12px 12px !important; padding: 26px 20px 20px !important; text-align: center;
  grid-template-columns: 1fr !important; justify-items: center; align-content: start;
  box-shadow: var(--shadow), inset 0 0 0 5px var(--surface), inset 0 0 0 6px color-mix(in srgb, var(--gold) 55%, var(--line)) !important; }
.gw-arch .gw-crest { width: 84px; height: 84px; margin-bottom: 4px; }
.gw-arch .gw-tag { align-self: center; }
a.gw-arch:hover { border-color: var(--gold) !important; }

/* heraldic ribbon tags (swallowtail end) */
.gw-tag { border-radius: 0 !important; padding: 5px 16px 5px 10px !important; clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%); }

/* Bran speaks: tip box as a speech bubble from the raven */
.gw-tip { position: relative; border-radius: 22px !important; }
.gw-tip-who { position: relative; }
.gw-tip-who img { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--night); }
.gw-tip-big { position: relative; background: color-mix(in srgb, var(--feather) 7%, var(--surface)); border-radius: 18px; padding: 14px 16px; margin-top: 14px !important; }
.gw-tip-big::before { content: ""; position: absolute; left: 22px; top: -11px; width: 22px; height: 12px; background: inherit; clip-path: polygon(0 100%, 30% 0, 100% 100%); }

/* =====================================================================
   Inner-page building blocks
   ===================================================================== */
.gw-page-head { padding: 26px 0 30px; }
.gw-page-head .gw-wrap { position: relative; }
.gw-page-head h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem); font-weight: 800; }
.gw-page-head .gw-lead-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.gw-page-head + .gw-scroll-rule { margin-top: -1px; }

/* short prose: keep it to a few paragraphs, then cards */
.gw-prose { max-width: 68ch; }
.gw-prose h2 { margin-top: 1.4em; }
.gw-prose h3 { margin-top: 1.2em; }
.gw-prose ul, .gw-prose ol { padding-left: 1.2em; margin: 0 0 1em; }
.gw-prose li { margin-bottom: .35em; }
.gw-prose blockquote { margin: 1em 0; padding: 12px 18px; border-left: 4px solid var(--gold); background: var(--surface); font: italic 600 1.15rem/1.4 var(--serif); }

/* key facts row (dates, places, counts) */
.gw-facts { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 14px 0; padding: 0; list-style: none; }
.gw-facts li { border-left: 2px solid var(--gold); padding-left: 10px; }
.gw-facts b { display: block; font: 650 1.1rem/1.2 var(--serif); }
.gw-facts span { color: var(--ink-muted); font-size: .85rem; }
.gw-night .gw-facts span, .gw-page-head .gw-facts span { color: var(--night-muted); }

/* fold-out sections for long help, legal and guide pages */
.gw-fold { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.gw-fold > summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 18px; font: 650 1.08rem/1.3 var(--serif); position: relative; }
.gw-fold > summary::-webkit-details-marker { display: none; }
.gw-fold > summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font: 600 1.4rem/1 var(--sans); color: var(--feather); }
.gw-fold[open] > summary::after { content: "–"; }
.gw-fold > div { padding: 0 18px 16px; }
.gw-fold > div > :last-child { margin-bottom: 0; }

/* numbered steps */
.gw-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 12px; }
.gw-steps > li { counter-increment: step; position: relative; padding: 14px 16px 14px 62px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.gw-steps > li::before { content: counter(step); position: absolute; left: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--night); color: #fff; font: 700 1rem/1 var(--serif); box-shadow: inset 0 0 0 2px var(--night), inset 0 0 0 3px rgb(255 255 255 / .7); }
.gw-steps b { display: block; margin-bottom: 2px; }

/* data tables */
.gw-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.gw-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.gw-table th, .gw-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.gw-table th { font: 700 .75rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); background: var(--mist); }
.gw-table tr:last-child td { border-bottom: 0; }

/* filters / search inside a page */
.gw-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.gw-toolbar > input, .gw-toolbar > select { flex: 1 1 220px; }

/* form panels (contact, login, profile) */
.gw-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.gw-field { display: grid; gap: 6px; margin-bottom: 14px; }
.gw-field label { font-weight: 600; }
.gw-field .gw-hint { font-size: .85rem; color: var(--ink-muted); }
.gw input, .gw select, .gw textarea { width: 100%; }

/* small helpers */
.gw-two { display: grid; gap: 24px; }
@media (min-width: 980px) { .gw-two { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.gw-aside { position: sticky; top: 96px; display: grid; gap: 14px; }
.gw-center { text-align: center; }
.gw-stack > * + * { margin-top: 14px; }

/* ---------- shared helpers (from the page restyles) ---------- */
.gw-list { margin: 8px 0 0; padding-left: 1.1em; }
.gw-list li { margin-bottom: .3em; }
.gw-list li::marker { color: var(--gold); }
.gw-fold h3, .gw-subhead { font: 700 .78rem/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin: 1.1em 0 .4em; }
.gw-tag.gw-tag-ember { background: color-mix(in srgb, var(--ember) 12%, transparent); color: var(--ember); }
.gw-card-dark { padding: 34px 24px 24px; }
.gw-card-dark h2, .gw-card-dark h3, .gw-card-dark b, .gw-night h2, .gw-night h3 { color: #fff; }
.gw-card-dark a:not(.gw-btn), .gw-night a:not(.gw-btn) { color: var(--sky); }
.gw-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.gw-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gw-chip, .filter-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 .9rem/1 var(--sans); text-decoration: none; cursor: pointer; }
.gw-chip:hover, .filter-btn:hover { border-color: var(--feather); }
.gw-chip[aria-pressed="true"], .gw-chip.active, .filter-btn.active { background: var(--night); border-color: var(--night); color: #fff; }
.gw-night .gw-chip { background: transparent; color: #fff; border-color: rgb(255 255 255 / .28); }
@media (max-width: 639px) { body > .gw-ad, main > .gw-ad { margin-inline: var(--gutter); } }

/* outlined buttons: square slate corners (a bevel would clip the outline) */
.gw-btn.gw-btn-quiet, .gw-btn.gw-btn-ghost { clip-path: none; border-radius: 2px !important; }
/* coats of arms inside a round crest: show the whole shield, not a crop */
.gw-crest.gw-crest-arms img { object-fit: contain; padding: 13px 17px 11px; border-radius: 0; }
/* long section titles next to a "See all" link: stack on phones */
@media (max-width: 639px) { .gw-head { flex-wrap: wrap; } .gw-head > a { white-space: normal; } }

/* =====================================================================
   Ad holder: a framed panel in the site's style, clearly marked as an ad.
   Gold corner brackets, the logo's spiral along the top, and a ribbon label
   in both languages. Neutral label only (AdSense: never invite clicks, never
   make ads look like site content).
   ===================================================================== */
.gw-ad {
  --b: var(--gold); --len: 22px;
  position: relative; display: block; max-width: 1000px; min-height: 0; margin: 28px auto; padding: 38px 16px 16px; text-align: center;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--b), var(--b)) top left / var(--len) 2px no-repeat,
    linear-gradient(var(--b), var(--b)) top left / 2px var(--len) no-repeat,
    linear-gradient(var(--b), var(--b)) top right / var(--len) 2px no-repeat,
    linear-gradient(var(--b), var(--b)) top right / 2px var(--len) no-repeat,
    linear-gradient(var(--b), var(--b)) bottom left / var(--len) 2px no-repeat,
    linear-gradient(var(--b), var(--b)) bottom left / 2px var(--len) no-repeat,
    linear-gradient(var(--b), var(--b)) bottom right / var(--len) 2px no-repeat,
    linear-gradient(var(--b), var(--b)) bottom right / 2px var(--len) no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 7c4 0 4-5 8-5s4 5 1 5-2-2 0-2M14 7c4 0 4 5 8 5s4-5 1-5-2 2 0 2' fill='none' stroke='%23c9a227' stroke-opacity='.45' stroke-width='1.3'/%3E%3C/svg%3E") repeat-x 0 12px / 28px 14px,
    var(--surface);
}
.gw-ad::before, html[lang="cy"] .gw-ad::before {
  content: "Hysbyseb · Advertisement"; position: absolute; top: 9px; left: 16px; margin: 0;
  font: 700 .66rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted);
  background: var(--surface); padding: 5px 16px 5px 10px; border: 1px solid var(--line);
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%);
}
.gw-ad > ins { display: block; margin: 0 auto; }
.gw-ad[data-ad="in-feed"] { margin: 0; max-width: none; height: 100%; min-height: 280px; border-radius: 0 !important; clip-path: none; padding-top: 38px; }
@media (max-width: 639px) { .gw-ad { padding-inline: 10px; } }
/* local placeholder inside the holder */
.gw-ad-dev::after { margin-top: 2px; border-radius: 0; min-height: 90px; }
.gw-ad-dev[data-ad="in-feed"]::after { min-height: 220px; }
@media (max-width: 639px) { .gw-ad-dev::after { min-height: 250px; } }
/* shields on dark panels: a light halo so Sable fields don't vanish into the night */
.gw-night img[src*="/images/arms/"], .gw-card-dark img[src*="/images/arms/"], .gw-page-head img[src*="/images/arms/"] { filter: drop-shadow(0 0 1.5px rgb(255 255 255 / .7)); }
.gw-crest.gw-crest-arms { background: radial-gradient(circle at 50% 35%, #2a3b63, var(--night)); }
.gw-crest.gw-crest-arms img { filter: drop-shadow(0 0 1.5px rgb(255 255 255 / .6)); }
/* form fixes from the app-page restyle */
.gw input[type=checkbox], .gw input[type=radio] { width: auto; min-height: 0; }
.gw input[type=date], .gw input[type=password], .gw input[type=url], .gw input[type=tel] {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 48px; }
.gw-crumbs a { color: var(--feather) !important; }
.gw-page-head .gw-crumbs a, .gw-night .gw-crumbs a { color: var(--sky) !important; }

/* =====================================================================
   Ads must never be wider than their box (2026-11-07)
   AdSense can set a fixed pixel width on the <ins> and its iframe; cap both
   at the container so a 412px ad can't widen a 360px phone screen.
   ===================================================================== */
.gw-ad { width: 100%; overflow: hidden; }
.gw-ad > ins, ins.adsbygoogle, ins.adsbygoogle > *, ins.adsbygoogle iframe, .gw-ad iframe {
  max-width: 100% !important;
}
/* Safety net: nothing may make the page scroll sideways on phones.
   `clip` works where `overflow-x: hidden` on body is ignored by mobile browsers. */
@supports (overflow: clip) { html, body { overflow-x: clip; } }   /* older browsers keep body{overflow-x:hidden} above */
/* The header is injected into #header-placeholder; let it stick to the page, not to that wrapper. */
#header-placeholder { display: contents; }
/* Ad boxes size to their ad: the in-feed box no longer stretches to the card row
   height (a taller ad then spilled over the next card). Phone ads are a fixed 300x250. */
.gw-ad[data-ad="in-feed"] { height: auto; align-self: start; }
@media (max-width: 639px) {
  .gw-ad { min-height: 0; }
  .gw-ad > ins.adsbygoogle { margin: 0 auto; }
}
