/* Common look for www.rowlhouse.co.uk — dark, readable, works on phones. */

:root {
  --bg: #111214;
  --surface: #1a1c20;
  --surface-2: #23262b;
  --border: #2e3238;
  --text: #e8e6e1;
  --muted: #a39f97;
  --accent: #6cc4a1;        /* green from the dragon */
  --accent-2: #c98bd6;      /* magenta from the dragon */
  --link: #8fd6ba;
  --link-visited: #b9a3d9;
  --radius: 10px;
  --wrap: 46rem;
  --wrap-wide: 68rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

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

/* The hidden attribute must always hide, even on elements styled display:flex/grid */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.65 var(--font);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, video { max-width: 100%; height: auto; }

a { color: var(--link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:visited { color: var(--link-visited); }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0.5rem 0 1.25rem; }
h2 { font-size: 1.45rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
p, ul, ol { margin: 0 0 1rem; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: var(--wrap-wide); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: rgba(17, 18, 20, 0.92); }
.header-inner {
  max-width: var(--wrap-wide);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem 1.5rem; flex-wrap: wrap;
  padding-top: 0.6rem; padding-bottom: 0.6rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-weight: 650; font-size: 1.15rem; }
.brand:visited { color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { width: 40px; height: auto; transition: transform 0.5s ease; }
.brand:hover img { transform: rotate(-45deg); }
.site-header ul { list-style: none; display: flex; gap: 0.25rem; margin: 0; padding: 0; }
.site-header nav a {
  display: block; padding: 0.35rem 0.75rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.site-header nav a:hover { color: var(--text); background: var(--surface-2); }
.site-header nav a[aria-current="page"] { color: var(--bg); background: var(--accent); }

/* Main */
main { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }
.lead { font-size: 1.2rem; color: var(--text); }
/* Page subtitle: the summary line directly under a page's heading, set apart from the content */
h1 + .lead { margin: -0.85rem 0 1.75rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 1.25rem; font-weight: 400; line-height: 1.5; }
.hero h1 + .lead { margin: 0 0 1rem; padding: 0; border: 0; color: var(--text); font-size: 1.2rem; line-height: inherit; }
.muted { color: var(--muted); }

/* Cards (home page doors, project lists) */
/* Card tiles: the number per row depends on how many cards there are, so rows are always
   full (3 cards: 3 across; 2 or 4 cards: 2 across; phones: 1 across). */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; padding: 0; list-style: none; }
.cards:has(> li:nth-child(2):last-child),
.cards:has(> li:nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); }
.cards:has(> li:only-child) { grid-template-columns: 1fr; }
@media (max-width: 560px) {
  .cards,
  .cards:has(> li:nth-child(2):last-child),
  .cards:has(> li:nth-child(4):last-child) { grid-template-columns: 1fr; }
}
/* Each card fills its grid cell, so cards in a row are all the same height */
.cards > li { display: flex; }
.cards > li > .card { flex: 1; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; color: var(--text); text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.card:visited { color: var(--text); }
.card:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.card h2, .card h3 { margin: 0 0 0.35rem; font-size: 1.2rem; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 0.97rem; }
/* Step-by-step build photos (Frankenscope): one or two per step, not cropped */
.build-photos { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.5rem 0 1.5rem; }
.build-photos a { flex: 0 1 20rem; display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.build-photos a:hover { border-color: var(--accent); }
.build-photos img { display: block; width: 100%; height: auto; }
/* A single photo across the full width, with a caption */
.wide-photo { margin: 0.5rem 0 1.75rem; }
.wide-photo a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.wide-photo a:hover { border-color: var(--accent); }
.wide-photo img { display: block; width: 100%; height: auto; }
.wide-photo figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.45rem; }

/* Picture across the top of a card, cropped to 16:9 */
.card-img {
  display: block; width: calc(100% + 2.4rem); max-width: none; height: auto; aspect-ratio: 16 / 9;
  object-fit: cover; margin: -1.1rem -1.2rem 0.9rem;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

/* Home hero */
.hero { display: flex; align-items: center; gap: 1.75rem; margin: 0.5rem 0 1rem; }
.hero img { width: 150px; flex: none; }
.hero h1 { margin: 0 0 0.5rem; }
.hero p { margin: 0; }
@media (max-width: 560px) {
  .hero { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .hero img { width: 110px; }
}

/* Placeholder notes, visible while pages are being written */
.todo {
  border: 1px dashed var(--accent-2); color: var(--muted); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin: 1rem 0; font-size: 0.95rem;
}
.todo::before { content: "To do: "; color: var(--accent-2); font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.footer-inner {
  max-width: var(--wrap-wide); display: flex; justify-content: space-between;
  gap: 0.5rem 1.5rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1.25rem;
}
.contact { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Section sub-menus and breadcrumbs */
.breadcrumb { margin: 0 0 0.25rem; font-size: 0.9rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.subnav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 1.5rem; padding: 0; }
.subnav a {
  display: block; padding: 0.3rem 0.8rem; border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 0.95rem;
}
.subnav a:hover { color: var(--text); border-color: var(--accent); }
.subnav a[aria-current="page"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }

/* A quiet note box */
.note {
  background: var(--surface); border-left: 3px solid var(--accent);
  padding: 0.7rem 1rem; border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted); font-size: 0.95rem;
}

/* Image galleries */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.6rem; margin: 1rem 0 1.5rem; }
.gallery a { display: block; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.gallery a:hover { border-color: var(--accent); }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* Responsive video embeds */
.video { position: relative; aspect-ratio: 16 / 9; margin: 1rem 0 1.5rem; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-file { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #000; }

/* Old content kept as-is: keep tables and preformatted text from breaking the layout */
.legacy table { max-width: 100%; border-collapse: collapse; }
.legacy td, .legacy th { padding: 0.3rem 0.5rem; vertical-align: top; }
.legacy pre { overflow-x: auto; background: var(--surface); padding: 0.75rem; border-radius: 6px; }
.legacy dt { font-weight: 600; margin-top: 0.75rem; }

/* Career timeline */
.timeline { list-style: none; margin: 1rem 0 2rem; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: 0 0 1.1rem 1.25rem; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 0.45em; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.timeline .when { color: var(--muted); font-size: 0.92rem; padding-top: 0.1em; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* Audio track lists */
.tracks { display: grid; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.tracks figure {
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.8rem 1rem;
}
.tracks figcaption { margin-bottom: 0.5rem; }
.tracks figcaption:last-child { margin-bottom: 0; }
.tracks audio { width: 100%; height: 40px; }

/* Long URLs and words in old content shouldn't push the page wider than a phone */
main { overflow-wrap: anywhere; }

/* ---------- Concertina library ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link-row { list-style: none; padding: 0; margin: 1rem 0 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.library-tools { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0.5rem 0 0.25rem; }
.library-tools input[type="search"] {
  flex: 1 1 16rem; min-width: 0; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.45rem 0.95rem;
}
.library-tools input[type="search"]:focus { border-color: var(--accent); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chips button {
  font: inherit; font-size: 0.92rem; color: var(--muted); background: transparent; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.8rem;
}
.chips button:hover { color: var(--text); border-color: var(--accent); }
.chips button[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.library-count { font-size: 0.9rem; margin: 0.4rem 0 0; }
.lib-section h2 { margin-bottom: 0.2rem; }
.lib-section > p.muted { margin-bottom: 0.6rem; font-size: 0.95rem; }
.piece-list { list-style: none; padding: 0; margin: 0 0 1rem; border-top: 1px solid var(--border); }
.piece-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem;
  padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--border);
}
.piece-list li > a { font-weight: 550; }
.piece-list .who { color: var(--muted); font-size: 0.93rem; }
.piece-list .feats { margin-left: auto; display: flex; gap: 0.3rem; }
.badge {
  display: inline-block; font-size: 0.75rem; line-height: 1.5; padding: 0 0.5rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap; font-weight: 500;
}
.badge-draft { border-color: var(--accent-2); color: var(--accent-2); vertical-align: middle; }
h1 .badge { font-size: 0.9rem; }

/* ---------- Piece pages ---------- */
.byline { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; color: var(--muted); margin-top: -0.6rem; }
.tracks .dl { font-size: 0.8rem; margin-left: 0.4rem; color: var(--muted); }
.button {
  display: inline-block; padding: 0.45rem 1rem; border-radius: 999px; text-decoration: none;
  background: var(--accent); color: var(--bg); font-weight: 600;
}
.button:visited { color: var(--bg); }
.button:hover { background: var(--accent-2); color: var(--bg); }
.score-pages { display: grid; gap: 1rem; margin: 1rem 0 1.5rem; }
.score-pages figure { margin: 0; }
.score-pages img { display: block; width: 100%; aspect-ratio: auto 1 / 1.4; background: #fff; border-radius: 4px; }
.score-pages figcaption { color: var(--muted); font-size: 0.85rem; text-align: center; margin-top: 0.3rem; }
.files { padding-left: 1.2rem; }
.files .muted { font-size: 0.8rem; margin-left: 0.3rem; }
.back { margin-top: 2.5rem; }
main img[src$="MicSetup.jpg"] { border-radius: var(--radius); }

/* ---------- Photo gallery ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.25rem; margin: 1rem 0 2rem; }
.photo-grid figure { margin: 0; }
.photo-grid a { display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.photo-grid a:hover { border-color: var(--accent); }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.45rem; }

/* Embedded PDF viewer on piece pages */
.pdf-open { margin-left: 0.9rem; font-size: 0.95rem; }
.pdf-viewer { margin: 1rem 0 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #525659; }
.pdf-viewer iframe { display: block; width: 100%; height: min(85vh, 1100px); border: 0; }

/* Video with a link to YouTube underneath */
.video-block { margin: 1rem 0 1.5rem; }
.video-block .video { margin: 0; }
.video-block figcaption { margin-top: 0.4rem; font-size: 0.9rem; text-align: right; }
.video-block .video-file + figcaption { text-align: left; color: var(--muted); }

/* SoundCloud tracks (inside .tracks) */
.sc-block { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; }
.sc-block figcaption { margin-bottom: 0.5rem; }
.sc-player { display: block; width: 100%; height: 166px; border: 0; border-radius: 6px; }
.sc-link { display: inline-block; margin-top: 0.35rem; font-size: 0.85rem; }

/* Grid of YouTube thumbnails */
.video-grid { list-style: none; padding: 0; margin: 1rem 0 2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; }
.video-grid a { display: block; height: 100%; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.video-grid a:visited { color: var(--text); }
.video-grid a:hover { border-color: var(--accent); color: var(--text); }
.video-grid img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.video-grid .vg-title { display: block; padding: 0.55rem 0.75rem 0.15rem; font-weight: 600; font-size: 0.95rem; }
.video-grid .vg-blurb { display: block; padding: 0 0.75rem 0.7rem; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

/* Lists of links on Work pages */
.link-list { padding-left: 1.2rem; }
.link-list li { margin-bottom: 0.45rem; }
.link-list .muted { font-size: 0.9rem; }

/* Two videos side by side (stacked on narrow screens) */
.video-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0 1.5rem; }
.video-pair h3 { margin: 0 0 0.1rem; }
.video-pair p { margin: 0 0 0.4rem; font-size: 0.9rem; }
.video-pair .video-block { margin: 0; }
@media (max-width: 640px) { .video-pair { grid-template-columns: 1fr; } }
.hero p + p { margin-top: 0.6rem; }

/* Headings between groups in a photo gallery */
.gallery-heading { font-size: 1.15rem; margin: 2rem 0 0.6rem; }
