/* thinknuts.net, Design D "Shwmae": Dyfiant's navy, steel blue and teal, Josefin Sans headings over
   Inter Tight, Welsh mountains drawn as Dyfiant's triangles, and a thin rainbow stripe across the top. */
:root {
  --navy: #1d426c;
  --navy-dark: #122a45;
  --navy-tile: #24507f;
  --steel: #67aec8;
  --sky: #a8d4e4;
  --teal: #7fd6c2;
  --green: #3f7a5a;
  --slate: #4e6b7e;
  --ground: #f4f6f3;
  --ink: #17222c;
  --muted: #3e5670;
  --quiet: #5b6f82;
  --on-navy: #d5e3ee;
  --line: #d5e0e8;
  --heading-font: "Josefin Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  display: flex; flex-direction: column; min-height: 100vh; margin: 0;
  background: var(--ground); color: var(--ink); font-family: "Inter Tight", system-ui, sans-serif; font-size: 17px; line-height: 1.6;
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; }
a { color: var(--navy); }
a:hover { color: var(--navy-dark); }
h1, h2, h3 { font-family: var(--heading-font); font-weight: 700; line-height: 1.1; margin: 0; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 820px; }
@media (min-width: 720px) { .container { padding: 0 32px; } }

.button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 20px; border: 2px solid var(--teal);
  background: var(--teal); color: #102a40; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button:hover { background: #fff; border-color: #fff; color: #102a40; }
.button-outline { background: transparent; border-color: var(--sky); color: #fff; }

.rainbow { height: 6px; background: linear-gradient(90deg, #e40303 0 16.67%, #ff8c00 0 33.33%, #ffed00 0 50%, #008026 0 66.67%, #004dff 0 83.33%, #750787 0); }

/* The navy band at the top of every page, with the mountains along its foot. */
.masthead { position: relative; overflow: hidden; background: var(--navy); color: #fff; }
.mountains { position: absolute; inset: 0; width: 100%; height: 100%; }
.masthead > .container { position: relative; }
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; padding-bottom: 24px; }
.site-name { color: #fff; font-family: var(--heading-font); font-size: 22px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; text-decoration: none; }
.site-name:hover { color: var(--sky); }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.site-header ul { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0; padding: 0; list-style: none; }
.site-header nav a { display: inline-block; padding: 8px 0; color: #fff; font-size: 16px; font-weight: 600; text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--teal); }
.language-switch { display: flex; border: 1px solid var(--sky); border-radius: 999px; overflow: hidden; }
.language-switch button { min-height: 40px; padding: 8px 14px; border: 0; background: transparent; color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.language-switch button:hover { background: var(--navy-tile); }
.language-switch button[aria-current] { background: var(--sky); color: #102a40; }

.page-title { display: flex; flex-direction: column; gap: 16px; padding-top: 40px; padding-bottom: 88px; }
.page-title h1 { font-size: clamp(40px, 6vw, 72px); letter-spacing: -1px; }
.lede { margin: 0; max-width: 680px; color: var(--on-navy); font-size: clamp(18px, 2vw, 22px); line-height: 1.5; }
.masthead .post-meta, .masthead .post-meta a { color: var(--teal); }
.masthead .page-title h1[lang] { font-size: clamp(36px, 5vw, 60px); line-height: 1.05; }
.breadcrumb, .breadcrumb a { color: var(--on-navy); font-size: 15px; }

/* Home hero */
.hero { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; padding-top: 72px; padding-bottom: 200px; }
.hero-text { flex: 999 1 560px; display: flex; flex-direction: column; gap: 24px; }
.greeting { margin: 0; color: var(--sky); font-family: "Fraunces", Georgia, serif; font-style: italic; font-size: 32px; }
.hero h1 { font-size: clamp(48px, 7vw, 88px); line-height: 0.95; letter-spacing: -2px; }
.portrait { flex: 1 1 260px; max-width: 360px; object-fit: cover; clip-path: polygon(0 0, 100% 0, 100% 85%, 85% 100%, 0 100%); }

/* Theme colours, used by the theme cards and by post cards and meta lines. */
.cat-technoleg { --cat: var(--navy); --tint: #dcebf2; }
.cat-canu { --cat: #2e7f95; --tint: #e3f4ef; }
.cat-gardd { --cat: var(--green); --tint: #e6efdf; }
.cat-seiri-rhyddion { --cat: var(--slate); --tint: #e3eef4; }
.image-placeholder { display: block; aspect-ratio: 16 / 10; background: var(--tint, #dcebf2); }

.themes { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: -96px; }
.theme-card { display: flex; flex-direction: column; background: #fff; text-decoration: none; box-shadow: 0 12px 32px rgba(23, 34, 44, 0.12); }
.theme-card img, .theme-card .image-placeholder { display: block; width: 100%; height: 150px; object-fit: cover; aspect-ratio: auto; }
.theme-text { display: flex; flex-direction: column; gap: 4px; padding: 20px; color: var(--muted); font-size: 15px; }
.theme-name { color: var(--navy); font-family: var(--heading-font); font-size: 26px; font-weight: 700; }
.theme-card:hover .theme-name { text-decoration: underline; }

.section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-heading h2 { font-size: clamp(36px, 5vw, 52px); letter-spacing: -1px; color: var(--navy); }
.section-heading h2 span { font-weight: 400; color: var(--slate); }
.section-heading > a { font-weight: 600; }
.latest { display: flex; flex-direction: column; gap: 28px; padding-top: 88px; padding-bottom: 72px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; }
.post-card { display: flex; flex-direction: column; gap: 12px; }
.post-card img, .post-card .image-placeholder { display: block; width: 100%; height: 240px; object-fit: cover; aspect-ratio: auto; }
.post-card h3 { font-size: 28px; }
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a:hover { text-decoration: underline; }
.post-card p:last-child { margin: 0; color: var(--muted); }
.post-meta { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--cat, var(--muted)); }
.post-meta a { color: inherit; }
.pinned { padding: 2px 8px; background: var(--sky); color: #102a40; font-family: "Inter Tight", sans-serif; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; vertical-align: middle; }

/* Posts and plain pages */
.page-body { padding-top: 48px; padding-bottom: 96px; }
.prose { font-size: 19px; line-height: 1.75; }
.prose h2 { margin: 1.5em 0 0.5em; font-size: 32px; color: var(--navy); }
.prose h3 { margin: 1.3em 0 0.4em; font-size: 24px; }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--steel); color: var(--muted); }
.prose img { display: block; margin: 1em 0; }
.figure { margin: 1.5em 0; }
.figure img { max-width: 100%; height: auto; margin: 0; }
.figure figcaption { margin-top: 8px; color: var(--muted); font-size: 15px; }
.credit { display: block; color: var(--quiet); font-size: 13px; }
.credit a { color: inherit; }
.image-credit { margin: -0.5em 0 1em; }
.legacy-html img { max-width: 100%; height: auto; }
.legacy-html table { max-width: 100%; display: block; overflow-x: auto; }
.page-body > .prose { max-width: 820px; }
.post-image { margin-bottom: 1em; clip-path: polygon(0 0, 100% 0, 100% 90%, 94% 100%, 0 100%); }
.archive-note { margin: 0 0 32px; padding: 16px 20px; background: #fff6da; border-left: 6px solid #e0b43a; font-size: 16px; line-height: 1.55; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 0; font-size: 15px; }
.tags a { padding: 6px 12px; background: #e3eef4; color: var(--ink); text-decoration: none; }
.tags a:hover { background: var(--sky); }
.translation-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 40px; padding: 20px 24px; background: var(--navy); color: #fff; }
.translation-bar p { margin: 0; }
.comments, .older-newer { margin-top: 40px; padding-top: 28px; border-top: 2px solid var(--line); }
.comments h2 { font-size: 28px; color: var(--navy); }
.comments > p { color: var(--quiet); font-size: 15px; }
.comments ol { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.comments ol ol { margin-top: 16px; padding-left: 24px; border-left: 3px solid var(--line); }
.comment { padding: 18px 20px; background: #fff; }
.comment ol .comment { background: var(--ground); }
.comment-meta { margin: 0 0 6px; font-size: 15px; }
.comment p { margin: 0 0 0.6em; }
.older-newer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-weight: 600; }
.older-newer a { text-decoration: none; }
.older-newer .newer { margin-left: auto; text-align: right; }

/* Archive */
.archive { display: flex; flex-wrap: wrap-reverse; gap: 56px; }
.years { flex: 1 1 300px; }
.years h2, .cv h2 { margin-bottom: 20px; color: var(--navy); font-size: 26px; }
.years ol { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.years li { display: flex; align-items: center; gap: 16px; }
.years a { flex: none; width: 56px; font-size: 18px; font-weight: 700; text-decoration: none; }
.years a[aria-current] { color: var(--green); text-decoration: underline; }
.bar { flex: 1 1 auto; max-width: 200px; height: 14px; fill: var(--steel); }
.count { flex: none; color: var(--muted); font-size: 15px; }
.results { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.archive-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.archive-filters label { flex: 1 1 140px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.archive-filters label.search { flex: 2 1 240px; }
.archive-filters input, .archive-filters select { min-height: 44px; padding: 10px 12px; border: 1px solid #8fa9bc; background: #fff; font: inherit; font-size: 16px; }
.archive-filters .button { border-color: var(--navy); background: var(--navy); color: #fff; }
.result-count { margin: 0; color: var(--quiet); font-size: 15px; }
.archive-list { margin: 0; padding: 0; list-style: none; }
.archive-list li { display: flex; flex-direction: column; gap: 4px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.archive-list .title { font-family: var(--heading-font); font-size: 24px; font-weight: 700; text-decoration: none; }
.archive-list .title:hover { text-decoration: underline; }
.archive-list .post-meta { color: var(--quiet); font-size: 13px; }
.pagination { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.pagination a { padding: 10px 16px; background: #fff; text-decoration: none; }

/* CV */
.cv-title { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 32px; }
.cv-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.cv { display: flex; flex-wrap: wrap; gap: 56px; }
.cv-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 48px; }
.cv-main h2 { font-size: 40px; }
.role { display: flex; gap: 20px; margin-top: 28px; }
.role .marker { flex: none; margin-top: 6px; fill: var(--navy); }
.role:nth-of-type(5n+2) .marker { fill: var(--steel); }
.role:nth-of-type(5n+3) .marker { fill: var(--slate); }
.role:nth-of-type(5n+4) .marker { fill: var(--teal); }
.role:nth-of-type(5n) .marker { fill: var(--sky); }
.role .dates { margin: 0 0 8px; color: #2e7f95; font-size: 14px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.role h3 { margin-bottom: 8px; font-size: 28px; }
.role .prose { color: var(--muted); font-size: 18px; line-height: 1.6; }
.role .prose p { margin: 0 0 0.5em; }
.cv-aside { flex: 1 1 280px; display: flex; flex-direction: column; gap: 24px; }
.cv-aside .portrait { max-width: none; width: 100%; clip-path: polygon(0 0, 100% 0, 100% 88%, 88% 100%, 0 100%); }
.cv-box { padding: 24px; background: #fff; border-top: 6px solid var(--navy); }
.cv-box:nth-of-type(2) { border-color: var(--steel); }
.cv-box:nth-of-type(3) { border-color: var(--teal); }
.cv-box h2 { margin-bottom: 10px; font-size: 22px; color: var(--ink); }
.cv-box ul { margin: 0; padding: 0; list-style: none; font-size: 16px; line-height: 1.6; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding-top: 48px; padding-bottom: 64px; color: var(--slate); font-size: 15px; }
.site-footer p { margin: 0; }
