/* peterbagley.co.uk — The Card Binder
   Every piece is a trading card sleeved in a nine-pocket binder page.
   Charcoal binder cloth, dark card faces with light ink, one black keyline, flat spot colour per card type,
   gold reserved for the email action. Latin: Barlow / Barlow Semi Condensed. No JavaScript. */

:root {
  --cloth: #1c1c1f;
  --cloth-2: #17171a;
  --sleeve: #121214;
  --tab: #2c2c31;
  --sleeve-edge: rgba(255, 255, 255, 0.10);
  --face: #26262b;
  --face-2: #303036;
  --ink: #f2f2ef;
  --ink-2: #c9c9cf;
  --mute: #9d9da6;
  --rule: #3c3c44;
  --keyline: #0a0a0c;
  --cloth-ink: #f2f2ef;
  --cloth-mute: #a6a6ad;
  --writing: #f2a900;
  --video: #1aa3a3;
  --projects: #d6336c;
  --about: #6262cf;
  --gold: #e3b341;
  --gold-ink: #1c1c1f;
  --shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 10px 20px -10px rgba(0, 0, 0, 0.6);

  --sans: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --cond: "Barlow Semi Condensed", "Barlow", "Arial Narrow", sans-serif;
  --jp: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --page: 72rem;
  --measure: 66ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--cloth); color: var(--cloth-ink); font-family: var(--sans); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
body { margin: 0; background: var(--cloth); font-size: 1.0625rem; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
::selection { background: var(--gold); color: var(--gold-ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }
svg[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
[lang="ja"] { font-family: var(--jp); }
.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--gold); color: var(--gold-ink); padding: 0.5rem 0.75rem; font-weight: 700; z-index: 20; }
.skip:focus { left: 0.5rem; }
.wrap { max-width: var(--page); margin: 0 auto; padding-inline: var(--gutter); }

/* ---------- Spine and tabs ---------- */
.spine { position: sticky; top: 0; z-index: 10; background: var(--cloth); border-bottom: 1px solid var(--sleeve-edge); }
.spine .wrap { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; flex-wrap: wrap; }
.spine-name { font-family: var(--cond); font-weight: 800; font-size: 1.25rem; letter-spacing: 0.02em; text-transform: uppercase; margin-right: auto; }
.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.9rem; border-radius: 6px 6px 0 0;
  font-family: var(--cond); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--tab); color: var(--cloth-ink); border-bottom: 3px solid transparent;
  transition: background 0.15s ease-out, border-color 0.15s ease-out;
}
.tab.writing { border-color: var(--writing); }
.tab.video { border-color: var(--video); }
.tab.projects { border-color: var(--projects); }
.tab.about { border-color: var(--about); }
.tab:hover, .tab[aria-current="page"] { background: #3a3a41; }
.tab.email { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); border-radius: 6px; }
.tab.email:hover { background: #f0c45c; }
@media (max-width: 40rem) {
  .spine .wrap { padding-block: 0.5rem; }
  .tabs { flex-basis: 100%; }
  .tab { flex: 1 1 auto; justify-content: center; padding-inline: 0.5rem; font-size: 0.85rem; }
}

/* ---------- Binder pages ---------- */
.page { padding-block: clamp(1.5rem, 4vw, 3rem) 0; }
.page.first { padding-top: clamp(1.5rem, 4vw, 2.5rem); }
.page-tab { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.page-tab h2 { margin: 0; font-family: var(--cond); font-weight: 800; font-size: clamp(1.4rem, 1rem + 1.4vw, 2rem); letter-spacing: 0.02em; text-transform: uppercase; }
.page-tab span { color: var(--cloth-mute); font-size: 0.95rem; }
.page-tab::after { content: ""; flex: 1; height: 1px; background: var(--sleeve-edge); align-self: center; }
@media (max-width: 40rem) { .page-tab { flex-wrap: wrap; gap: 0.25rem 0.75rem; } .page-tab::after { display: none; } }

.pockets {
  list-style: none; margin: 0; padding: clamp(0.75rem, 2vw, 1.25rem);
  background: var(--cloth-2); border-radius: 14px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(0.75rem, 2vw, 1.25rem);
}
.pocket {
  background: var(--sleeve); border-radius: 12px; padding: 0.6rem;
  box-shadow: inset 0 1px 0 var(--sleeve-edge);
  overflow: hidden;
}
@media (max-width: 56rem) { .pockets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 34rem) { .pockets { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card { --type: var(--writing); height: 100%; }
.card.type-video { --type: var(--video); }
.card.type-projects { --type: var(--projects); }
.card.type-about { --type: var(--about); }
.card > a {
  display: grid; grid-template-rows: auto auto auto 1fr auto; height: 100%;
  background: var(--face); color: var(--ink);
  border: 2px solid var(--keyline); border-radius: 10px;
  padding: 0.55rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}
.pocket:hover .card > a, .card > a:focus-visible { transform: translateY(-6px); box-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 18px 28px -12px rgba(0, 0, 0, 0.7); }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem;
  padding: 0.25rem 0.35rem 0.4rem;
}
.card-name { margin: 0; font-family: var(--cond); font-weight: 800; font-size: 1.2rem; line-height: 1.1; letter-spacing: 0.005em; text-wrap: pretty; }
.card-name [lang="ja"] { display: block; font-size: 0.75rem; font-weight: 500; color: var(--mute); margin-bottom: 0.15em; }
.card-year { font-family: var(--cond); font-weight: 700; color: var(--mute); font-size: 0.9rem; white-space: nowrap; }
.card-year[lang="ja"] { font-family: var(--jp); font-weight: 500; font-size: 0.8rem; }
.card-art { margin: 0; border: 2px solid var(--keyline); border-radius: 4px; overflow: hidden; background: #0f0f12; }
.card-art img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card-art.portrait img { object-position: center top; }
.card-art.fit-contain { background: #0f1a1f; }
.card-art.fit-contain img { object-fit: contain; padding: 0; transform: scale(1.07); }
.card-type {
  margin: 0.45rem 0 0; display: flex; align-items: center; gap: 0.4rem;
  background: var(--type); color: #141416;
  font-family: var(--cond); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.3rem 0.5rem; border-radius: 3px;
}
.card-type .sep { opacity: 0.6; }
.type-projects .card-type, .type-about .card-type { color: #fff; }
.card-text {
  align-self: start;
  margin: 0.55rem 0.35rem 0.4rem; font-size: 0.95rem; line-height: 1.45; color: var(--ink-2); font-style: italic;
}
.card-text em { font-style: normal; font-weight: 600; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0.35rem 0.15rem; border-top: 1px solid var(--rule);
  font-family: var(--cond); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.card-no { color: var(--mute); display: inline-flex; align-items: center; gap: 0.35rem; text-transform: none; letter-spacing: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-go { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ink); white-space: nowrap; }
.card-go .icon { transition: transform 0.15s ease-out; }
.pocket:hover .card-go .icon { transform: translateX(3px); }
.card.type-about .card-go { background: var(--gold); color: var(--gold-ink); padding: 0.25rem 0.5rem; border-radius: 3px; }

/* ---------- Sheets (About, articles) ---------- */
.sheet {
  background: var(--face); color: var(--ink); border: 2px solid var(--keyline); border-radius: 10px; box-shadow: var(--shadow);
}
.about-sheet { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.5rem; padding: clamp(1.25rem, 3vw, 2rem); align-items: start; }
.about-sheet img { width: 8rem; height: 8rem; object-fit: cover; border: 2px solid var(--keyline); border-radius: 4px; }
.about-sheet p { margin: 0 0 1rem; font-size: 1.05rem; line-height: 1.6; max-width: var(--measure); }
.facts { margin: 0 0 1.25rem; display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1.25rem; font-size: 0.95rem; }
.facts dt { font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--mute); }
.facts dd { margin: 0; }
.links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; align-items: center; font-weight: 600; }
.links a:not(.btn) { text-decoration: underline; text-underline-offset: 0.2em; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--gold); color: var(--gold-ink); font-family: var(--cond); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.55rem 0.9rem; border-radius: 4px; border: 2px solid var(--gold); }
.btn:hover { background: #f0c45c; }
@media (max-width: 34rem) { .about-sheet { grid-template-columns: 1fr; } }

.post { margin-top: clamp(1.5rem, 4vw, 2.5rem); padding: clamp(1.25rem, 3vw, 2.5rem); max-width: 50rem; margin-inline: auto; }
.post.type-writing { --type: var(--writing); }
.post.type-video { --type: var(--video); }
.sheet-head { max-width: none; }
.sheet-band { display: inline-flex; margin: 1rem 0 0; }
.sheet-reading { margin: 0 0 0.3rem; font-size: 0.95rem; color: var(--mute); }
.sheet-head h1 { margin: 0 0 0.6rem; font-family: var(--cond); font-weight: 800; font-size: clamp(2rem, 1.2rem + 3.4vw, 3.6rem); line-height: 1.02; letter-spacing: 0.005em; text-wrap: balance; }
.standfirst { margin: 0 0 0.75rem; font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); line-height: 1.45; color: var(--ink-2); max-width: 36em; text-wrap: pretty; }
.standfirst a { text-decoration: underline; }
.meta { margin: 0; color: var(--mute); font-weight: 600; font-size: 0.95rem; }
.sheet-art { margin: clamp(1.25rem, 3vw, 2rem) 0 0; border: 2px solid var(--keyline); border-radius: 6px; overflow: hidden; background: var(--face-2); }
.sheet-art img { width: 100%; max-height: 32rem; object-fit: cover; }
.sheet-art.portrait { max-width: none; }
.sheet-art.portrait img { max-height: none; }

.post-body { max-width: none; margin-top: clamp(1.5rem, 4vw, 2.5rem); font-size: 1.125rem; line-height: 1.68; }
.post-body > p { margin: 0 0 1.3em; }
.post-body h2 { margin: 2.2em 0 0.7em; font-family: var(--cond); font-weight: 800; font-size: 1.6rem; line-height: 1.1; }
.post-body h2::before { content: ""; display: inline-block; width: 0.55em; height: 0.55em; background: var(--type); margin-right: 0.5rem; vertical-align: 0.05em; border: 2px solid var(--keyline); }
.post-body h2 + p { margin-top: 0; }
.post-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--type); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.post-body strong { font-weight: 700; }
.post-body blockquote { margin: 1.8em 0; padding: 1rem 1.25rem; background: var(--face-2); border: 2px solid var(--keyline); border-radius: 6px; font-size: 1.08em; line-height: 1.5; font-weight: 500; }
.post-body blockquote p { margin: 0; }
.post-body blockquote footer { margin-top: 0.6rem; font-size: 0.85rem; color: var(--mute); }
.post-body blockquote footer::before { content: "— "; }
.post-body figure { margin: 2.2em 0; }
.post-body figure.narrow, .post-body figure.score { max-width: 32rem; margin-inline: auto; }
.post-body figure img { width: 100%; border: 2px solid var(--keyline); border-radius: 4px; background: var(--face-2); }
.post-body figcaption { margin-top: 0.6rem; font-size: 0.875rem; line-height: 1.45; color: var(--mute); font-weight: 500; }
.table-wrap { overflow-x: auto; margin: 1.8em 0; border: 2px solid var(--keyline); border-radius: 6px; background: var(--face-2); }
.post-body table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
.post-body th, .post-body td { text-align: left; padding: 0.6rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.post-body th { font-family: var(--cond); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; background: var(--face-2); }
.post-body tr:last-child td { border-bottom: 0; }
.post-body td[lang="ja"] { font-size: 1.1em; white-space: nowrap; }
.translation { margin: 1.4em 0 2.2em; padding: 1.25rem 1.5rem; background: var(--face-2); border: 2px solid var(--keyline); border-radius: 6px; font-size: 0.96em; line-height: 1.6; }
.translation p { margin: 0 0 0.85em; }
.translation p:last-child { margin-bottom: 0; }
.translation-head { margin: 0 0 0.8em; display: grid; gap: 0.1rem; font-family: var(--cond); font-weight: 800; font-size: 1rem; line-height: 1.2; }
.translation-sig { font-weight: 700; }
.translation-credit { font-size: 0.85rem; color: var(--mute); }
.profile { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.4rem; align-items: start; padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.profile:has(+ :not(.profile)) { border-bottom: 1px solid var(--rule); }
.profile figure { margin: 0 !important; }
.profile figure img { aspect-ratio: 1 / 1; object-fit: cover; object-position: center top; }
.profile p { margin: 0; }
@media (max-width: 34rem) {
  .profile { grid-template-columns: 1fr; gap: 0.9rem; }
  .profile figure { display: flex; align-items: center; gap: 0.9rem; }
  .profile figure img { width: 4.5rem; flex: none; }
  .profile figcaption { margin-top: 0; }
}
.post-body .gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1.5rem; margin: 2em 0 2.4em; }
.post-body .gallery figure { margin: 0; }
.post-body .gallery figure.tall { grid-row: span 2; }
@media (max-width: 34rem) { .post-body .gallery { grid-template-columns: 1fr; } .post-body .gallery figure.tall { grid-row: auto; } }

.sheet-foot { margin-top: clamp(2rem, 5vw, 3rem); padding-top: 1.25rem; border-top: 2px solid var(--keyline); display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.sheet-foot img { width: 3rem; height: 3rem; border: 2px solid var(--keyline); border-radius: 4px; object-fit: cover; }
.sheet-foot p { margin: 0; font-size: 0.95rem; color: var(--mute); }
.sheet-foot strong { display: block; color: var(--ink); font-family: var(--cond); font-weight: 800; }
.sheet-foot .btn { margin-left: auto; }

.card-nav { max-width: 50rem; margin: 1.5rem auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem; background: var(--tab); border-radius: 8px; color: var(--cloth-ink); font-family: var(--cond); font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.card-nav a small { display: block; font-family: var(--sans); font-weight: 600; font-size: 0.75rem; color: var(--cloth-mute); letter-spacing: 0.04em; text-transform: uppercase; }
.card-nav a.next { grid-column: 2; justify-content: flex-end; text-align: right; }
.card-nav a:hover { background: #3a3a41; }
@media (max-width: 34rem) { .card-nav { grid-template-columns: 1fr; } .card-nav a.next { grid-column: auto; } }
.back-wrap { max-width: 50rem; margin-inline: auto; }
.back { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; color: var(--cloth-mute); font-weight: 600; }
.back:hover { color: var(--cloth-ink); }

.video-frame { margin-top: clamp(1.25rem, 3vw, 2rem); width: 100%; aspect-ratio: 16 / 9; background: #000; border: 2px solid var(--keyline); border-radius: 6px; overflow: hidden; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.ext { font-weight: 700; display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---------- Footer ---------- */
.binder-foot { margin-top: clamp(2.5rem, 6vw, 4rem); border-top: 1px solid var(--sleeve-edge); color: var(--cloth-mute); font-size: 0.9rem; }
.binder-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.25rem 2.25rem; }
.binder-foot p { margin: 0; }
.binder-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.binder-foot a { color: var(--cloth-ink); font-weight: 600; }
.binder-foot a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* Cards in a row share row lines (subgrid), so art, band and foot align whatever the title length. */
@supports (grid-template-rows: subgrid) {
  .pocket, .card, .card > a { display: grid; grid-template-rows: subgrid; grid-row: span 5; row-gap: 0; }
  .card { height: auto; }
  .card > a { height: auto; }
  .card-head { align-self: start; }
  .card-foot { align-self: end; }
}
