/* Jaydon Coombs-Goodfellow: site styles (personal site, October 2026)
   One calm reading column, flat navy surfaces, sky blue for links and small
   details. Newsreader for everything. Design tokens live in
   colors_and_type.css, loaded first. */

/* Page changes: a short fade, nothing more. */
.page-fade { animation: page-fade-in 220ms var(--ease-out) both; }
@keyframes page-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  font-family: var(--font-serif);
  color: var(--fg1);
  background: var(--bg-base);
  line-height: var(--lh-base);
  font-size: 18px;
  min-height: 100vh;
  overflow-x: clip;
}
::selection { background: var(--city-blue); color: var(--bg-deep); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input { font-family: inherit; }

:focus-visible { outline: 2px solid var(--city-blue-bright); outline-offset: 3px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: fixed; top: 0; left: 0; z-index: 10000;
  transform: translateY(-120%);
  background: var(--city-blue); color: var(--bg-deep);
  padding: 0.7rem 1.1rem; font-weight: 600; font-size: 0.95rem;
  border-radius: 0 0 var(--r-md) 0;
  transition: transform 0.15s ease;
}
.skip-link:focus-visible { transform: translateY(0); outline-offset: -2px; }

.error-fallback {
  min-height: 60vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  gap: 1rem; padding: 4rem 1.25rem; color: var(--fg1);
}
.error-fallback h1 { font-size: 1.9rem; font-weight: 500; }
.error-fallback p { color: var(--fg2); max-width: 40ch; }

/* ---- Containers ---- */
.wrap      { max-width: 760px;  margin: 0 auto; padding: 0 1.5rem; }
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-hair);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem 2rem;
}
.nav-brand { font-weight: 600; font-size: 1.1rem; color: var(--fg1); white-space: nowrap; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; list-style: none; }
.nav-links a { color: var(--fg2); font-size: 1.02rem; transition: color var(--dur-fast); }
.nav-links a:hover { color: var(--fg1); }
.nav-links a.is-current { color: var(--city-blue-deep); text-decoration: underline;
  text-decoration-thickness: 1.5px; text-underline-offset: 6px; }

/* ---- Text ---- */
.prose p {
  font-size: 1.2rem; line-height: 1.65; color: var(--fg1);
  margin-bottom: 1.15rem; text-wrap: pretty; max-width: 66ch;
}
.prose p:last-child { margin-bottom: 0; }
.prose a, a.text-link {
  color: var(--city-blue-deep); text-decoration: underline;
  text-decoration-color: rgba(139,192,235,0.4); text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast), color var(--dur-fast);
}
.prose a:hover, a.text-link:hover { color: var(--city-blue-bright); text-decoration-color: currentColor; }
.byline { font-size: 1rem; color: var(--fg3); margin: 0.2rem 0 0.7rem; }
.empty { font-size: 1.1rem; color: var(--fg3); font-style: italic; padding: 1.2rem 0; }

/* ---- Page header ---- */
.page-head { padding: 4.5rem 0 2.2rem; }
.page-head h1 {
  font-weight: 500; font-size: clamp(2.3rem, 5vw, 3.3rem); line-height: 1.1; letter-spacing: -0.015em;
  color: var(--fg1); margin-bottom: 1rem; text-wrap: balance;
}
.page-head .lead {
  font-size: 1.28rem; line-height: 1.55;
  color: var(--fg2); max-width: 60ch; text-wrap: pretty;
}
.breadcrumb { display: inline-block; font-size: 1rem; color: var(--city-blue-deep); margin-bottom: 1.4rem; }
.breadcrumb:hover { color: var(--city-blue-bright); }
.on-page { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin-top: 1.6rem; font-size: 1rem; }
.on-page a { color: var(--city-blue-deep); text-decoration: underline; text-decoration-color: rgba(139,192,235,0.35); text-underline-offset: 3px; }
.on-page a:hover { color: var(--city-blue-bright); }

/* ---- Sections ---- */
.section { padding: 1.2rem 0 3rem; }
.section + .section { padding-top: 1.5rem; }
.section-title { font-weight: 500; font-size: 1.75rem; letter-spacing: -0.01em; color: var(--fg1); margin-bottom: 1.3rem; }
.sub-title { font-weight: 500; font-size: 1.35rem; color: var(--fg1); margin: 2.2rem 0 0.8rem; }

/* ---- Lists of articles, notes and links ---- */
.entry-list { list-style: none; border-top: 1px solid var(--border-hair); }
.entry { border-bottom: 1px solid var(--border-hair); }
.entry > a, .entry > .entry-body { display: block; padding: 1.3rem 0; }
.entry-meta { font-size: 0.95rem; color: var(--fg3); margin-bottom: 0.3rem; }
.entry-title {
  font-weight: 500; font-size: 1.42rem; line-height: 1.25; color: var(--fg1);
  margin-bottom: 0.35rem; transition: color var(--dur-fast); text-wrap: balance;
}
.entry-text { font-size: 1.08rem; line-height: 1.55; color: var(--fg2); text-wrap: pretty; }
.entry > a:hover .entry-title { color: var(--city-blue-deep); }
.entry-tag {
  display: inline-block; font-size: 0.85rem; font-style: italic; font-weight: 400;
  color: var(--fg3); margin-left: 0.6rem; vertical-align: 1px;
}
.entry .tag-list { margin-top: 0.75rem; }
.entry a span.tag { cursor: inherit; }

/* ---- Search and tags ---- */
.finder { margin-bottom: 1.6rem; }
.search {
  width: 100%; max-width: 32rem; display: block;
  background: var(--bg-raised); color: var(--fg1);
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
  padding: 0.75rem 0.95rem; font-size: 1.08rem; margin-bottom: 1rem;
  transition: border-color var(--dur-fast);
}
.search::placeholder { color: var(--fg4); }
.search:focus { border-color: var(--city-blue); outline: none; }
.tag-filter, .tag-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  display: inline-block; background: transparent; color: var(--fg2);
  border: 1px solid var(--border-soft); border-radius: 999px;
  padding: 0.22rem 0.8rem; font-size: 0.95rem; line-height: 1.4; cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
span.tag { cursor: default; }
button.tag:hover { border-color: var(--city-blue); color: var(--fg1); }
.tag.is-on { background: var(--city-blue); border-color: var(--city-blue); color: var(--bg-deep); }
.finder-count { font-size: 0.95rem; color: var(--fg3); margin-top: 0.9rem; }

/* ---- What I'm learning: notes, books and the links between them ---- */
.subnav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin-top: 1.6rem; font-size: 1.05rem; }
.subnav a {
  color: var(--fg2); text-decoration: underline; text-decoration-color: transparent;
  text-decoration-thickness: 1.5px; text-underline-offset: 6px; transition: color var(--dur-fast);
}
.subnav a:hover { color: var(--fg1); }
.subnav a.is-current { color: var(--city-blue-deep); text-decoration-color: currentColor; }
.note { padding: 1.6rem 0 2rem; border-bottom: 1px solid var(--border-hair); }
.note:first-child { border-top: 1px solid var(--border-hair); }
.note-title { font-weight: 500; font-size: 1.55rem; line-height: 1.25; color: var(--fg1); }
.books { border-top: 1px solid var(--border-hair); }
.book {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.4rem; align-items: start;
  padding: 1.6rem 0 2rem; border-bottom: 1px solid var(--border-hair);
}
.book.no-cover { grid-template-columns: minmax(0, 1fr); }
.book-cover {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border-soft); border-radius: var(--r-sm); background: var(--bg-raised);
}
.book-cover-link { display: block; transition: opacity var(--dur-fast); }
.book-cover-link:hover { opacity: 0.85; }
.book-title { font-weight: 500; font-size: 1.45rem; line-height: 1.25; color: var(--fg1); }
.book-buy { margin-top: 1rem; font-size: 1.05rem; }

/* ---- Football page ---- */
.influence { padding: 0.2rem 0 1.5rem; }
.influence h3 { font-weight: 500; font-size: 1.45rem; color: var(--fg1); }
.influence .role { font-size: 1rem; font-style: italic; color: var(--fg3); margin: 0.1rem 0 0.7rem; }
.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2.5rem; }
.principles h4 { font-weight: 600; font-size: 1.12rem; color: var(--fg1); margin-bottom: 0.3rem; }
.principles p { font-size: 1.05rem; line-height: 1.55; color: var(--fg2); }
.kv { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0.85rem 2rem; }
.kv dt { font-size: 1rem; font-style: italic; color: var(--fg3); padding-top: 0.1rem; }
.kv dd { font-size: 1.1rem; line-height: 1.5; color: var(--fg1); }

/* ---- Gallery ---- */
.gallery-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.3rem 1rem; flex-wrap: wrap; margin: 1.2rem 0 1rem; }
.gallery-head h3 { font-weight: 500; font-size: 1.3rem; color: var(--fg1); }
.gallery-head .meta { font-size: 0.95rem; color: var(--fg3); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem 1.2rem; margin-bottom: 2.5rem; }
.gallery-item { cursor: zoom-in; }
.gallery-item .frame {
  aspect-ratio: 4/3; background: var(--bg-pitch); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); overflow: hidden; transition: border-color var(--dur-fast);
}
.gallery-item:hover .frame { border-color: rgba(108,171,221,0.45); }
.gallery-item img { width: 100%; height: 100%; object-fit: contain; padding: 6px; display: block; }
.gallery-caption { font-size: 0.98rem; color: var(--fg2); margin-top: 0.45rem; }

/* ---- Article ---- */
.article { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }
.article-section { margin-bottom: 2.8rem; }
.article-h2 { font-weight: 500; font-size: 1.85rem; letter-spacing: -0.012em; line-height: 1.2; color: var(--fg1); margin: 0 0 1.1rem; text-wrap: balance; }
.article-h3 { font-weight: 600; font-size: 1.32rem; line-height: 1.3; color: var(--fg1); margin: 2rem 0 0.8rem; }
.article-h2, .article-h3 { scroll-margin-top: 5.5rem; }

/* Contents at the top of a long article: sections numbered, their subheadings under each. */
.toc { margin-top: 2rem; padding: 1.1rem 1.4rem 1.2rem; border: 1px solid var(--border-soft); border-radius: 12px; max-width: 46rem; }
.toc-title { font-size: 1.15rem; font-weight: 600; color: var(--fg1); cursor: pointer; }
.toc[open] .toc-title { margin-bottom: 0.6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc ol > li { margin: 0.55rem 0 0; font-size: 1.05rem; }
.toc ul { list-style: none; margin: 0.25rem 0 0; padding-left: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; }
.toc ul li { font-size: 0.95rem; }
.toc a { color: var(--city-blue-deep); text-decoration: underline; text-decoration-color: rgba(139,192,235,0.35); text-underline-offset: 3px; }
.toc ol > li > a { color: var(--fg1); }
.toc a:hover { color: var(--city-blue-bright); }
@media (max-width: 699px) { .toc ul { display: block; } .toc ul li { margin-top: 0.3rem; } }
.article-p { font-size: 1.22rem; line-height: 1.68; color: var(--fg1); text-wrap: pretty; max-width: 66ch; margin-bottom: 1.15rem; }
.article-p:last-child { margin-bottom: 0; }
.article-figure {
  margin: 1.8rem 0; border: 1px solid var(--border-soft); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg-pitch); cursor: zoom-in; transition: border-color var(--dur-fast);
}
.article-figure:hover { border-color: rgba(108,171,221,0.45); }
.article-figure img { display: block; width: 100%; }
.article-caption { display: block; padding: 0.7rem 0.9rem 0.8rem; font-size: 0.98rem; line-height: 1.45; color: var(--fg3); border-top: 1px solid var(--border-soft); }

/* ---- Related ---- */
.related { margin: 2rem 0 1rem; }
.related-title { font-weight: 500; font-size: 1.3rem; color: var(--fg2); margin-bottom: 0.9rem; }
.related .entry-title { font-size: 1.22rem; }
.related .entry-text { font-size: 1rem; }

/* ---- Buttons (error panel only) ---- */
.btn { display: inline-flex; align-items: center; padding: 0.7rem 1.2rem; border-radius: var(--r-sm); font-size: 1rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--city-blue); color: var(--bg-deep); }

/* ---- Lightbox ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(5, 9, 18, 0.95);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 1rem;
  padding: 3rem 1.25rem; cursor: zoom-out;
  animation: lightbox-in 0.2s var(--ease-out) both;
}
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img { max-width: 92vw; max-height: 80vh; object-fit: contain; border-radius: var(--r-sm); cursor: default; }
.lightbox-caption { color: var(--fg2); font-size: 1.05rem; max-width: 700px; text-align: center; }
.lightbox-close {
  position: absolute; top: 1.2rem; right: 1.2rem; width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border-mid); color: var(--fg1);
  font-size: 1.5rem; line-height: 1; cursor: pointer; transition: border-color var(--dur-fast);
}
.lightbox-close:hover { border-color: var(--city-blue); }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border-hair); margin-top: 3rem; }
.site-footer-inner {
  max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 2.5rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem 2rem;
  font-size: 1rem; color: var(--fg3);
}
.site-footer-inner nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.site-footer a { color: var(--fg2); }
.site-footer a:hover { color: var(--city-blue-bright); }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .principles { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .wrap, .wrap-wide, .article { padding: 0 1.25rem; }
  .nav-inner { flex-direction: column; align-items: flex-start; gap: 0.45rem; padding: 0.85rem 1.25rem; }
  .nav-links { gap: 0.25rem 1.05rem; }
  .nav-links a { font-size: 1rem; }
  .page-head { padding: 2.8rem 0 1.6rem; }
  .prose p, .article-p { font-size: 1.14rem; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .kv dd { margin-bottom: 0.9rem; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .book { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; }
  .site-footer-inner { padding: 1.6rem 1.25rem 2.2rem; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .page-fade { opacity: 1 !important; animation: none !important; }
}


/* ---------------------------------------------------------------------
   Hand-drawn margin art (margin-art.js draws into the canvases): About, Football and the book list.
   On wide screens each drawing sits in the empty margin beside its paragraph, tilted 20 degrees:
   the crest on the right leaning right, the crescent on the left leaning left. Below 1140px there is
   no margin to use, so each sits centred between paragraphs. */
.has-art { position: relative; }
.margin-art {
  --w: min(var(--art-max, 240px), calc(((100vw - 100%) / 2 - 24px) / 1.35));
  position: absolute; top: 50%; width: var(--w); display: block; line-height: 0; pointer-events: none;
  transform: translateY(-50%) rotate(var(--tilt, 0deg));
}
.margin-art canvas { display: block; width: 100%; height: auto; }
.margin-art-crest    { --tilt: 20deg;  --art-max: 236px; left: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
.margin-art-mancity  { --tilt: 20deg;  --art-max: 250px; left: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
.margin-art-book     { --tilt: 20deg;  --art-max: 200px; left: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
.margin-art-notebook { --tilt: 20deg;  --art-max: 250px; left: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
.margin-art-crescent { --tilt: -20deg; --art-max: 250px; right: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
/* Article drawings take a side each: l in the left margin leaning left, r in the right leaning right. */
.margin-art-l        { --tilt: -20deg; --art-max: 240px; right: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
.margin-art-r        { --tilt: 20deg;  --art-max: 240px; left: calc(100% + ((100vw - 100%) / 2 - var(--w)) / 2); }
@media (max-width: 1140px) {
  .margin-art, .margin-art-crest, .margin-art-crescent, .margin-art-mancity, .margin-art-book, .margin-art-notebook, .margin-art-l, .margin-art-r {
    position: relative; top: auto; left: auto; right: auto; width: min(190px, 52vw);
    margin: 2.6rem auto 2.8rem; transform: rotate(var(--tilt, 0deg));
  }
}

/* The badge sits beside its paragraph on wide screens and above its heading on narrow ones. */
@media (max-width: 1140px) { .art-wide-only { display: none; } }
@media (min-width: 1141px) { .art-narrow-only { display: none; } }

/* The button that opens the rest of a gallery. */
.more-row { margin: -1.2rem 0 2.6rem; }
.more-btn { padding: 0.5rem 1.15rem; font-size: 1rem; color: var(--city-blue); border-color: rgba(108,171,221,0.45); }
.more-btn:hover { color: var(--fg1); }

/* ---- Articles: citations, bibliography and interactive dashboards ---- */
sup.fn { font-size: 0.68em; line-height: 0; margin-left: 1px; }
sup.fn a { color: var(--city-blue-deep); text-decoration: none; padding: 0 2px; }
sup.fn a:hover { color: var(--city-blue-bright); text-decoration: underline; }
.article-p em, .article-caption em, .biblio em { font-style: italic; }
.biblio { padding-left: 1.6rem; max-width: 66ch; margin-bottom: 1.6rem; }
.biblio li { font-size: 1.02rem; line-height: 1.55; color: var(--fg2); margin-bottom: 0.6rem; }
.biblio li a { word-break: break-word; }
.dash-embed {
  position: relative; left: 50%; transform: translateX(-50%); width: min(1180px, calc(100vw - 2.5rem));
  margin: 2.2rem 0; border: 1px solid var(--border-soft); border-radius: var(--r-md); overflow: hidden; background: #070D1B;
}
.dash-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border-soft); font-size: 0.95rem; color: var(--fg3);
}
.dash-full {
  font-size: 0.95rem; color: var(--city-blue-deep); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: 0.2rem 0.85rem;
}
.dash-full:hover { border-color: var(--city-blue); color: var(--city-blue-bright); }
.dash-embed iframe { display: block; width: 100%; height: 900px; border: 0; }
@media (max-width: 640px) {
  .dash-embed { width: 100vw; border-left: 0; border-right: 0; border-radius: 0; }
  .dash-embed .article-caption { padding-left: 1.25rem; padding-right: 1.25rem; }
}
