/* ==========================================================================
   Sunny Varkey K — Ink & Cobalt
   components.css — every component on the site. Values come from tokens.css.
   ========================================================================== */

/* --- 1. Base ------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-read);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4,
p,
figure,
dl,
dd,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

.gal-grid,
.notes__list,
.nav-panel__list,
.foot__list,
.videos__list {
  list-style: none;
}

a {
  color: var(--cobalt);
  text-decoration-color: color-mix(in oklab, var(--cobalt) 40%, transparent);
  text-underline-offset: 0.16em;
  text-decoration-thickness: from-font;
}

a:hover {
  color: var(--cobalt-deep);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
  border-radius: 1px;
}

::selection {
  background: var(--cobalt-soft);
  color: var(--ink);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 15px var(--s-5);
  font: 500 var(--fs-small) / 1 var(--font-ui);
}

.skip:focus {
  left: var(--s-3);
  top: var(--s-3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: calc(var(--measure-page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- 2. Type ------------------------------------------------------------- */

.display,
.page-title,
.sec__title,
.feature__title,
.note__title {
  font-family: var(--font-read);
  font-weight: 600;
  letter-spacing: var(--tr-h);
  line-height: var(--lh-h);
  text-wrap: balance;
}

.display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  /* Optical: pull the round left side of the "S" onto the container anchor
     that the rule, the lead and the actions all resolve to. */
  margin-left: -0.022em;
}

.page-title {
  font-size: var(--fs-h1);
  margin-left: -0.018em;
}

.sec__title {
  font-size: var(--fs-h2);
}

.feature__title,
.note__title {
  font-size: var(--fs-h3);
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--ink-2);
  max-width: var(--measure-lead);
  text-wrap: pretty;
}

.label {
  font: 500 var(--fs-micro) / 1.3 var(--font-ui);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.meta {
  font: 400 var(--fs-small) / var(--lh-small) var(--font-ui);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.prose {
  max-width: var(--measure-body);
  text-wrap: pretty;
}

.prose > * + * {
  margin-top: 1.05em;
}

.prose ul {
  padding-left: 1.15em;
  list-style: none;
}

.prose li {
  position: relative;
  margin-top: 0.42em;
}

.prose ul > li::before {
  content: "";
  position: absolute;
  left: -1.05em;
  top: 0.72em;
  width: 5px;
  height: 1px;
  background: var(--rule-strong);
}

.prose strong {
  font-weight: 600;
}

.prose img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-block: var(--s-6);
}

.prose ol {
  padding-left: 1.3em;
}

.prose ol li {
  padding-left: 0.15em;
}

.prose blockquote {
  border-left: 2px solid var(--cobalt);
  padding-left: var(--s-5);
  color: var(--ink-2);
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font: 400 var(--fs-small) / 1.5 var(--font-ui);
}

.prose th,
.prose td {
  padding: 0.65em 0.8em;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.note__body {
  overflow-wrap: anywhere;
}

.note__body a {
  overflow-wrap: anywhere;
}

/* --- 3. Header and navigation -------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-header__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  min-height: var(--header-h);
}

/* The channel's open-book mark, redrawn as a crisp SVG, sits beside the
   personal wordmark without being boxed or decorated again. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-h3);
  color: var(--ink);
  text-decoration: none;
  min-height: var(--tap);
}

.brand__mark {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: none;
}

.brand__word {
  font: 600 1em / 1 var(--font-read);
  letter-spacing: -0.012em;
  white-space: nowrap;
}

.nav {
  display: none;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.1vw, 32px);
  list-style: none;
}

.nav a {
  position: relative;
  display: block;
  padding: 14px 0 15px;
  font: 500 15.5px / 1 var(--font-ui);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover {
  color: var(--ink);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 2px;
  background: var(--cobalt);
  opacity: 0;
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a[aria-current="page"]::after {
  opacity: 1;
}

.menu-btn {
  position: relative;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font: 500 15.5px / 1 var(--font-ui);
  color: var(--ink);
}

.menu-btn::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 12px;
  width: calc(100% - 4px);
  height: 2px;
  background: var(--cobalt);
}

.nav-panel {
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.nav-panel[hidden] {
  display: none;
}

.nav-panel__list {
  padding-block: var(--s-2) var(--s-5);
}

.nav-panel__list a {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  font: 500 var(--fs-lead) / 1.2 var(--font-read);
}

.nav-panel__list a[aria-current="page"] {
  color: var(--cobalt);
}

.nav-panel__list li:last-child a {
  border-bottom: 0;
}

.nav-panel__contact {
  padding-top: var(--s-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-6);
}

@media (min-width: 768px) {
  .nav {
    display: block;
  }

  .menu-btn,
  .nav-panel {
    display: none;
  }

  .site-header__in {
    align-items: center;
    min-height: 0;
    padding-block: 8px;
  }
}

/* --- 4. Buttons and the action group ------------------------------------- */

.actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-3);
  margin-top: var(--s-7);
  max-width: var(--measure-lead);
}

.btn {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 50px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: 2px;
  font: 500 15.5px / 1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
}

.btn__arrow {
  margin-left: auto;
  font-size: 15px;
  line-height: 1;
  opacity: 0.8;
}

.btn--primary {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: var(--paper);
}

.btn--primary:hover {
  background: var(--cobalt-deep);
  border-color: var(--cobalt-deep);
  color: var(--paper);
}

.btn--ghost {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

/* The visible rule stays a text link; the hit area is expanded to 44px
   without changing the layout it sits in. */
.textlink {
  position: relative;
  font: 500 var(--fs-small) / 1 var(--font-ui);
  color: var(--cobalt);
  text-decoration: none;
  border-bottom: 1.5px solid color-mix(in oklab, var(--cobalt) 35%, transparent);
  padding-bottom: 3px;
  white-space: nowrap;
}

.textlink::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 44px;
  transform: translateY(-50%);
}

.textlink:hover {
  border-bottom-color: var(--cobalt);
}

@media (min-width: 600px) {
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    max-width: none;
  }

  .btn {
    padding: 0 var(--s-6);
  }

  .btn__arrow {
    margin-left: 0;
  }
}

/* --- 5. Hero ------------------------------------------------------------- */

.hero {
  padding-top: clamp(22px, 3.5vw, 44px);
  padding-bottom: var(--space-section);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 660px) auto;
  grid-template-areas:
    "name name"
    "copy portrait";
  column-gap: clamp(var(--s-6), 7vw, 88px);
  justify-content: start;
  align-items: start;
}

.hero__name {
  grid-area: name;
  margin-bottom: var(--s-6);
}

.hero__portrait-frame {
  grid-area: portrait;
  width: min(158px, 39vw);
  padding: 5px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  box-shadow: 8px 8px 0 var(--cobalt-soft);
}

.hero__portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--mist);
}

.hero__copy {
  grid-area: copy;
  max-width: 58ch;
}

.hero__role {
  font: 500 var(--fs-lead) / 1.35 var(--font-ui);
  color: var(--ink);
  letter-spacing: -0.005em;
}

.hero__lead {
  margin-top: var(--s-5);
  max-width: 58ch;
}

@media (max-width: 599px) {
  .hero__grid {
    display: flow-root;
  }

  .hero__portrait-frame {
    float: right;
    width: min(148px, 40vw);
    margin: 0 0 var(--s-4) var(--s-5);
  }

  .hero__role {
    font-size: 17px;
  }
}

@media (min-width: 768px) {
  .hero__portrait-frame {
    width: 162px;
    padding: 6px;
  }
}

@media (min-width: 1200px) {
  .hero__portrait-frame {
    width: 176px;
  }
}

/* Qualifications use the same row, with the fact itself carrying the weight
   instead of the label. */
.factlist {
  display: grid;
  gap: 0;
  margin-top: var(--space-block);
  border-top: 1px solid var(--rule-strong);
}

.factlist > div {
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}

.factlist dt {
  font: 500 15.5px / 1.35 var(--font-ui);
  color: var(--ink);
}

.factlist dd {
  margin-top: 2px;
  font: 400 var(--fs-small) / 1.4 var(--font-ui);
  color: var(--ink-2);
}

@media (min-width: 620px) {
  .factlist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--s-9);
  }
}

@media (min-width: 1024px) {
  .factlist {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- 6. Section frame ---------------------------------------------------- */

.sec {
  padding-top: var(--space-section);
  padding-bottom: 0;
}

.sec--band {
  background: var(--paper-2);
}

/* One owner for vertical rhythm: each section provides the space before its
   own heading. A page introduction already provides that first gap. */
.hero + .sec,
.page-head + .sec {
  padding-top: 0;
}

main > .sec:last-child {
  padding-bottom: var(--space-section);
}

.sec__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3) var(--s-6);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: var(--space-block);
}

.page-head {
  padding-top: clamp(28px, 5vw, 56px);
  padding-bottom: var(--space-block);
}

.page-head__lead {
  margin-top: var(--s-5);
}

.page-head__rule {
  margin-top: var(--space-block);
  border: 0;
  border-top: 1px solid var(--rule-strong);
}

.page-head--simple {
  padding-bottom: var(--s-8);
}

/* --- 7. Feature block (latest lesson, book) ------------------------------ */

.feature {
  display: grid;
  gap: var(--space-block);
  align-items: start;
}

.feature__meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid color-mix(in oklab, var(--amber) 45%, transparent);
  border-radius: 2px;
  color: var(--amber);
  font: 500 var(--fs-micro) / 1 var(--font-ui);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
}

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--mist);
  border-radius: 2px;
}

.thumb-link {
  position: relative;
  display: block;
  border-radius: 2px;
}

.thumb-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  border-radius: 2px;
  pointer-events: none;
}

.feature__text > * + * {
  margin-top: var(--s-4);
}

.lesson__topline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--rule);
}

.lesson__topline .vmeta__date {
  margin: 0;
  white-space: nowrap;
}

.feature--media .actions {
  margin-top: var(--s-6);
}

.feature__media > .tag {
  margin-bottom: var(--s-3);
}

.lesson__summary > * + * {
  margin-top: var(--s-4);
}

@media (min-width: 1024px) {
  .feature--media {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: var(--s-10);
  }

  .feature--media .feature__text {
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
  }

  .feature--media .feature__text > * + * {
    margin-top: 0;
  }

  .feature--media .vmeta,
  .feature--media .actions {
    justify-content: center;
  }

  .feature--media .actions {
    margin-top: 0;
  }
}

/* --- 8. Book ------------------------------------------------------------- */

/* Natural cover ratio is 1038:1500 (the verified Amazon product photograph).
   It is declared three ways — width/height attributes, aspect-ratio and
   object-fit — so no breakpoint, container or missing image can change its
   apparent proportion. */
.book-cover {
  display: block;
  width: min(100%, clamp(200px, 26vw, 340px));
  height: auto;
  aspect-ratio: 1038 / 1500;
  object-fit: contain;
  background: var(--mist);
  border-radius: 1px;
}

.book-figure {
  display: grid;
  gap: var(--s-4);
  justify-items: start;
}

.counts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--rule-strong);
  margin-top: var(--s-6);
  max-width: 540px;
}

.count {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}

.count dt {
  font: 600 20px / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  min-width: 3.1ch;
  text-align: right;
}

.count dd {
  font: 400 var(--fs-small) / 1.3 var(--font-ui);
  color: var(--ink-2);
}

@media (min-width: 400px) {
  .counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .count:nth-child(odd) {
    padding-right: var(--s-5);
    border-right: 1px solid var(--rule);
  }

  .count:nth-child(even) {
    padding-left: var(--s-5);
  }
}

.pubmeta {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-6);
  max-width: 540px;
}

.pubmeta > div {
  display: grid;
  grid-template-columns: 8.5ch minmax(0, 1fr);
  gap: var(--s-4);
  align-items: baseline;
}

.pubmeta dt {
  font: 500 var(--fs-micro) / 1.4 var(--font-ui);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  color: var(--ink-3);
}

.pubmeta dd {
  font: 400 var(--fs-small) / 1.4 var(--font-ui);
  color: var(--ink);
}

.format-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
}

.format-links a {
  color: var(--cobalt);
  text-underline-offset: 3px;
}

.feature--book .actions {
  justify-content: center;
  max-width: 540px;
  margin-top: var(--s-7);
}

.book-amazon {
  min-height: 54px;
  padding-inline: var(--s-7);
}

@media (min-width: 1024px) {
  .feature--book {
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    column-gap: var(--s-10);
  }

  .feature--book .feature__text {
    align-self: stretch;
    justify-self: center;
    width: min(100%, 600px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .feature--book .feature__text > * + * {
    margin-top: 0;
  }
}

@media (min-width: 1200px) {
  .feature--book .lead {
    max-width: none;
    white-space: nowrap;
    font-size: 20px;
  }
}

/* Earlier book: a typographic record, not an invented cover. */
.oldbook {
  display: grid;
  gap: var(--space-block);
  align-items: start;
  padding-top: var(--space-block);
  border-top: 1px solid var(--rule);
}

.oldbook__plate {
  width: min(100%, clamp(200px, 26vw, 340px));
  aspect-ratio: 1038 / 1500;
  background: var(--mist);
  border: 1px solid var(--rule-strong);
  border-radius: 1px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-6);
  text-align: left;
}

.oldbook__plate p {
  font: 500 clamp(19px, 2vw, 24px) / 1.22 var(--font-read);
  color: var(--ink-2);
  letter-spacing: -0.012em;
}

@media (min-width: 1024px) {
  .oldbook {
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    column-gap: var(--s-10);
  }
}

/* --- 9. Video lessons ---------------------------------------------------- */

.videos__list {
  display: grid;
  gap: var(--space-block) var(--s-7);
}

.video-card {
  display: grid;
  gap: var(--s-4);
  align-content: start;
}

.video-card__title {
  font: 600 var(--fs-h3) / 1.22 var(--font-read);
  letter-spacing: var(--tr-h);
}

@media (min-width: 600px) {
  .videos__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .videos__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- 10. Galleries ------------------------------------------------------- */

/* Teaching: grouped by the session named in the source caption, so 44
   documentary photographs read as 21 sessions rather than one wall. */
.gal-group + .gal-group {
  margin-top: var(--s-10);
}

.gal-group__title {
  font: 400 var(--fs-small) / 1.4 var(--font-ui);
  color: var(--ink-2);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule);
  text-wrap: pretty;
}

.gal-group__title b {
  font-weight: 500;
  color: var(--ink);
}

.gal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gal-item {
  display: block;
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--mist);
  border-radius: 1px;
  overflow: hidden;
}

.gal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gal-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  border-radius: 1px;
}

@media (min-width: 520px) {
  .gal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (min-width: 900px) {
  .gal-grid {
    gap: 16px;
  }
}

@media (min-width: 1200px) {
  .gal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}

/* Music: the photographs are of mixed orientation and each has its own
   caption, so they keep their true proportion in a column layout and are
   never cropped. */
.gal-mason {
  column-count: 2;
  column-gap: var(--s-4);
}

.mason__item {
  break-inside: avoid;
  margin: 0 0 var(--s-6);
  display: flow-root;
}

.mason__link {
  display: block;
  position: relative;
  background: var(--mist);
  border-radius: 1px;
}

.mason__link img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
}

.mason__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  border-radius: 1px;
}

.mason__item figcaption {
  margin-top: var(--s-3);
  font: 400 var(--fs-small) / 1.4 var(--font-ui);
  color: var(--ink-2);
}

@media (min-width: 768px) {
  .gal-mason {
    column-count: 3;
    column-gap: var(--s-6);
  }
}

/* --- 11. Lightbox -------------------------------------------------------- */
/* Markup is PhotoSwipe-shaped (data-pswp-gallery / data-pswp-width /
   data-pswp-height on the anchor), so the local build can swap in PhotoSwipe
   without touching a single element. */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--shade-veil);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--gutter);
  color: color-mix(in oklab, white 80%, transparent);
  font: 400 var(--fs-small) / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  padding-inline: var(--gutter);
  min-height: 0;
  overflow: hidden;
}

/* Never cropped: the full image is contained inside the stage. */
.lightbox__img {
  max-width: calc(100vw - (2 * var(--gutter)) - 96px);
  max-height: calc(100dvh - 142px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.lightbox__caption {
  padding: var(--s-4) var(--gutter) calc(var(--s-6) + env(safe-area-inset-bottom));
  color: color-mix(in oklab, white 88%, transparent);
  font: 400 var(--fs-small) / 1.5 var(--font-ui);
  text-align: center;
  max-width: 70ch;
  margin-inline: auto;
}

.lb-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  background: color-mix(in oklab, white 10%, transparent);
  border: 1px solid color-mix(in oklab, white 26%, transparent);
  border-radius: 2px;
  color: white;
  font: 500 var(--fs-small) / 1 var(--font-ui);
  cursor: pointer;
  padding: 0 var(--s-3);
}

.lb-btn:hover {
  background: color-mix(in oklab, white 20%, transparent);
}

.lb-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.lightbox__nav {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.lightbox__prev {
  left: max(var(--s-2), calc(var(--gutter) - var(--s-9)));
}

.lightbox__next {
  right: max(var(--s-2), calc(var(--gutter) - var(--s-9)));
}

@media (max-width: 599.98px) {
  .lightbox__img {
    max-width: calc(100vw - (2 * var(--gutter)));
    max-height: calc(100dvh - 188px);
  }

  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: calc(-1 * var(--s-11));
    transform: none;
  }

  .lightbox__prev {
    left: var(--gutter);
  }

  .lightbox__next {
    right: var(--gutter);
  }

  .lightbox__caption {
    padding-inline: calc(var(--gutter) + 52px);
  }
}

/* --- 12. English Notes --------------------------------------------------- */

.notes__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--space-block);
}

.search {
  display: grid;
  gap: 7px;
  flex: 1 1 260px;
  max-width: 420px;
}

.search span {
  font: 500 var(--fs-micro) / 1.3 var(--font-ui);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  color: var(--ink-3);
}

.search input {
  min-height: var(--tap);
  padding: 0 var(--s-4);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  font: 400 var(--fs-body) / 1 var(--font-ui);
  color: var(--ink);
  width: 100%;
}

.search input:focus-visible {
  outline: var(--focus);
  outline-offset: 1px;
  border-color: var(--cobalt);
}

.notes__month + .notes__month {
  margin-top: var(--space-block);
}

.notes__month h2 {
  font: 500 var(--fs-micro) / 1.3 var(--font-ui);
  letter-spacing: var(--tr-micro);
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--rule-strong);
}

.notes__columns {
  display: grid;
  gap: 0 var(--s-9);
}

.notes__list li {
  border-bottom: 1px solid var(--rule);
}

.notes__list li:last-child {
  border-bottom: 0;
}

@media (max-width: 899px) {
  .notes__list:not(:last-child) li:last-child {
    border-bottom: 1px solid var(--rule);
  }
}

.notes__list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: var(--tap);
  padding: 11px 0;
  color: var(--ink);
  text-decoration: none;
}

.notes__list a:hover .notes__t {
  color: var(--cobalt);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.notes__t {
  font: 400 var(--fs-body) / 1.35 var(--font-read);
}

.notes__list time {
  font: 400 var(--fs-micro) / 1.4 var(--font-ui);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: none;
}

.notes__empty {
  padding: var(--s-7) 0;
  color: var(--ink-2);
}

.notes__empty[hidden] {
  display: none;
}

@media (min-width: 900px) {
  .notes__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Individual note */
.note {
  padding-top: clamp(24px, 4vw, 44px);
  padding-bottom: var(--space-section);
}

.note__head {
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: clamp(32px, 4vw, 48px);
}

.note__title {
  font-size: var(--fs-h1);
  margin-left: -0.018em;
  max-width: 28ch;
}

.note__date {
  margin-top: var(--s-4);
}

.note__nav {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--space-section);
  padding-top: var(--space-block);
  border-top: 1px solid var(--rule-strong);
}

.note__nav a {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3) 0 var(--s-5);
  text-decoration: none;
  color: var(--ink);
}

.note__nav a:hover .note__nav-t {
  color: var(--cobalt);
}

.note__nav-t {
  font: 500 var(--fs-lead) / 1.3 var(--font-read);
}

@media (min-width: 700px) {
  .note__nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--s-9);
  }

  .note__nav > :last-child {
    text-align: right;
  }
}

/* --- 13. Photo strip (home teaching preview) ----------------------------- */

.strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-6);
}

.strip figcaption {
  margin-top: var(--s-3);
  font: 400 var(--fs-small) / 1.4 var(--font-ui);
  color: var(--ink-2);
}

.strip figure {
  margin: 0;
}

@media (min-width: 620px) {
  .strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-6);
  }
}

/* --- 14. Footer ---------------------------------------------------------- */

.site-footer {
  background: var(--ink);
  color: color-mix(in oklab, var(--paper) 86%, transparent);
  padding-block: clamp(32px, 5vw, 52px);
}

.foot__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
  list-style: none;
}

.foot__links a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  border: 1px solid color-mix(in oklab, var(--paper) 18%, transparent);
  border-radius: 2px;
  color: var(--paper);
  text-decoration: none;
  font: 500 var(--fs-small) / 1.2 var(--font-ui);
}

.foot__links a:hover {
  border-color: color-mix(in oklab, var(--paper) 55%, transparent);
  color: var(--paper);
}

.site-footer a:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.icon {
  display: block;
  width: 21px;
  height: 21px;
  flex: none;
  fill: currentColor;
}

.icon__cut {
  fill: var(--cobalt);
}

.btn--ghost .icon__cut {
  fill: var(--paper);
}

.foot__links .icon__cut {
  fill: var(--ink);
}

@media (min-width: 700px) {
  .foot__links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


/* --- 16. Books: phone centring, cover as a lightbox subject ------------- */

/* The cover and the placeholder centre on phones; text and metadata never do. */
.book-figure {
  justify-items: center;
  width: 100%;
}

.book-cover-link {
  display: block;
  position: relative;
  width: min(100%, clamp(220px, 62vw, 360px));
  border-radius: 1px;
}

.book-cover-link .book-cover {
  width: 100%;
}

.book-cover-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  border-radius: 1px;
}

.oldbook {
  justify-items: center;
}

.oldbook > .feature__text {
  justify-self: stretch;
}

@media (min-width: 1024px) {
  .book-figure,
  .oldbook {
    justify-items: start;
  }

  .book-cover-link {
    width: min(100%, 340px);
  }
}

/* --- 17. Video lessons: a metadata rail, not a pile of labels ----------- */

.vmeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.vmeta__ep {
  font: 600 var(--fs-small) / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.vmeta__series {
  position: relative;
  padding-left: var(--s-3);
  font: 400 var(--fs-small) / 1 var(--font-ui);
  color: var(--ink-2);
}

.vmeta__series::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 1em;
  border-left: 1px solid var(--rule-strong);
  transform: translateY(-50%);
}

.vmeta__date {
  display: block;
  margin-top: var(--s-3);
  font: 400 var(--fs-micro) / 1.3 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.channel-cta {
  display: grid;
  justify-items: center;
  gap: var(--s-4);
  max-width: 900px;
  margin: clamp(36px, 5vw, 56px) auto 0;
  padding: clamp(28px, 4vw, 42px) var(--gutter);
  background: var(--cobalt-soft);
  border-top: 2px solid var(--cobalt);
  text-align: center;
}

.channel-cta__logo {
  display: block;
  width: 92px;
  height: 92px;
  object-fit: contain;
}

.channel-cta h2 {
  font: 600 var(--fs-h2) / var(--lh-h) var(--font-read);
  letter-spacing: var(--tr-h);
}

.channel-cta p {
  max-width: 46ch;
  color: var(--ink-2);
  font: 400 var(--fs-lead) / var(--lh-lead) var(--font-read);
}

.channel-cta .btn {
  margin-top: var(--s-3);
}

@media (min-width: 760px) {
  .channel-cta {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    justify-items: start;
    align-items: center;
    column-gap: var(--s-7);
    row-gap: var(--s-2);
    text-align: left;
  }

  .channel-cta__logo {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .channel-cta h2 {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .channel-cta p {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
  }

  .channel-cta .btn {
    grid-column: 3;
    grid-row: 1 / 3;
    margin-top: 0;
  }
}

/* --- 18. Note cards: real titles and dates, nothing invented ------------ */

.note-cards {
  display: grid;
  gap: var(--s-3);
  list-style: none;
}

.note-card a {
  display: grid;
  gap: 6px;
  min-height: var(--tap);
  padding: var(--s-4) var(--s-5);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  text-decoration: none;
}

.note-card a:hover {
  border-color: var(--rule-strong);
}

.note-card a:hover .note-card__title {
  color: var(--cobalt);
}

.note-card__date {
  font: 400 var(--fs-micro) / 1.3 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.note-card__title {
  font: 400 var(--fs-body) / 1.35 var(--font-read);
  text-wrap: pretty;
}

@media (min-width: 620px) {
  .note-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
  }
}

@media (min-width: 1024px) {
  .note-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Index: months become sheets of paper. Rows stay compact, because 291 of
   them must not read as a catalogue of cards. */
.notes__month {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: var(--s-5) var(--s-6) var(--s-2);
}

.notes__month h2 {
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: var(--s-2);
}

/* --- 19. Credentials ---------------------------------------------------- */

.creds {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--space-block);
}

.creds > div {
  padding: var(--s-5);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.creds dt {
  font: 500 15.5px / 1.35 var(--font-ui);
  color: var(--ink);
  text-wrap: pretty;
}

.creds dd {
  margin-top: 4px;
  font: 400 var(--fs-small) / 1.45 var(--font-ui);
  color: var(--ink-2);
}

@media (min-width: 620px) {
  .creds {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
  }
}

@media (min-width: 1024px) {
  .creds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- 20. About slideshow ------------------------------------------------ */

.about-story {
  display: flow-root;
}

.about-story__prose {
  max-width: none;
}

.about-story__prose p {
  max-width: none;
}

.slides {
  position: relative;
  width: 100%;
  margin-bottom: var(--space-block);
}

/* A fixed stage plus a contained image: the documentary photograph is never
   cropped, and nothing reflows as the slide changes. */
.slides__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--mist);
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.slides__stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.slides__stage img[data-current] {
  opacity: 1;
}

.slides__cap {
  min-height: 1.45em;
  margin-top: var(--s-3);
  font: 400 var(--fs-small) / 1.45 var(--font-ui);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slides__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.slides__count {
  position: absolute;
  right: 0;
  font: 400 var(--fs-micro) / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.slides__btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--s-3);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink);
  font: 500 var(--fs-small) / 1 var(--font-ui);
  cursor: pointer;
}

.slides__btn:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

@media (min-width: 1100px) {
  .slides {
    float: right;
    width: clamp(460px, 42vw, 520px);
    margin: 0 0 var(--s-8) var(--s-8);
  }
}

/* --- 21. Music: one reading column, one voice --------------------------- */

.music-intro {
  max-width: 68ch;
  margin-inline: 0;
  text-align: left;
}

.music-intro p {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--ink-2);
  text-wrap: pretty;
}

.music-intro p:first-child {
  margin-bottom: var(--s-6);
}

/* --- 22. Individual note ------------------------------------------------ */

.note__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font: 500 var(--fs-small) / 1 var(--font-ui);
  color: var(--ink-2);
  text-decoration: none;
  margin-bottom: var(--s-3);
}

.note__back:hover {
  color: var(--cobalt);
}

.note__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-top: var(--s-5);
}

.share {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  margin-left: calc(var(--s-3) * -1);
  background: none;
  border: 0;
  border-radius: 2px;
  color: var(--ink-2);
  font: 500 var(--fs-small) / 1 var(--font-ui);
  cursor: pointer;
}

.share:hover {
  color: var(--cobalt);
}

.share__icon {
  width: 15px;
  height: 15px;
  flex: none;
}

.share__done {
  font: 400 var(--fs-micro) / 1 var(--font-ui);
  color: var(--ink-3);
}

.share__done[hidden] {
  display: none;
}

/* Imported archive markup: give the author's own structure a visible one.
   Nothing is reworded — loose text is wrapped, and a numbered point keeps the
   examples that illustrate it. */
.note-body {
  max-width: 62ch;
  /* the archive holds one 45-letter word; let it break rather than overflow */
  overflow-wrap: anywhere;
}

.note-body > * + * {
  margin-top: 1.05em;
}

.note-point + .note-point {
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--rule);
}

.note-point > * + * {
  margin-top: 0.9em;
}

.note-point__lead {
  color: var(--ink);
}

.note-body ul,
.note-body ol {
  padding-left: 1.5em;
  margin-left: 0;
}

.note-body ul {
  list-style: none;
}

.note-body li + li {
  margin-top: 0.5em;
}

.note-body ul > li {
  position: relative;
}

.note-body ul > li::before {
  content: "";
  position: absolute;
  left: -1.5em;
  top: 0.72em;
  width: 7px;
  height: 1px;
  background: var(--rule-strong);
}

.note-body ol > li::marker {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Examples stay tied to the point they illustrate. */
.note-point > ul,
.note-point > ol {
  padding-left: 1.5em;
  border-left: 2px solid var(--mist);
  margin-left: 2px;
}

/* --- 23. Motion ---------------------------------------------------------- */

.btn,
.nav a,
.textlink,
.lb-btn,
.gal-item img,
.mason__link img {
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.gal-item:hover img,
.mason__link:hover img {
  opacity: 0.86;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
