:root {
  --pattern-ink: #171b19;
  --pattern-muted: #5d6864;
  --pattern-rule: #d4ded9;
  --pattern-soft: #f5f8f6;
  --pattern-accent: #00766b;
  --pattern-blue: #0072b2;
  --pattern-orange: #e69f00;
  --pattern-green: #009e73;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--pattern-ink);
  background: #fff;
}

.pattern-catalog-page {
  width: min(100% - 2rem, 1560px);
  margin: 0 auto;
  padding: clamp(1.8rem, 3.5vw, 3.8rem) 0 8rem;
}

.catalog-directory {
  margin-bottom: 3.5rem;
}

.catalog-directory h1 {
  max-width: 1050px;
  margin: 0;
  font-size: clamp(2.75rem, 6vw, 5.4rem);
  font-weight: 670;
  letter-spacing: -0.075em;
  line-height: 0.92;
}

.catalog-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.9rem 0 1.6rem;
  color: #44504c;
  font-size: clamp(0.92rem, 1.3vw, 1.08rem);
  line-height: 1.4;
}

.catalog-subtitle strong {
  color: var(--pattern-accent);
  font-weight: 720;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem 0.6rem;
  width: min(100%, 43.75rem);
  margin: 1.25rem auto 0;
}

.directory-family {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: 0.25rem;
  color: inherit;
  background: #fff;
  text-decoration: none;
}

.directory-family:hover,
.directory-family:focus-visible {
  background: #eef7f3;
}

.directory-family:focus-visible {
  outline: 2px solid var(--pattern-accent);
  outline-offset: 2px;
}

.directory-family strong {
  display: block;
  padding: 0 0.1rem 0.2rem;
  text-align: center;
  font: 700 clamp(0.95rem, 1.35vw, 1.2rem)/1 Georgia, "Times New Roman", serif;
}

.directory-family img {
  display: block;
  width: 100%;
  max-width: 7.875rem;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}

.directory-credit {
  max-width: 43.75rem;
  margin: 0.4rem auto 0;
  color: var(--pattern-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.directory-credit a {
  color: inherit;
  text-underline-offset: 0.16em;
}

.pattern-atlas {
  display: grid;
  gap: 6rem;
}

.wallpaper-family {
  min-width: 0;
  scroll-margin-top: 5rem;
}

.family-header {
  display: grid;
  grid-template-columns: minmax(11rem, 0.35fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 2rem;
  padding: 0 0 1.5rem;
  border-bottom: 1px solid var(--pattern-rule);
}

.family-header h2 {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0;
}

.family-orbifold {
  font: 700 clamp(2.6rem, 5vw, 5rem)/0.9 Georgia, "Times New Roman", serif;
  letter-spacing: -0.055em;
}

.family-hm {
  color: var(--pattern-muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.family-header p {
  margin: 0;
  color: #3f4a46;
  font-size: 1.05rem;
}

.colour-group-tabs,
.pattern-tabs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.55rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.colour-group-tabs {
  padding: 1.1rem 0 0;
}

.colour-group-tab {
  display: grid;
  grid-template-columns: minmax(7.2rem, auto);
  flex: 0 0 auto;
  min-width: 9.5rem;
  padding: 0.7rem 0.8rem 0.65rem;
  border: 1px solid var(--pattern-rule);
  border-bottom-color: #aebbb5;
  border-radius: 0.65rem 0.65rem 0 0;
  color: #4d5955;
  background: var(--pattern-soft);
  text-decoration: none;
}

.colour-group-tab:hover,
.colour-group-tab:focus-visible,
.colour-group-tab[aria-selected="true"] {
  border-color: #83978e;
  color: var(--pattern-ink);
  background: #fff;
  outline: none;
}

.colour-group-tab[aria-selected="true"] {
  border-bottom-color: #fff;
  box-shadow: inset 0 3px 0 var(--pattern-accent);
}

.colour-group-tab.is-trivial {
  order: 99;
  opacity: 0.52;
  filter: grayscale(1);
}

.colour-group-tab[hidden] {
  display: none;
}

.tab-name {
  min-height: 1.65rem;
  font: 700 1.15rem/1.1 Georgia, "Times New Roman", serif;
  white-space: nowrap;
}

.orbifold-star {
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", serif;
  font-size: 1em;
  font-style: normal;
  font-weight: inherit;
  letter-spacing: 0;
  vertical-align: baseline;
}

.tab-signature sup {
  font-size: 0.56em;
  line-height: 0;
  vertical-align: 0.68em;
}

.tab-palette {
  display: flex;
  width: 100%;
  height: 0.42rem;
  margin: 0.5rem 0 0.35rem;
  overflow: hidden;
  border: 1px solid #aab5b0;
  border-radius: 999px;
}

.tab-palette span {
  flex: 1 1 0;
  background: var(--swatch);
}

.colour-group-panel {
  margin-top: -1px;
  border: 1px solid var(--pattern-rule);
  background: #fff;
}

.book-evidence-link {
  display: inline-block;
  margin-top: 0.65rem;
  color: #315d55;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: underline;
  text-decoration-color: #91aaa1;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.19em;
}

.book-evidence-link:hover,
.book-evidence-link:focus-visible {
  color: var(--pattern-accent);
  text-decoration-color: currentColor;
}

.pattern-data {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.86rem, 1vw, 0.98rem);
}

.pattern-data th,
.pattern-data td {
  padding: 0.72rem 0.65rem;
  border-bottom: 1px solid var(--pattern-rule);
  text-align: left;
  vertical-align: top;
}

.pattern-data th {
  width: 38%;
  color: var(--pattern-muted);
  font-weight: 650;
}

.pattern-data tr:last-child th,
.pattern-data tr:last-child td {
  border-bottom: 0;
}

.pattern-selector {
  padding: 0.85rem clamp(1rem, 2vw, 1.75rem) 0;
}

.pattern-tab {
  flex: 0 0 auto;
  min-width: 7.2rem;
  padding: 0.58rem 0.75rem;
  border: 1px solid var(--pattern-rule);
  border-radius: 0.4rem 0.4rem 0 0;
  color: #51605a;
  background: var(--pattern-soft);
  font: 650 0.83rem/1.1 Georgia, "Times New Roman", serif;
  text-decoration: none;
  white-space: nowrap;
}

.pattern-tab:hover,
.pattern-tab:focus-visible,
.pattern-tab[aria-selected="true"] {
  border-color: #80958c;
  color: var(--pattern-ink);
  background: #fff;
  outline: none;
}

.pattern-tab[aria-selected="true"] {
  box-shadow: inset 0 3px 0 var(--pattern-accent);
}

.pattern-tab.is-disabled,
.pattern-tab[aria-disabled="true"] {
  border-color: #dce2df;
  color: #929b97;
  background: #f0f2f1;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.52;
  filter: grayscale(1);
}

.pattern-tab.is-disabled:hover,
.pattern-tab.is-disabled:focus-visible,
.pattern-tab[aria-disabled="true"]:hover,
.pattern-tab[aria-disabled="true"]:focus-visible {
  border-color: #dce2df;
  color: #929b97;
  background: #f0f2f1;
  outline: none;
}

.pattern-pane {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(20rem, 0.72fr);
  gap: clamp(1rem, 2vw, 2rem);
  padding: 0.75rem clamp(1rem, 2vw, 1.75rem) clamp(1rem, 2vw, 1.75rem);
}

.pattern-details {
  min-width: 0;
  align-self: start;
}

.pattern-plate {
  margin: 0;
  min-width: 0;
}

.pattern-plate svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 12 / 7;
  border: 1px solid #cdd8d3;
  background: #fffefa;
}

.generator-overlay {
  pointer-events: none;
}

.generator-axis-halo,
.generator-mirror-line,
.generator-glide-line,
.generator-rotation-halo,
.generator-rotation-arc {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.generator-axis-halo,
.generator-rotation-halo {
  stroke: rgba(255, 253, 247, 0.9);
  stroke-width: 6px;
}

.generator-mirror-halo,
.generator-mirror-line {
  stroke-dasharray: 11 8;
}

.generator-mirror-line,
.generator-glide-line,
.generator-rotation-arc {
  stroke: #7d2140;
  stroke-width: 2.15px;
}

.generator-glide-line {
  stroke-width: 1.9px;
}

.generator-rotation-arrow {
  fill: #7d2140;
  stroke: rgba(255, 253, 247, 0.88);
  stroke-width: 1.2px;
  paint-order: stroke fill;
  vector-effect: non-scaling-stroke;
}

.generator-rotation-centre {
  fill: #7d2140;
  stroke: #fffdf7;
  stroke-width: 2.3px;
  vector-effect: non-scaling-stroke;
}

.generator-label-backing {
  fill: #fffefa;
  stroke: var(--pattern-rule);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

.generator-label-leader {
  stroke: var(--pattern-accent);
  stroke-width: 1.3px;
  stroke-dasharray: 3 3;
  opacity: 0.72;
  vector-effect: non-scaling-stroke;
}

.generator-label {
  fill: var(--pattern-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.source-value-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32rem;
  margin: 0;
  color: var(--pattern-ink);
  font: 650 1.08rem/1.15 Georgia, "Times New Roman", serif;
  text-decoration-color: #7f9c92;
}

.source-value-link:hover,
.source-value-link:focus-visible {
  color: var(--pattern-accent);
}

.source-math-symbol {
  font: 650 1.08rem/1.15 Georgia, "Times New Roman", serif;
}

.ghk-expression {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 0;
  white-space: nowrap;
}

.ghk-separator {
  color: #809089;
  font-weight: 400;
}

.action-palette {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  color: var(--pattern-muted);
  font: 650 0.72rem/1 Arial, Helvetica, sans-serif;
  white-space: nowrap;
}

.action-colour {
  display: inline-grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border: 1px solid #53625c;
  border-radius: 0.2rem;
  color: #fff;
  background: var(--swatch);
  font: 700 0.72rem/1 Arial, Helvetica, sans-serif;
}

.action-colour:nth-child(2) {
  color: #17201d;
}

.group-presentation {
  margin: 0 0 1rem;
}

.presentation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.28rem;
}

.group-presentation h4 {
  margin: 0;
  color: var(--pattern-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.group-presentation table {
  width: 100%;
  border-collapse: collapse;
  border-block: 1px solid var(--pattern-rule);
  font-size: 0.78rem;
}

.group-presentation th,
.group-presentation td {
  padding: 0.38rem 0.45rem;
  border-bottom: 1px solid var(--pattern-rule);
  text-align: left;
  vertical-align: top;
}

.group-presentation th {
  color: var(--pattern-ink);
  font-weight: 500;
}

.group-presentation td:last-child {
  width: 5.5rem;
  color: var(--pattern-ink);
  white-space: nowrap;
}

.generator-key {
  display: inline-block;
  min-width: 1.45rem;
  margin-right: 0.36rem;
  color: var(--pattern-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1;
}

.generator-geometry {
  color: var(--pattern-muted);
  line-height: 1.25;
}

.presentation-permutation {
  color: var(--pattern-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.group-presentation tbody tr:last-child th,
.group-presentation tbody tr:last-child td {
  border-bottom: 0;
}

.presentation-relations {
  display: flex;
  gap: 0.6rem;
  margin: 0.5rem 0 0;
  color: var(--pattern-ink);
  font: 0.82rem/1.45 Georgia, "Times New Roman", serif;
}

.presentation-relations strong {
  flex: 0 0 auto;
  color: var(--pattern-muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.025em;
}

.presentation-relations span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-link-mark {
  color: var(--pattern-accent);
  font: 650 0.72rem/1 Arial, Helvetica, sans-serif;
}

.inline-short-signature sup {
  font-size: 0.58em;
  line-height: 0;
  vertical-align: 0.68em;
}

.noscript-note {
  padding: 1rem;
  border: 1px solid var(--pattern-rule);
}

@media (max-width: 1050px) {
  .pattern-pane {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .pattern-catalog-page {
    width: min(100% - 1rem, 1560px);
  }

  .directory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .family-header {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

}

@media (max-width: 330px) {
  .directory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-presentation td:last-child {
    width: 4.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
