:root {
  color-scheme: light;
  --background: #ffffff;
  --surface: #f7f8f6;
  --text: #181a18;
  --text-soft: #414641;
  --muted: #687068;
  --line: #d9ddd8;
  --line-strong: #aeb6ae;
  --accent: #125f55;
  --blue: #2454d7;
  --red: #bd3f49;
  --green: #14734e;
  --mono: #6d746e;
  --content: 1000px;
  --reading: 760px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--background);
  transform: translateY(-170%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--background);
}

.header-inner {
  width: min(calc(100% - 2rem), var(--content));
  min-height: 3.6rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-name {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-header nav a {
  color: inherit;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--text); }

.site-header nav a[aria-current="page"] { font-weight: 650; }

main {
  width: min(calc(100% - 2rem), var(--content));
  margin: 0 auto;
}

.mathematical-note { padding: 4.5rem 0 5rem; }

.article-header {
  max-width: var(--reading);
  margin-bottom: 2.25rem;
}

.kicker,
.formula-label {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 1rem;
  font-family: var(--serif);
  font-size: clamp(2.45rem, 5vw, 3.9rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.abstract {
  margin-bottom: 0;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.7vw, 1.2rem);
}

.contents {
  margin-bottom: 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  font-size: 0.79rem;
}

.contents a {
  color: var(--muted);
  text-decoration: none;
}

.contents a:hover { color: var(--text); }

section {
  padding: 3.4rem 0;
  border-bottom: 1px solid var(--line);
}

h2 {
  max-width: 830px;
  margin-bottom: 1.25rem;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

section > p,
.section-grid > div > p {
  max-width: var(--reading);
  color: var(--text-soft);
}

.section-grid,
.coset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.coset-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  margin-top: 1.75rem;
}

.equation {
  max-width: 100%;
  margin: 1.3rem 0;
  overflow-x: auto;
  padding: 0.2rem 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.65;
}

.equation.compact {
  margin: 0;
  overflow: visible;
  font-size: 0.98rem;
}

.inline-equation {
  color: var(--text);
  font-family: var(--serif);
  white-space: normal;
}

.group-presentation {
  position: relative;
  display: inline-block;
}

.group-presentation-trigger {
  appearance: none;
  margin: 0;
  border: 0;
  border-bottom: 1px dotted currentColor;
  padding: 0 0.04em;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  cursor: help;
}

.group-presentation-trigger i {
  font: inherit;
}

.presentation-tooltip {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + 0.65rem);
  width: min(20rem, calc(100vw - 2rem));
  border: 1px solid var(--line-strong);
  border-radius: 0.35rem;
  padding: 0.8rem 0.9rem;
  background: var(--background);
  box-shadow: 0 0.65rem 1.8rem rgba(24, 26, 24, 0.13);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.25rem);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.presentation-tooltip strong,
.presentation-math,
.presentation-description {
  display: block;
}

.presentation-tooltip strong {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.presentation-math {
  font-family: var(--serif);
  font-size: 0.94rem;
}

.presentation-description {
  margin-top: 0.4rem;
  color: var(--text-soft);
}

.group-presentation:hover .presentation-tooltip,
.group-presentation:focus-within .presentation-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.boxed-math {
  display: inline-block;
  border: 1px solid var(--line-strong);
  padding: 0.02rem 0.3rem;
  color: var(--text);
  font-family: var(--serif);
  white-space: nowrap;
}

.rosette-figure {
  min-width: 0;
  margin: 0;
}

.rosette-stage {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  margin: 0 auto;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 0 11%, rgba(18, 95, 85, 0.035) 11.2% 11.7%, transparent 11.9%),
    var(--background);
}

.rosette-ring {
  position: absolute;
  z-index: -3;
  inset: 14%;
  border: 1px dashed rgba(104, 112, 104, 0.24);
  border-radius: 50%;
}

.rosette-center {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--text);
  transform: translate(-50%, -50%);
}

.motif {
  position: absolute;
  z-index: 3;
  width: 13%;
  min-width: 1.8rem;
  aspect-ratio: 0.86;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  color: var(--text);
}

.motif-glyph {
  display: block;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: clamp(1.35rem, 3.6vw, 2.2rem);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -0.1em;
  transform-origin: center;
  -webkit-text-stroke: 0.016em currentColor;
}

.motif-label {
  position: absolute;
  top: calc(100% - 0.1rem);
  left: 50%;
  width: max-content;
  transform: translateX(-50%);
  padding: 0.05rem 0.24rem;
  background: rgba(255, 255, 255, 0.9);
  color: currentColor;
  font-family: var(--mono);
  font-size: clamp(0.5rem, 1vw, 0.64rem);
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

[data-rosette="plain"] .motif-label { display: none; }
.motif.is-blue { color: var(--blue); }
.motif.is-red { color: var(--red); }
.motif.is-green { color: var(--green); }
.motif.is-mono { color: var(--mono); }
[data-rosette="plain"] .motif { color: var(--text); }

figcaption {
  max-width: 420px;
  margin: 0.7rem auto 0;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: center;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

th:first-child,
td:first-child { padding-left: 0; }

th:last-child,
td:last-child { padding-right: 0; }

.swatch {
  display: inline-block;
  width: 0.58rem;
  height: 0.58rem;
  margin-right: 0.45rem;
  border-radius: 50%;
}

.swatch.blue { background: var(--blue); }
.swatch.red { background: var(--red); }
.swatch.green { background: var(--green); }

.compact-note {
  max-width: var(--reading);
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.formula-pair {
  margin: 2rem 0 2.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
}

.formula-pair > div {
  min-width: 0;
  border-top: 2px solid var(--line-strong);
  padding-top: 0.85rem;
}

.figure-pair {
  max-width: 760px;
  margin: 0 0 2.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
}

.rosette-figure.small .rosette-stage { width: min(100%, 290px); }

.rosette-figure.small .motif-glyph {
  font-size: clamp(1.25rem, 3.2vw, 1.85rem);
}

.kernel-ray,
.stabilizer-axis {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 68%;
  height: 1px;
  transform: translate(-50%, -50%) rotate(var(--angle));
  transform-origin: center;
}

.kernel-ray {
  background: linear-gradient(90deg, transparent, var(--ray-color) 12% 88%, transparent);
  opacity: 0.3;
}

.stabilizer-axis {
  width: 76%;
  background: var(--blue);
  opacity: 0.35;
}

[data-rosette="stabilizer"] .motif:not(.is-blue) { opacity: 0.14; }

.ghk-table { margin-top: 1.5rem; }
.ghk-table td:first-child { font-weight: 650; }

.conclusion {
  max-width: var(--reading);
  margin: 2.2rem 0 1.5rem;
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.35rem;
}

.conclusion p { margin-bottom: 0.25rem; color: var(--text-soft); }

.notation-equation {
  margin: 0.55rem 0 1rem;
  color: var(--accent);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  white-space: nowrap;
}

.classification-table-wrap { margin-top: 1.7rem; }

.classification-table {
  min-width: 790px;
}

.classification-table td:first-child {
  font-weight: 700;
}

.classification-table .full-type {
  color: var(--accent);
  font-family: var(--serif);
  font-size: 0.98rem;
  white-space: nowrap;
}

.colour-count-groups {
  margin-top: 3.5rem;
}

.colour-count-group + .colour-count-group {
  margin-top: 4.5rem;
}

.colour-count-heading {
  max-width: var(--reading);
  margin-bottom: 0.25rem;
}

.colour-count-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 500;
  line-height: 1.2;
}

.colouring-example {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  margin-top: 1.6rem;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}

.colouring-example + .colouring-example {
  margin-top: 3rem;
}

.catalogue-rosette .rosette-stage {
  width: min(100%, 300px);
}

.catalogue-rosette .motif-glyph {
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
}

.example-details {
  min-width: 0;
}

.example-name {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.example-type {
  margin-bottom: 1.2rem;
  color: var(--accent);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  line-height: 1.25;
  white-space: nowrap;
}

.example-representation {
  margin-bottom: 1.1rem;
}

.representation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.representation-heading h4 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
}

.representation-palette {
  display: flex;
  gap: 0.28rem;
}

.palette-chip {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(24, 26, 24, 0.28);
  border-radius: 0.2rem;
  color: #fff;
  font: 700 0.68rem/1 var(--sans);
}

.palette-chip.mono { background: var(--mono); }
.palette-chip.blue { background: var(--blue); }
.palette-chip.red { background: var(--red); }
.palette-chip.green { background: var(--green); }

.example-representation table {
  border-block: 1px solid var(--line);
  font-size: 0.8rem;
}

.example-representation th,
.example-representation td {
  padding: 0.42rem 0.5rem;
  text-transform: none;
}

.example-representation th {
  width: auto;
  color: var(--text);
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
}

.example-representation .generator-key {
  display: inline-block;
  min-width: 2.15rem;
  margin-right: 0.45rem;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.example-representation .generator-key i {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.example-representation .generator-geometry {
  color: var(--text);
  line-height: 1.3;
}

.example-representation td {
  width: 5.5rem;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 700;
  white-space: nowrap;
}

.representation-relations {
  display: flex;
  gap: 0.65rem;
  margin: 0.55rem 0 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: 0.8rem;
  line-height: 1.45;
}

.representation-relations strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.035em;
}

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

.example-invariants {
  margin: 0;
  border-top: 1px solid var(--line);
}

.example-invariants div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.75rem;
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0;
}

.example-invariants dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.example-invariants dd {
  margin: 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: 0.86rem;
}

.example-note {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.article-footer {
  max-width: var(--reading);
  padding-top: 2.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.article-footer p { margin-bottom: 0.45rem; }

@media (max-width: 760px) {
  .header-inner {
    display: block;
    padding: 0.7rem 0;
  }

  .site-name {
    display: inline-block;
    margin-bottom: 0.45rem;
  }

  .site-header nav { justify-content: flex-start; }
  .site-header nav a:last-child { display: none; }
  .mathematical-note { padding-top: 3rem; }

  .section-grid,
  .coset-layout,
  .colouring-example {
    grid-template-columns: 1fr;
  }

  .rosette-figure {
    width: min(100%, 390px);
    margin: 0 auto;
  }

  .coset-layout .rosette-figure { grid-row: 1; }

  .colouring-example {
    max-width: 650px;
  }

  .catalogue-rosette {
    width: min(100%, 330px);
  }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .contents { display: block; }
  .contents a { display: block; padding: 0.18rem 0; }
  section { padding: 2.7rem 0; }
  .formula-pair,
  .figure-pair { grid-template-columns: 1fr; }
  .figure-pair { max-width: 320px; margin-inline: auto; }
  .colour-count-group + .colour-count-group { margin-top: 3.5rem; }
  .example-type { white-space: normal; }
  .representation-relations { display: block; }
  .representation-relations strong { display: block; margin-bottom: 0.2rem; }
  table { font-size: 0.78rem; }
  th,
  td { padding: 0.55rem 0.5rem; }
  .presentation-tooltip {
    right: auto;
    left: 50%;
    transform: translate(-50%, 0.25rem);
  }
  .group-presentation:hover .presentation-tooltip,
  .group-presentation:focus-within .presentation-tooltip {
    transform: translate(-50%, 0);
  }
}

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