:root {
  --bg: #f3efe6;
  --bg-deep: #e7e0d2;
  --ink: #1c1914;
  --muted: #5c564c;
  --accent: #2f5d50;
  --accent-soft: #d7e4de;
  --paper: #fffdf8;
  --line: #d2c9b8;
  --shadow: 0 18px 40px rgba(28, 25, 20, 0.08);
  --radius: 18px;
  --font-display: "Segoe UI", "Trebuchet MS", sans-serif;
  --font-body: "Segoe UI", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff9ee 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e4efe9 0%, transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: .5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(243, 239, 230, 0.86);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.brand::before {
  content: "";
  width: 1.2rem;
  height: 1.2rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3.2 3.5 10.2c-.3.25-.3.7 0 .95l.7.55c.25.2.6.2.85 0L12 5.9l6.95 5.8c.25.2.6.2.85 0l.7-.55c.3-.25.3-.7 0-.95L12 3.2zm-6.2 9.1V19c0 .55.45 1 1 1h3.7v-4.2c0-.55.45-1 1-1h2.1c.55 0 1 .45 1 1V20h3.7c.55 0 1-.45 1-1v-6.7l-7.3-6.05-7.3 6.05z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3.2 3.5 10.2c-.3.25-.3.7 0 .95l.7.55c.25.2.6.2.85 0L12 5.9l6.95 5.8c.25.2.6.2.85 0l.7-.55c.3-.25.3-.7 0-.95L12 3.2zm-6.2 9.1V19c0 .55.45 1 1 1h3.7v-4.2c0-.55.45-1 1-1h2.1c.55 0 1 .45 1 1V20h3.7c.55 0 1-.45 1-1v-6.7l-7.3-6.05-7.3 6.05z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand:hover {
  color: var(--paper);
  background: var(--accent);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.1rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.nav a:hover { color: var(--accent); }

.install-flash {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  color: var(--ink);
}
.install-flash ul { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--muted); }

.hero {
  padding: 2.5rem 0 1.5rem;
  animation: rise .6s ease both;
}
.brand-mark {
  margin: 0 0 .35rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--accent);
}
.hero h1 {
  margin: 0 0 .75rem;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.hub-header h1 {
  margin: 0 0 .75rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}
.lead {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1rem 0 3rem;
}
.section-link {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.section-link:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.section-name { font-weight: 750; font-size: 1.15rem; }
.section-hint { color: var(--muted); font-size: .92rem; line-height: 1.4; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding-top: 1.4rem;
  color: var(--muted);
  font-size: .92rem;
}
.breadcrumbs a { color: var(--accent); text-decoration: none; }

.hub-header { padding: 1rem 0 1.25rem; }

.neighbors {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.neighbors a {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
}
.neighbors a:hover { background: var(--accent); color: var(--paper); }

.hub-facets {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.hub-facets a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  padding: .4rem .75rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
}
.hub-facets a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hub-facets a.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.hub-facets .facet-count {
  opacity: .72;
  font-weight: 600;
  font-size: .8rem;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}
.sheet-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: rise .55s ease both;
}
.sheet-open {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  text-decoration: none;
}
.sheet-open img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 560;
  object-fit: cover;
  background: #f7f4ec;
}
.sheet-card-title {
  display: block;
  padding: 0.55rem 0.65rem 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
}
.sheet-card-meta {
  display: block;
  padding: 0 0.65rem 0.65rem;
  font-size: 0.8rem;
  color: var(--muted, #6b6560);
}
.scene-header .muted {
  margin-top: 0.35rem;
}

.sheets-heading {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.collages {
  padding: 0.5rem 0 2rem;
}
.collages-heading {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.collages-list {
  display: grid;
  gap: 1.1rem;
}
.collage {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
  animation: rise .55s ease both;
}
.collage:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.collage-mosaic {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}
.collage-mosaic img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 8px;
  background: #f7f4ec;
  display: block;
}
.collage-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.35rem;
}
.collage-title {
  font-weight: 750;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.collage-count {
  color: var(--accent);
  font-weight: 650;
  font-size: 0.9rem;
}
.collage-hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.pagination {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  padding-bottom: 2.5rem;
}
.pagination a {
  min-width: 2.2rem;
  text-align: center;
  padding: .4rem .55rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--paper);
}
.pagination a.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 1.5rem 0 2rem;
  margin-top: 1rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
}
.footer-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.footer-nav a:hover { text-decoration: underline; }

.legal-page {
  max-width: 42rem;
  padding-bottom: 2.5rem;
}
.legal-page h1 {
  margin: 0 0 .75rem;
}
.legal-page h2 {
  margin: 1.75rem 0 .5rem;
  font-size: 1.15rem;
}
.legal-page ul {
  margin: .5rem 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.55;
}
.legal-page p {
  line-height: 1.55;
  color: var(--muted);
}
.legal-page .lead {
  color: var(--ink);
}
.legal-note {
  margin-top: 2rem;
  font-size: .9rem;
}

.modal-license {
  margin: 0 0 1rem;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--muted);
}
.modal-license a {
  color: var(--accent);
  font-weight: 600;
}

.hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(0.5rem, env(safe-area-inset-top, 0px))
           max(0.75rem, env(safe-area-inset-right, 0px))
           max(0.5rem, env(safe-area-inset-bottom, 0px))
           max(0.75rem, env(safe-area-inset-left, 0px));
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  animation: fade .2s ease both;
}
.modal-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 1.5rem));
  max-height: min(96vh, 100dvh - 1rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: pop .25s ease both;
}
.modal-close {
  position: absolute;
  top: .65rem;
  right: .65rem;
  z-index: 2;
  border: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--bg-deep);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}
.modal-body {
  padding: 1.1rem 1.25rem 1.4rem;
  overflow: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1;
}
.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(16rem, 0.85fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
}
.modal-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.modal-sheet {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(72vh, 820px);
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.modal-example-fig {
  margin: 1rem 0 0;
  width: min(100%, 280px);
  text-align: left;
}
.modal-example-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
  text-align: left;
}
.modal-example {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(42vh, 360px);
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 20px rgba(28, 25, 20, 0.06);
}
.example-zoom {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(12, 12, 12, 0.88);
  cursor: zoom-out;
}
.example-zoom img {
  max-width: min(920px, 96vw);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  cursor: default;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.example-zoom-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.sheet-page {
  padding-bottom: 2rem;
}
.sheet-page-layout {
  margin-bottom: 0.5rem;
}
.sheet-page #modal-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  padding-right: 0.5rem;
}
.modal-info #modal-title.visually-hidden + .modal-meta {
  margin-top: 0;
}
.modal-howto {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .75rem 0;
}
.badge {
  font-size: .8rem;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--muted);
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1rem 0;
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: .7rem 1rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.btn:disabled {
  opacity: .55;
  cursor: wait;
}
.btn-secondary {
  background: var(--bg-deep);
  color: var(--ink);
}
.ad-slot {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: linear-gradient(135deg, #f6f1e6, #e8f0eb);
  color: var(--muted);
  min-height: 90px;
  display: grid;
  place-items: center;
  text-align: center;
}
.progress {
  height: 8px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  margin: .5rem 0 1rem;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s linear;
}
.modal-more-wrap {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1.25rem;
}
.modal-more {
  min-width: 0;
}
.modal-more-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.modal-more-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.modal-more-related .modal-more-title {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.92rem;
}
.more-rail {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding: 0.15rem 0.15rem 0.55rem;
  margin: 0 -0.15rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.more-card {
  flex: 0 0 auto;
  width: 7.25rem;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  scroll-snap-align: start;
  color: inherit;
  text-decoration: none;
}
.modal-more-series .more-card {
  width: 8.1rem;
}
.more-card-media {
  display: block;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 6px 16px rgba(28, 25, 20, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.more-card:hover .more-card-media,
.more-card:focus-visible .more-card-media {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(28, 25, 20, 0.1);
}
.more-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.muted { color: var(--muted); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collage {
    grid-template-columns: 1fr;
  }
  .collage-mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .modal-layout {
    grid-template-columns: 1fr;
  }
  .modal-sheet {
    max-height: min(58vh, 560px);
  }
  .modal-example-fig {
    width: min(100%, 240px);
  }
  .modal-example {
    max-height: min(36vh, 280px);
  }
  .modal-info {
    padding-right: 0;
  }
}
