* {
    hyphens: auto;
}

/**
 * Loading indicator - animates DanNet title letters when fetching.
 * 
 * The animation has a ~1s idle period before any visible pulse, ensuring
 * quick fetches don't trigger the animation. Letter spacing also expands
 * with a matching 1s transition delay.
 */
#content.fetching {
    cursor: progress;
}

nav a.title span {
    display: inline-block;
    color: white;
}

/* nav precedes #content in DOM, so :has(~) checks following sibling state */
nav:has(~ #content.fetching) a.title {
    letter-spacing: 8px;
}

nav:has(~ #content.fetching) a.title span {
    animation: title-pulse 1.6s ease-in-out infinite;
}

/* Staggered animation delays create a wave effect across the 6 letters */
nav:has(~ #content.fetching) a.title span:nth-child(2) { animation-delay: 0.1s; }
nav:has(~ #content.fetching) a.title span:nth-child(3) { animation-delay: 0.2s; }
nav:has(~ #content.fetching) a.title span:nth-child(4) { animation-delay: 0.3s; }
nav:has(~ #content.fetching) a.title span:nth-child(5) { animation-delay: 0.4s; }
nav:has(~ #content.fetching) a.title span:nth-child(6) { animation-delay: 0.5s; }

/* 62% of 1.6s = ~1s idle before pulse; matches letter-spacing transition delay.
   The idle period also serves as the gap between pulses on repeat. */
@keyframes title-pulse {
    0%, 62% { transform: scale(1); }
    75% { transform: scale(1.3); }
    88%, 100% { transform: scale(1); }
}


button {
    cursor: pointer;
}

p {
    line-height: 1.5; /* looks better when wrapping to next line */
}

@keyframes fade-in {
  0% {opacity:0}
  100% {opacity:1}
}

@keyframes clear-up {
  0% {filter: blur(2px);}
  100% {filter: none;}
}

@keyframes fall-down {
  0% {
    transform: scale(1.1);
    filter: drop-shadow(0 16px 8px rgba(0,0,0,0.5));
    }
  100% {}
}

@keyframes slide-left {
  0% {transform: translateX(12px);}
  100% {}
}

@keyframes slide-right {
  0% {transform: translateX(-12px);}
  100% {}
}

@keyframes slide-down {
  0% {transform: translateY(-6px);}
  100% {}
}

@keyframes glow {
  0% {filter: hue-rotate(30deg);}
  100% {}
}

a {
    color: #0066BB;
    text-decoration: none;
    cursor: pointer;
}

/* TODO: fix this markup difference so 2-item selector isn't necessary. */
a:hover,
a:hover div.set > * {
    text-decoration: underline;
}

article.document a {
    transition: all 0.2s;
    text-decoration: underline;
    text-decoration-color: #0066BB55;
}

article.document a:hover {
    text-decoration-color: #0066BBFF;
}

html, body {
    padding: 0;
    margin: 0;
    height: 100%;
    background: #fff url(/images/exclusive-paper.png);
}

#app {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;

    color: #333;
    font-family: Georgia, serif;
    letter-spacing: 0.2ch;
}

@keyframes point {
  from {
    transform: translateX(4px);
  }
  to {
    transform: translateX(0);
  }
}

.help-overlay {
    opacity: 0;
    transition: opacity 1s;
    user-select: none;
}

.help-overlay__item {
    position: absolute;
    opacity: 0;
    animation:
        0.66s ease-in 5s forwards fade-in,
        0.33s ease-in infinite alternate point;
    text-transform: uppercase;
    left: 52px;
    z-index: 66;
    background: white;
    font-size: 12px;
    line-height: 1;
    padding: 2px 6px 0 6px;
    border-radius: 2px;
    border: 1px solid #AAA;
}

.help-overlay__item::before {
    content: "⭠";
    font-size: 24px;
    vertical-align: middle;
    margin-right: 8px;
}

#content {
    flex-grow: 1;
    overflow-y: auto;

    padding: 12px;

    /* Center content & footer horizontally. */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#content.full-screen {
    padding: 0;
    background: white;
}

#content.full-screen hr {
    border-top: 1px solid rgba(0,0,0,0.1);
}

main {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-grow: 1;
}

article.search table.attr-val + table.attr-val {
    margin-top: 48px;
    margin-bottom: 24px;
}

article.document {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 90ch;
}

article.document > div {
    padding: 16px;
}

article.document h1 {
    font-size: 48px;
    margin-bottom: 32px;
}

article.document p {
    margin: 1em 0 2em 0;
}

article.document {
    font-size: 18px;
}

article.document li > a:first-child {
    font-weight: bold;
    text-transform: uppercase;
}

/* This essentially works like sharpening/emboss effect on non-white text. */
#content *:not(.prefix) {
    text-shadow: 1px 0px rgba(255,255,255,0.8);
}
.prefix {
    text-shadow: none;
}

nav {
    transition: background 0.33s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
    background-color: #333;
    background: #333 url(/images/exclusive-paper.png);
    box-shadow:
        0 0 12px rgba(0,0,0,0.8);
    border: 1px solid transparent;
    border-right: 1px solid rgba(0,0,0,0.5);
    z-index: 1;
}

nav a.title {
    /* letter-spacing transition has 1s delay to match loading animation */
    transition: all 0.2s, letter-spacing 0.3s ease-in-out 1s;
    color: white;
    opacity: 0.8;
    user-select: none;
    writing-mode: vertical-rl;
    text-orientation: sideways;
    font-size: 21px;
    line-height: 32px; /* centre align */
    margin: auto 0 -32px 0; /* account for fixed search element */
    padding: 0;
    font-variant: small-caps;
    justify-self: center;
    text-decoration: none;
    letter-spacing: 4px;
}

nav a.title:hover {
    text-decoration: none;
    opacity: 1;
    transform: scale(110%);
}

nav select.language {
    /* Remove default styling */
    color: transparent;
    border: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    transition: all 0.2s;
    opacity: 0.8;
    cursor: pointer;
    margin: auto 0 4px 0;
    width: 32px;
    height: 32px;
    font-size: 20px;
    background: transparent url(/images/globe.svg);
    background-size: 28px;
    background-repeat: no-repeat;
    background-position: center;
}

nav select.language:hover {
    opacity: 1;
    transform: scale(110%);
}

nav a.github {
    transition: all 0.2s;
    background-image: url("/images/GitHub-Mark-Light-120px-plus.png");
    background-size: 24px;
    background-repeat: no-repeat;
    background-position: center;
    width: 24px;
    height: 24px;
    opacity: 0.8;
    padding: 4px;
}

a.github:hover {
    opacity: 1;
    transform: scale(110%);
}
nav button.synset-details {
    transition: all 0.2s;
    border: none;
    background: none;
    background-image: url("/images/minus.svg");
    background-size: 26px;
    background-repeat: no-repeat;
    background-position: center;
    width: 32px;
    height: 32px;
    opacity: 0.8;
    padding: 4px;
}

nav button.synset-details.toggled {
    background-image: url("/images/plus.svg");
}

button.synset-details:hover {
    opacity: 1;
    transform: scale(110%);
}

nav.full-screen {
    background: white;
    box-shadow: none;
    border-right: 1px solid rgba(0,0,0,0.1);
}

/* Darken the icons in the nav bar in full-screen mode. */
nav.full-screen a.title,
nav.full-screen select.language,
nav.full-screen button.synset-details {
    filter: invert(1);
    opacity: 0.75;
}

form[role=search] {
    display: flex;
    flex-direction: column;
    transition: all 0s;
    position: fixed;
    margin: -5px 0 0 -5px;
    padding: 4px;
    opacity: 0.8; /* Same as text in h1 prefix badge. */
    width: 32px;
    min-height: 32px;
    background: url(/images/search.svg);
    background-repeat: no-repeat;
    background-position: 5px 5px; /* 4px - margin */
    background-size: 32px;
    z-index: 99;
}

form[role=search].search-active {
    transition: background-color 0.3s;
    opacity: 1;
    background: rgba(0,0,0,0.66) url(/images/back.svg);
    background-position: 12px 12px;
    background-repeat: no-repeat;
    background-size: 42px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    height: 100%;
    width: 100%;
    padding-top: 8px;
}

form[role=search]:not(.search-active) {
    cursor: pointer;
    transition: transform 0.2s;
}

form[role=search]:not(.search-active):hover {
    opacity: 1;
    transform: scale(110%);
}

.search-form__top {
    display: flex;
}

form[role=search]:hover input[role=combobox] {
    opacity: 0.5;
}

form[role=search] input[role=combobox]:not(:focus) {
    color: transparent;
}

form[role=search] input[role=combobox]:not(:focus)::placeholder {
    color: transparent;
}

form[role=search] input[role=combobox] {
    user-select: none;
    font-size: 16px; /* >= 16px prevents iOS Safari from zooming on focus */
    color: white;
    border: none;
    border-radius: 2px;
    width: 32px;
    min-height: 32px;
    padding: 0;
    opacity: 0;
}

form[role=search].search-active input[role=combobox] {
    flex-grow: 1;
    font-size: 32px;
    margin-left: 56px;
    color: #333;
    opacity: 0.9;
    padding: 2px 8px;
    position: sticky;
    top: 8px;
}

form[role=search] input[type=submit] {
    transition: transform 0.2s;
    letter-spacing: 2px;

    /* Hide when not in use as it otherwise blocks user input. */
    display: none;
}

form[role=search].search-active input[type=submit] {
    display: revert; /* Unhide when search is active. */
    position: static;
    opacity: 1;
    transition: color 0.2s;
    min-width: 64px;
    height: 52px;
    padding: 36px 12px 2px 12px;
    font-size: 12px;
    border: none;
    color:  rgba(255,255,255,0.33);
    cursor: pointer;
    background-color: transparent;
    background: url(/images/search.svg);
    background-repeat: no-repeat;
    background-position: center 2px;
    background-size: 36px 36px;
}

form[role=search].search-active input[type=submit]:hover {
     color: rgba(255,255,255,1);
}

form[role=search] p {
    display: none;
}

form[role=search] ul {
    display: none;
    cursor: default;
}

form[role=search].search-active ul {
    display: block;
    animation: fade-in 0.33s;
    margin: 0;
    /* almost 100 full screen of bottom padding (mobile keyboard fix) */
    padding: 8px 0 calc(100vh - 96px) 52px;
    overflow-y: auto;
}

/* larger dismiss area when no options are available */
form[role=search].search-active ul:empty {
    padding-bottom: 0;
}

form[role=search].search-active ul li {
    color: white;
    cursor: pointer;
    list-style-type: none;
    font-size: 20px;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    margin: 0 4px;
    padding: 8px;
    width: calc(100% - 84px);
}

form[role=search].search-active ul li:hover,
form[role=search].search-active ul li:focus {
    background: rgba(255,255,255,0.25);
}

/* Disable scrolling when search is focused (prevents iOS Firefox scroll issue) */
nav:has(form[role=search].search-active) ~ #content {
    overflow: hidden;
}

/* Darken the search icon in full-screen mode. */
nav.full-screen form[role=search]:not(.search-active) {
    filter: invert(1);
    opacity: 0.75;
}

article {
    max-width: 110ch;
}

article > section:last-child {
    margin-bottom: 12px;
}

header, footer {
    text-align: center;
}

hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.2);
    width: 100%;
    margin: 0 0 24px 0;
}

footer p {
    font-size: 14px;
    margin: 12px;
    padding: 0;
}

sub {
    font-size: 70%;
    opacity: 0.6;
    display: inline-block; /* nullifies text-decoration: underline */
}

.set__word {
    white-space: nowrap;
}

div.set {
    display: inline-flex;
    flex-basis: 100%;
}

span.marker {
    margin-right: 4px;
    color: rgba(0,0,0,0.66);
    cursor: help;
}

section.notes {
    margin-top: 24px;
}

p.subheading {
    text-align: center;
    font-size: 18px;
    margin: 0 0 24px 0;
    padding: 0;
    color: #666;
}

p.subheading select {
    font-size: 18px;
    padding: 2px 6px;
}

p.note {
    text-align: center;
    font-style: italic;
    font-size: 14px;
    margin: 24px 0 0 0;
    padding: 0;
    color: #666;
}

p.note + p.note {
    margin-top: 0;
}

p.note:last-child {
    margin-bottom: 0;
}

p.note strong {
    font-size: 24px;
    color: #333;
    vertical-align: middle;
}

.set__content {
    text-align: center;
    /* TODO: figure out a way to make ontotype big sets work better
             that doesn't rely on line-height being higher than 1
    */
    line-height: 1;
}

div.set__left-bracket {
    background: url(/images/set-left.svg) no-repeat left;
    margin-right: 0.5ch;
}

div.set__right-bracket {
    background: url(/images/set-right.svg) no-repeat right;
    margin-left: 0.5ch;
}

div.set__left-bracket,
div.set__right-bracket {
    min-width: 1ch;
    background-size: auto 100%;
    opacity: 0.4;
    transition: all 0.1s;
}
span.subtle {
    opacity: 0.33;
}

h1 sub {
    font-size: 50%;
}

h1 img {
    width: clamp(80px, 33vw, 420px);
}

.omitted {
    color: #AAA;
    font-style: italic;

}

table.attr-val col:nth-child(2) {
     min-width: 12ch;
}

table.attr-val col:nth-child(3) {
    width: 80ch;
}

span.prefix {
    background-color: #333;
    background: #333 url(/images/exclusive-paper.png);
    font-variant: small-caps;
    color: rgba(255,255,255,0.8);
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.33);
    padding: 2px 6px;
    margin-right: 6px;

    letter-spacing: 1px;
    padding-right: 4px; /* account for letter-spacing */
}

/* Truncatable prefix - shows ellipsis, expands on hover/focus */
span.prefix.truncatable {
    display: inline-block;
    max-width: 5ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
    cursor: zoom-in;
}

span.prefix.truncatable:hover,
span.prefix.truncatable:focus {
    max-width: unset;
    overflow: visible;
    text-overflow: unset;
}

span.prefix.truncatable:focus {
    outline: 2px solid #0066BB;
    outline-offset: 1px;
}

span.prefix__sep {
    display: none;
}

span.unknown {
    color: #999;
}
.prefix.unknown {
    background-color: white;
    border: 1px dashed #999;
    color: #999;
}

.prefix.dannet {
    background-color: #901a1e;
}
.prefix.w3c {
    background-color: #55f;
}
.prefix.meta {
    background-color: #019fa1;
}
.prefix.ontolex {
    background-color: #df7300;
}
.prefix.wordnet {
    background-color: #387111;
}
.dannet,
.dannet * {
    color: #901a1e;
}
.w3c,
.w3c * {
    color: #55f;
}
.meta,
.meta * {
    color: #019fa1;
}
.ontolex,
.ontolex * {
    color: #df7300;
}
.wordnet,
.wordnet * {
    color: #387111;
}
.unknown {
    color: #333;
}

[lang]:not(footer, footer *, h1 span, article)::after {
    content: attr(lang);
    margin-left: 0.4ch;
    vertical-align: top;
    font-size: 60%;
    opacity: 0.6;
    text-decoration: none;
    font-variant: small-caps;
    display: inline-block; /* nullifies text-decoration: underline */
}

h1 sup {
    user-select: none;
    margin-left: 0.4ch;
    vertical-align: top;
    font-size: 60%;
    opacity: 0.6;
    text-decoration: none;
    font-variant: small-caps;
}

header {
    margin-bottom: 32px;
}

footer {
    padding: 12px;
    margin-top: 12px;
}

dl {
    margin: 0;
    padding: 0px;
}

dt {
    font-size: 20px;
    font-weight: normal;
    padding: 12px 12px 0 12px;
    margin: 0;
    letter-spacing: 0.2ch;
    font-variant: small-caps;
    word-break: normal;
}

dd {
    margin: 12px 0 24px 0;
    padding: 8px 12px 12px 12px;
    font-size: 14px;
}

dd + dt {
    padding-top: 12px;
}

h1 {
    display: flex;
    justify-content: center;
    font-size: 32px;
    font-weight: normal;
    padding: 0;
    margin: 12px auto 24px auto;
    letter-spacing: 0.2ch;
    font-variant: small-caps;
    word-break: normal;
}

h1 span.prefix {
    align-self: center;
    transition: background 0.66s;
    background-color: #333;
    background: #333 url(/images/exclusive-paper.png);
    margin: -8px 8px 0 0;
    padding: 6px 12px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.33);
    color: rgba(255,255,255,0.8);

    letter-spacing: 6px;
    padding-right: 6px; /* account for letter-spacing */
}

h2 {
   font-size: 24px;
   font-weight: normal;
   text-align: center;
   margin: 36px 0 12px 0;
   padding: 0;
   font-variant: small-caps;
   letter-spacing: 0.2ch;
}

h3 {
   font-size: 18px;
   font-weight: normal;
   text-align: left;
   border-bottom: 1px solid rgba(0,0,0,0.1);
   margin: 36px 0 12px 0;
   padding: 0 0 4px 0;
   font-variant: small-caps;
   letter-spacing: 0.2ch;
}

h2::before {
    content: "⊱ ";
    opacity: 0.33;
}

h2::after {
    content: " ⊰";
    opacity: 0.33;
}

code,
pre.viewer-code {
    background: rgba(0,0,0,0.1);
    padding: 4px 2px 4px 4px; /* Right side accounts for word spacing. */
    border-radius: 2px;
}

pre.viewer-code {
    padding: 12px;
}

header > .rdf-uri {
    font-size: 14px;
    font-style: italic;
}

header > .rdf-uri .rdf-uri__prefix {
    color: #006699;
    opacity: 0.6;
}
header > .rdf-uri .rdf-uri__name {
    color: #006699;
    font-weight: bold;
}

.rdf-uri::before {
    content: "<";
    margin-right: 2px;
    opacity: 0.3;
}

.rdf-uri::after {
    content: ">";
    margin-left: 2px;
    opacity: 0.3;
}

/* For table to inherit. */
main > article {
    width: 100%;
}

table.attr-val {
    font-size: 16px;
    border-collapse: collapse;
    border: 1px solid rgba(0,0,0,0.5);
    box-shadow: 0 0 12px rgba(0,0,0,0.3);
    width: 100%;
}

table.attr-val table.attr-val {
    border: 1px solid rgba(0,0,0,0.2);
    box-shadow: 0 0 4px rgba(0,0,0,0.1);
}

/* border resets for inner tables */
table.attr-val table.attr-val td.attr-prefix,
table.attr-val table.attr-val td.attr-name {
     border-top:  none;
}
table.attr-val table.attr-val td.attr-name {
     border-right: none;
}

td.prefix {
    text-align: right;
    padding-right: 0;
    width: 1px;
}

td.prefix + td {
    padding-left: 0;
}

h1, h2, h3 {
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.2));
}

td {
    padding: 12px;
    vertical-align: top;
}

td.attr-prefix {
    padding-right: 0;
    text-align: right;
    width: 1px;
    white-space: nowrap;
}

td.attr-name {
    padding-left: 0;
    border-right: 1px solid rgba(0,0,0,0.33);
}

span.prefix + a,
span.hidden + a {
    display: inline-block;
}

td.attr-prefix,
td.attr-name {
    background: url(/images/exclusive-paper.png);
}

tr + tr td.attr-prefix,
tr + tr td.attr-name {
    border-top: 1px solid rgba(0,0,0,0.1);
}

/* Used to hide prefixes. */
.hidden,
.hidden * {
    display: none;
}

/* Fix alignment of prefix+name table cells with tall names, e.g. synsets. */
.attr-combo > span {
    vertical-align: top;
}

.qname {
    display: inline-flex;

    /* TODO: doesn't center properly with multiline names + lang tag... */
    align-items: center;
}

tr:nth-child(odd),
tr tr:nth-child(even) {
    background-color: white;
}

tr:nth-child(even),
tr tr:nth-child(odd) {
    background-color: #F2F2F2;
}

details {
    margin: 8px 0 0 0;
    border-top: 1px solid transparent;
}

details summary {
    cursor: pointer;
    border-radius: 2px;
    color: rgba(0,0,0,0.8);
    font-size: 12px;
    padding: 8px 0 8px 32px;
}

details summary:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

details[open] {
    border-top: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 12px;
}

ol {
    margin: 0;
    padding-left: 32px;
}

summary + ol {
    margin-top: 12px;
}

ol.three-digits {
    padding-left: 32px;
}
ol.three-digits + details > summary {
    padding-left: 32px;
}
ol.four-digits {
    padding-left: 48px;
}
ol.four-digits  + details > summary {
    padding-left: 48px;
}
ol.five-digits {
    padding-left: 52px;
}
ol.five-digits  + details > summary {
    padding-left: 52px;
}

li {
    padding-bottom: 1.5ch;
}

li:last-of-type {
    padding-bottom: 0;
}

li::marker {
    color: #999;
    font-size: 12px;
}

.synset-radial-container {
    transition: font-size 0.2s;
    padding: 12px;
    height: 100%;

    background: white;
    border: 1px solid rgba(0,0,0,0.5);
    box-shadow: 0 0 12px rgba(0,0,0,0.3);
}

#content.full-screen .synset-radial-container {
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

#content.full-screen .radial-tree {
    flex-grow: 1;
}

#content.full-screen > main > article {
    max-width: none;
    width: fit-content;
    flex-grow: 1;
}

.synset-radial-container .synset-radial__header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 0 0 12px 0;
    margin-bottom: 12px;
}

.synset-radial-container .synset-radial__metadata {
    display: flex;
    align-items: center;
    border-right: 1px solid rgba(0,0,0,0.1);
    margin: 0;
    padding-right: 12px;
    max-width: 20vw;
}

#content:not(.full-screen) .synset-radial__metadata,
#content:not(.full-screen) .synset-radial__footer {
    display: none;
}

.synset-radial-container .synset-radial__footer {
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: 12px;
    padding-top: 24px;
}

strong.pos-label {
    color: #333;
    font-variant: small-caps;
    padding: 4px 12px 4px 0;
    margin-right: 12px;
    border-right: 1px solid rgba(0,0,0,0.1);
}

.synset-radial-container .synset-radial__definition {
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.icon {
    height: 32px;
    width: 32px;
    padding: 12px;
    background-color: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 2px;
}

.icon:hover {
    border-color: #333;
}

.icon.maximize {
    background: url("/images/maximize.svg") center no-repeat;
    background-size: 20px 20px;
}

.icon.minimize {
    background: url("/images/minimize.svg") center no-repeat;
    background-size: 20px 20px;
}

.radial-tree {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.radial-tree-diagram {
    flex-grow: 1; /* Fix width in Safari. */
    text-align: center;
    display: flex;

    /* Always make sure the diagram to is fully visible. */
    max-height: calc(92vh - 45px - 24px);
}

svg.radial-tree-diagram__svg {
    max-height: calc(92vh - 45px - 24px);

    /*  The viewBow keeps the diagram the same, but additional width allows for
        certain long labels to avoid clipping. */
    width: 100%;
}

#content.full-screen .radial-tree-diagram,
#content.full-screen svg.radial-tree-diagram__svg {
    /* Always make sure the diagram to is fully visible. */
    max-height: calc(100vh - 104px);
}

/* More targeted transitions - only animate colors, not font sizes */
.radial-tree-diagram * {
    transition: fill 0.2s, stroke 0.2s, opacity 0.2s;
}

.radial-tree-legend-container {
    display: flex;
    border-left: 1px solid rgba(0,0,0,0.1);
}

ul.radial-tree-legend {
    min-width: fit-content;
    align-self: center;

    list-style: none;
    padding: 24px 12px;

    font-variant: small-caps;
    font-size: 14px;
}


ul.radial-tree-legend label {
    display: block;
    position: relative;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    padding: 6px 4px 6px 28px;
}

ul.radial-tree-legend input[type=radio] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.radial-tree-legend__bullet {
    width: 12px;
    height: 12px;
    border-radius: 12px;
    margin-right: 1ch;
    display: inline-block;
    align-self: center;
    transition: all 0.2s;

    position: absolute;
    top: 8px;
    left: 6px;
    background-color: #eee;
}

/* When ANY radio is checked, make unchecked ones appear inactive */
ul.radial-tree-legend:has(input[type=radio]:checked) input[type=radio]:not(:checked) ~ .radial-tree-legend__bullet {
    transform: scale(0.33);
    opacity: 0.33;
}

ul.radial-tree-legend > li {
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 0;
    margin-bottom: 1px;
}

ul.radial-tree-legend > li:hover  {
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
}

ul.radial-tree-legend > li:focus-within {
    border: 1px solid rgba(0,0,0,0.24);
}

.radial-item {
    text-underline-offset: 0.25ch;
    transition: font-size 0.2s;
    font-size: 16px;
}

.radial-item__de-emphasized {
    opacity: 0.1;
}

.radial-item:not(.radial-item__subject):hover {
    text-decoration: underline;
    cursor: pointer;
}

.radial-item__subject {
    /* Make the subject label easier to read in busy diagrams. */
    filter: drop-shadow(0 0.3ch 0.2ch white);

    transition: font-size 0.2s;
    font-size: 40px;
}

tspan.sense-paragraph {
    /* Use CSS custom property set by JavaScript, with responsive fallback */
    font-size: 10px;
    fill: #AAA;
}

.word-cloud-item {
    filter: grayscale(1) opacity(0.8);
    transition: all 0.2s;
}

.word-cloud-item__top {
    /*TODO: currently unused, find some purpose*/
}

/* Only reveal colours when hovering parent SVG container. */
svg:hover .word-cloud-item {
    filter: grayscale(0) opacity(1);
}

.word-cloud-item:hover {
    text-decoration: underline;
    cursor: pointer;
}

select.display-options {
    appearance: none;
    display: block;

    background: transparent url(/images/caret-down.svg) 0 center no-repeat;
    background-size: 14px;
    border: none;
    padding: 0 0 0 16px;
    font-size: 14px;

    color: black;
    cursor: pointer;
    opacity: 0.5;
}

select.display-options:hover {
    opacity: 1;
    text-decoration: underline;
}

* + select.display-options {
    margin-top: 8px;
}

/* ===========================================
   MEDIA QUERIES ALL GO HERE AT THE EVERY END.
   =========================================== */

@media only screen and (min-width: 180ch) {
    .help-overlay {
        opacity: 1;
    }
}

@media only screen and (min-width: 1200px) {
    /* Hide "fake" footer items until diagram view turns into single column view. */
    #content.full-screen .synset-radial__metadata .synset-radial__footer-item {
        display: none;
    }
    /* Make the fonts a bit bigger. */
    #content.full-screen  ul.radial-tree-legend,
    #content.full-screen  .synset-radial-container,
    #content.full-screen  .synset-radial-container dd {
        font-size: 18px;
    }
    #content.full-screen .radial-tree-legend__bullet {
        width: 14px;
        height: 14px;
        top: 10px;
    }
    #content.full-screen ul.radial-tree-legend label {
        padding-left: 32px;
    }
}

@media only screen and (max-width: 1200px) {
    .radial-tree {
        flex-direction: column;
        align-items: stretch;
    }
    .radial-tree-legend-container {
        border-left: none;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    ul.radial-tree-legend {
        columns: 3;
        margin: 0 auto;
    }
    #content.full-screen .synset-radial__metadata {
        order: 3;
        border-right: none;
        border-top: 1px solid rgba(0,0,0,0.1);

        /* TODO: why isn't it expanding?? */
        max-width: none;
        margin: 0;
        padding: 24px 0 0 0;
    }
    #content.full-screen .radial-tree-diagram,
    #content.full-screen svg.radial-tree-diagram__svg {
        max-height: calc(88vh - 45px - 24px);
    }
    /* Remove real footer items once the metadata column becomes the footer. */
    #content.full-screen .synset-radial-container .synset-radial__footer {
        display: none;
    }
}

/* Mobile view (minimalist) */
@media only screen and (max-width: 700px) {
    td.attr-name > [lang]:not(footer, h1 span, article)::after {
        content: "";
    }
    td {
        font-size: 14px;
    }
    header > .rdf-uri,
    table.attr-val table.attr-val td {
         font-size: 12px;
    }
    table.attr-val  table.attr-val col:nth-child(2) {
         min-width: 10ch;
    }
    h1 {
        font-size: 24px;
    }
    h2 {
        font-size: 18px;
    }
    #content {
        padding: 8px;
    }
    .synset-radial-container .synset-radial__definition {
        flex-direction: column;
        margin: 0 auto 0 0;
    }
    strong.pos-label {
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        padding: 4px 4px 8px 0;
        margin-right: 0;
        margin-bottom: 8px;
        align-self: flex-start;
    }
    .icon.maximize,
    .icon.minimize {
        align-self: flex-start;
    }

    /* Turn the nav bar horizontal on mobile. */
    .help-overlay {
        display: none;
    }
    #app {
        flex-direction: column;
    }
    nav {
        flex-direction: row;
        border: 1px solid transparent;
        border-bottom: 1px solid rgba(0,0,0,0.5);
    }
    nav a.title {
        writing-mode: initial;
        text-orientation: initial;
        margin: 0 auto;
    }
    nav select.language {
        margin: 0 4px 0 -40px;
    }
    /* Position search input below the nav bar to prevent iOS scroll issues */
    form[role=search].search-active .search-form__top {
        margin-top: 50px;
    }
    form[role=search].search-active {
        background-position: 12px 62px;
    }
}

@media only screen and (max-width: 750px) {
    .synset-radial-container {
        font-size: 14px;
    }
    ul.radial-tree-legend {
        columns: 2;
    }
}

@media only screen and (max-width: 600px) {
    .radial-item:not(.radial-item__subject) {
        font-size: 18px;
    }
}

@media only screen and (max-width: 500px) {
    p.note.desktop-only,
    td.attr-prefix > *,
    :not(h1) > span.prefix:not(.independent) {
        display: none;
    }
    table.attr-val col:nth-child(2) {
         min-width: 10ch;
    }
    ul.radial-tree-legend {
        columns: 1;
    }
    .radial-item:not(.radial-item__subject) {
        font-size: 20px;
    }
}

/* Hypernym ancestry chain */
ul.hypernym-chain {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

ul.hypernym-chain ul.hypernym-chain {
    padding-left: 1ch;
}

ul.hypernym-chain ul.hypernym-chain  {
    margin: 0.8em 0;
}

*:not(ul.hypernym-chain) > li > ul.hypernym-chain li:first-child {
    margin-top: 0;
}

ul.hypernym-chain li::before {
    content: "↳";
    color: #333;
    margin-right: 1ch;
    font-size: 1em;
    vertical-align: middle;
}

ul.hypernym-chain .set__left-bracket,
ul.hypernym-chain .set__right-bracket {
    display: none;
}

ul.hypernym-chain .set__content {
    text-align: left;
}

/* Subject item in hypernym chain - no arrow, styled as inactive */
ul.hypernym-chain > li.subject::before {
    content: "";
    margin-right: 0;
}

ul.hypernym-chain > li.subject {
    color: #333;
}

/* Error boundary fallback */
details.render-error[open] {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10000;
    padding: 1em;
    margin: 0;
    overflow: auto;
    box-sizing: border-box;
}

details.render-error > summary {
    font-size: inherit;
}

/* Inline render error (red squiggly underline) */
span.render-error {
    text-decoration: underline wavy red;
    text-underline-offset: 5px;
    cursor: help;
}
