:root {
  color-scheme: light;
  --ink: #243040;
  --muted: #667085;
  --paper: #fffaf2;
  --panel: #ffffff;
  --sun: #ffcf4a;
  --rose: #ff7a8a;
  --sky: #53a7ff;
  --mint: #58c7a5;
  --grape: #8a6df1;
  --line: #253044;
  --soft-line: #e7dcca;
  --shadow: 0 18px 40px rgba(36, 48, 64, 0.16);
  --paper-ratio: 2550 / 3300;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(0deg, rgba(83, 167, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 122, 138, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Trebuchet MS", system-ui, sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 207, 74, 0.88), rgba(255, 250, 242, 0.92) 48%, rgba(83, 167, 255, 0.34)),
    var(--panel);
}

.header-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 10px;
}

.header-ribbon span:nth-child(1) {
  background: var(--rose);
}

.header-ribbon span:nth-child(2) {
  background: var(--sun);
}

.header-ribbon span:nth-child(3) {
  background: var(--mint);
}

.header-ribbon span:nth-child(4) {
  background: var(--grape);
}

.header-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px 44px 26px 18px;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  background: var(--panel);
  color: #35613e;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 860px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 9vw, 74px);
  line-height: 0.96;
  letter-spacing: 0;
}

.count {
  margin: 14px 0 0;
  color: #45556c;
  font-size: 17px;
  font-weight: 800;
}

.gallery-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 42px 52px 14px;
}

.letter-section {
  scroll-margin-top: 16px;
  padding-top: 14px;
}

.letter-section h2 {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 0 12px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--sun);
  box-shadow: 5px 5px 0 rgba(36, 48, 64, 0.18);
  font-size: 25px;
  line-height: 1;
}

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.kid-card {
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 6px 6px 0 rgba(83, 167, 255, 0.26);
}

.paper-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--paper-ratio);
  overflow: hidden;
  border: 0;
  padding: 0;
  background: #f7f7f2;
  cursor: zoom-in;
}

.paper-button img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  background: #ffffff;
}

.card-footer {
  display: grid;
  gap: 8px;
  border-top: 3px solid var(--line);
  padding: 9px;
}

.card-footer h3,
.modal-toolbar h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0;
}

.card-footer a,
.modal-actions a,
.modal-actions button {
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--sun);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.card-footer a {
  display: grid;
  place-items: center;
  white-space: nowrap;
}

.alphabet-rail {
  position: fixed;
  top: 128px;
  right: 5px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  align-content: center;
  gap: 1px;
  width: 29px;
  border: 2px solid rgba(36, 48, 64, 0.18);
  border-radius: 8px;
  padding: 5px 3px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}

.alphabet-rail button {
  width: 100%;
  min-height: 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2465a7;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.alphabet-rail button.active {
  background: var(--sky);
  color: white;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(18, 26, 38, 0.7);
}

.modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1060px, 100%);
  height: min(94vh, 1060px);
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 3px solid var(--line);
  padding: 10px;
  background: linear-gradient(90deg, var(--sun), #ffffff 55%, rgba(88, 199, 165, 0.34));
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-actions button {
  display: grid;
  place-items: center;
  width: 38px;
  padding: 0;
  background: var(--rose);
  cursor: pointer;
}

.modal img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f3f5f8;
}

@media (min-width: 620px) {
  .header-inner {
    padding: 42px 58px 38px 28px;
  }

  .gallery-shell {
    padding: 24px 52px 64px 24px;
  }

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

  .card-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
  }

  .card-footer h3,
  .modal-toolbar h2 {
    font-size: 18px;
  }

  .alphabet-rail {
    right: 11px;
  }
}

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

  .gallery-shell {
    padding-right: 28px;
  }

  .alphabet-rail {
    right: 18px;
  }
}
