/* App-specific overrides — general design system lives in main.css */

.printable {
    margin: 10%;
    font-size: 18px;
}

.adminLink {
    font-size: 11px;
}

.errorMsg, .warning {
    border-radius: 6px;
    font-size: 14px;
    padding: 12px 18px;
    margin: 12px auto;
    max-width: 560px;
}

.missingCount {
    color: #CC3333;
    font-weight: 600;
}

.customConcentrations {
    display: none;
}

#searchResults {
    text-align: left;
    border: 0;
}

#searchResults .resultTitle {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 28px 0 10px;
    width: 100%;
}

#searchResults .compoundSearchResults:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.09), 0 2px 5px rgba(0,0,0,.05);
    transform: translateY(-1px);
}

#searchResults .compoundSearchResults .column1 {
    width: 18%;
    font-weight: 500;
    text-align: left;
}

#searchResults .compoundSearchResults .column2 {
    width: 56%;
    text-align: left;
}

#searchResults .compoundSearchResults .column3 {
    width: 26%;
    text-align: center;
}

#searchResults .enzymeSearchResults .reactionLink {
    color: var(--accent, #1B5FA8);
}

#searchResults .enzymeSearchResults .viewAllLink {
    color: var(--sidebar-leaf, #4D9FD6);
}

#searchResults .image img {
    border: none;
    max-height: 120px;
}

.parsedRxn, .compoundSelector, .compound, .enzyme {
    font-size: 22px;
    margin: 20px 0 14px;
    width: 100%;
}

.reactionController, .parsedRxn {
    text-align: center;
}

/* The reverse button: a pill around the equilibrium sign, drawn as two harpoons.
   main.js makes them swap places, each gliding clockwise along a rounded track,
   round the end and onto the other's side, which looks the same as before, to say
   that the button does something: once 2 s after the page loads, and once more
   whenever the mouse moves onto the button. See parsed_reaction.html.
   At rest, and without JavaScript, it is the plain sign. */
.reverseArrows {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    padding: 0.15em 0.5em;
    margin: 0 0.3em;
    border: 1px solid rgba(27, 95, 168, 0.35);
    border-radius: 999px;
    background: rgba(27, 95, 168, 0.06);
    font-size: inherit;
    font-family: inherit;
    color: var(--accent, #1B5FA8);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.reverseArrows:hover, .reverseArrows:focus-visible {
    background: rgba(27, 95, 168, 0.14);
    border-color: var(--accent, #1B5FA8);
}

.reverseArrows:focus-visible {
    outline: 2px solid var(--accent, #1B5FA8);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .reverseArrows { min-height: 44px; min-width: 56px; }
}

.rev-svg {
    display: block;
    width: 2em;
    height: 1em;
    overflow: visible;
    pointer-events: none;
}

.rev-track {
    fill: none;
    stroke: none;
}

.rev-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* the shafts are the 32 long straight sides of the track (its length is 101.699),
   one dash each; main.js moves them along it */
.rev-b1, .rev-b2 {
    stroke-dasharray: 32 69.699;
}
.rev-b1 { stroke-dashoffset: 0; }
.rev-b2 { stroke-dashoffset: -50.850; }

.panelTitleRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panelTitleRow .resetConcBtn,
.panelTitleRow #shareBtn {
    margin: 0 0 0 auto;
}

/* the round x that closes the reactant abundances panel, after its Reset button */
.closePanelBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2em;
    height: 2em;
    margin-left: 0.6em;
    padding: 0;
    border: 1px solid rgba(27, 95, 168, 0.35);
    border-radius: 50%;
    background: rgba(27, 95, 168, 0.06);
    color: var(--accent, #1B5FA8);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.closePanelBtn svg {
    width: 1.1em;
    height: 1.1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.closePanelBtn:hover, .closePanelBtn:focus-visible {
    background: rgba(27, 95, 168, 0.14);
    border-color: var(--accent, #1B5FA8);
}

.closePanelBtn:focus-visible {
    outline: 2px solid var(--accent, #1B5FA8);
    outline-offset: 2px;
}

.thermoTable td:first-child {
    width: 20%;
}

.thermoTable .fieldCell {
    width: 35%;   /* room for a plot button, a field and a phase box (Reactant Abundances);
                     the same in every panel, so that the sliders line up */
}

input[type="number"].invalidAbundance {
    background-color: #fbdada;
}

/* The condition sliders (reactant abundances, pH, pMg, ionic strength; see
   condition_sliders.js): a native range input, with tick marks and labels under it */
.rangeSlider {
    display: block;
    width: 100%;
    margin: 0.3em 0 0 0;
    accent-color: var(--accent, #1B5FA8);
    cursor: pointer;
}
/* the native thumb is about 16px wide, so the track's ends sit 8px in from the
   slider's ends; --f is a mark's position along the track, from 0 to 1 */
.sliderScale {
    position: relative;
    height: 1.6em;
    margin-top: 1px;
    font-size: 0.75em;
    color: #777;
}
.sliderScale .tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 4px;
    background: #aaa;
    left: calc(8px + (100% - 16px) * var(--f));
}
.sliderScale .tick.default {
    height: 7px;
    width: 2px;
    background: var(--accent, #1B5FA8);
    opacity: 0.6;
}
.sliderScale .label {
    position: absolute;
    top: 8px;
    transform: translateX(-50%);
    white-space: nowrap;
    left: calc(8px + (100% - 16px) * var(--f));
}
/* labels at the very ends (e.g. "500 mM") would stick out past the slider: keep them in */
.sliderScale .label.atStart {
    transform: translateX(-8px);
}
.sliderScale .label.atEnd {
    transform: translateX(calc(-100% + 8px));
}
/* too narrow for every label: declutter in condition_sliders.js hides some */
.sliderScale .label[hidden] {
    display: none;
}

/* the pH, pMg and ionic-strength fields next to their sliders: the same width as the
   abundance fields, and no spinner arrows on the number fields */
input.paramField {
    width: 6.5em;
}
input[type="number"].paramField {
    -moz-appearance: textfield;
    appearance: textfield;
}
input[type="number"].paramField::-webkit-inner-spin-button,
input[type="number"].paramField::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input.paramField.invalidAbundance {
    background-color: #fbdada;
}

/* reactant abundance: the slider (log scale) and a text field that takes a unit */
/* reactant abundance rows, laid out as the Aqueous Parameters rows: the plot button,
   the text field (with a unit) and the phase in the field cell, the slider (log scale)
   in the next one */
.abundanceFields {
    display: flex;
    align-items: center;
    flex-wrap: wrap;   /* the phase under the field where the cell is narrow (a phone) */
    gap: 0.6em;   /* as the space between the plot button and the field in the other panel */
}
/* only where the page has plot buttons (dg_plots.js marks the table); the compound
   page has none, also in its Aqueous Parameters panel */
.abundanceTable:not(.withPlots) .plotSlot {
    display: none;
}
.plotSlot {
    flex: none;
    display: inline-flex;
    width: 30px;   /* as wide as the plot button, also in rows without one */
}
.abundanceText {
    flex: none;
    width: 6.5em;
}
.abundanceText.textSlot {   /* rows with no abundance (water, the electron): an empty slot */
    display: inline-block;
    visibility: hidden;
}
/* the abundance field and the phase box (a dropdown, or plain text when there is only
   one phase) get one explicit height, as browsers size inputs and selects differently */
.abundanceText,
.phaseControl {
    box-sizing: border-box;
    height: 30px;   /* the natural height of a one-line field here */
    vertical-align: middle;
}
.phaseControl {
    width: 7.5em;
}
.phaseFixed {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);   /* greyed, as it can't be changed */
    color: var(--text-2);
    font-size: 14px;
}
.abundanceText.invalidAbundance {
    background-color: #fbdada;
}

.staleThermo {
    opacity: 0.35;
    pointer-events: none;
}

table.compoundInfo {
    width: 100%;
}

.mui-table .column1 {
    width: 22%;
    font-weight: 500;
}

.compoundInfo .column2 {
    width: 60%;
}

.compoundInfo .column3 {
    width: 20%;
}

table.enzymeInfo {
    width: 100%;
}

.results td,
.compoundInfo td,
.speciesInfo td,
.enzymeInfo td,
.reactionInfo td,
.formationEnergyInfo td {
    padding: 10px 20px;
}

table.reactionInfo,
table.speciesInfo,
table.formationEnergyInfo {
    text-align: center;
    padding: 0;
}

.speciesSource.last td,
td.reference.border {
    border-bottom: 1px solid var(--border, #E1DDD6);
}

.refsList {
    text-align: left;
}

.refsList a {
    color: var(--sidebar-leaf, #4D9FD6);
}

#figureContainer {
    margin: 16px auto 36px;
    width: 600px;
    height: 300px;
}

#figureContainer #legendContainer {
    float: right;
}

#figureContainer #dgFigure {
    clear: both;
}

/* the plot buttons next to the pH, pMg and ionic-strength fields: a rounded square
   in the style of the other icon buttons (the abundances toggle, the panel's x), as
   tall as the field next to it */
.graphLink {
    float: left;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    margin-right: 8px;
    border: 1px solid rgba(27, 95, 168, 0.35);
    border-radius: 0.4em;
    background: rgba(27, 95, 168, 0.06);
    transition: background 0.15s, border-color 0.15s;
}

.graphLink img {
    width: 22px;
    height: 22px;
    opacity: .75;
    transition: opacity 0.15s;
}

.graphLink:hover, .graphLink:focus-visible {
    background: rgba(27, 95, 168, 0.14);
    border-color: var(--accent, #1B5FA8);
}

.graphLink:hover img, .graphLink:focus-visible img {
    opacity: 1;
}

.graphLink:focus-visible {
    outline: 2px solid var(--accent, #1B5FA8);
    outline-offset: 2px;
}

.inputfile {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.pathwayPageTable .column1 { width: 40%; }
.pathwayPageTable .column2 { width: 15%; }
.pathwayPageTable .column3 { width: 45%; }

/* the link to a compound's combustion reaction: a beaker with a flame in it, in a
   rounded square like the one round the reverse arrows. main.js makes the flame
   flicker, once 2 s after the page loads and once each time the pointer moves onto
   it (the `burning` class). */
.combustionLink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 0.5em;
    padding: 0.22em;
    border: 1px solid rgba(27, 95, 168, 0.35);
    border-radius: 0.4em;
    background: rgba(27, 95, 168, 0.06);
    color: var(--accent, #1B5FA8);
    transition: background 0.15s, border-color 0.15s;
}

.combustionLink svg {
    width: 1.3em;
    height: 1.3em;
    overflow: visible;
}

.combustionLink .glass, .combustionLink .rim, .combustionLink .ticks {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.combustionLink .glass { fill: rgba(27, 95, 168, 0.08); }
.combustionLink .ticks { stroke-width: 1.2; opacity: 0.7; }
.combustionLink .outer { fill: #F57C1F; }
.combustionLink .inner { fill: #FFD54A; }

.combustionLink .flame {
    transform-box: fill-box;
    transform-origin: 50% 100%;
}

.combustionLink:hover, .combustionLink:focus-visible {
    background: rgba(27, 95, 168, 0.14);
    border-color: var(--accent, #1B5FA8);
}

.combustionLink:focus-visible {
    outline: 2px solid var(--accent, #1B5FA8);
    outline-offset: 2px;
}

/* six flickers of 0.3 s, an even number so that it ends where it began */
.combustionLink.burning .flame {
    animation: flame-flicker 0.3s ease-in-out 6 alternate;
}

@keyframes flame-flicker {
    from { transform: scale(1, 1) skewX(0deg); }
    to { transform: scale(0.92, 1.12) skewX(-4deg); }
}

/* the button that opens the reactant abundances panel (the panel's round x closes it
   again): two test tubes in
   the same rounded square as the combustion beaker (see abundance_icon.html).
   main.js makes the liquids slosh, once 1 s after the page loads and once each time
   the pointer moves onto it (the `sloshing` class). */
.abundanceToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    padding: 0.22em;
    border: 1px solid rgba(27, 95, 168, 0.35);
    border-radius: 0.4em;
    background: rgba(27, 95, 168, 0.06);
    color: var(--accent, #1B5FA8);
    transition: background 0.15s, border-color 0.15s;
}

/* centred in its row */
p:has(> .abundanceToggle) { text-align: center; }

.abundanceToggle svg {
    width: 1.8em;
    height: 1.8em;
    overflow: visible;
}

.abundanceToggle .glass, .abundanceToggle .rim, .abundanceToggle .ticks {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.abundanceToggle .ticks { stroke-width: 1.2; opacity: 0.7; }
.abundanceToggle .liquid.left { fill: #D58C44; }  /* the colours of the logo */
.abundanceToggle .liquid.right { fill: #DAB5F7; }

/* each liquid stretches or shrinks from the bottom of its tube, so it stays inside */
.abundanceToggle .liquid {
    transform-box: fill-box;
    transform-origin: 50% 100%;
}

.abundanceToggle:hover, .abundanceToggle:focus-visible {
    background: rgba(27, 95, 168, 0.14);
    border-color: var(--accent, #1B5FA8);
}

.abundanceToggle:focus-visible {
    outline: 2px solid var(--accent, #1B5FA8);
    outline-offset: 2px;
}

/* the two levels move about 3 units in opposite directions, swinging less each time
   (two and a half swings), and come back to where they were */
.abundanceToggle.sloshing .liquid.left {
    animation: slosh-left 1.6s ease-in-out;
}

.abundanceToggle.sloshing .liquid.right {
    animation: slosh-right 1.6s ease-in-out;
}

@keyframes slosh-left {
    0%, 100% { transform: scaleY(1); }
    15% { transform: scaleY(1.2); }
    35% { transform: scaleY(0.84); }
    55% { transform: scaleY(1.11); }
    75% { transform: scaleY(0.94); }
    90% { transform: scaleY(1.02); }
}

@keyframes slosh-right {
    0%, 100% { transform: scaleY(1); }
    15% { transform: scaleY(0.67); }
    35% { transform: scaleY(1.27); }
    55% { transform: scaleY(0.82); }
    75% { transform: scaleY(1.1); }
    90% { transform: scaleY(0.97); }
}

/* the plot button at the end of each reactant's abundance row (dg_plots.js) */
.abundancePlotBtn {
    flex: none;
    padding: 0;
    cursor: pointer;
}

/* the abundance plot, in the graph overlay (footer.html) in place of its frame */
#graphModalDialog.compactModal {
    max-width: 820px;
    height: auto;
    max-height: 92vh;
}
#graphModalContent {
    padding: 18px 22px 14px;
    overflow: auto;
}
.abundancePlotTitle {
    font-weight: 600;
    margin: 0 40px 10px 0;   /* clear of the close button */
}
.abundancePlotCanvas {
    position: relative;
    height: min(420px, 60vh);
}
.abundancePlotSummary {
    margin: 12px 0 0;
    color: var(--text-2);
    font-size: 0.95em;
}

/* the plot buttons' tooltips ("Plot dG' response to pH"): shown at once on hover or
   keyboard focus, above the button, instead of the browser's delayed title */
.graphLink[data-tooltip] {
    position: relative;
}
.graphLink[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    border-radius: 4px;
    background: #222;
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 20;
}
.graphLink[data-tooltip]:hover::after,
.graphLink[data-tooltip]:focus-visible::after {
    opacity: 1;
}

/* the button on the front page that shows more examples (the panel opens on hover,
   main.js): an Erlenmeyer flask (examples_icon.html) in the same rounded square as the
   other icon buttons, with no bubbles. While the pointer is on it, bubbles form in the liquid, grow,
   and float up out of the neck, one after the other. */
.examplesButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    padding: 0.3em;
    border: 1px solid rgba(27, 95, 168, 0.35);
    border-radius: 0.4em;
    background: rgba(27, 95, 168, 0.06);
    color: var(--accent, #1B5FA8);
    transition: background 0.15s, border-color 0.15s;
}

.examplesButton svg {
    display: block;
    width: 36px;
    height: 36px;
    overflow: visible;
}

#examplesHover:hover .examplesButton {
    background: rgba(27, 95, 168, 0.14);
    border-color: var(--accent, #1B5FA8);
}

.examplesButton .glass, .examplesButton .rim {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.examplesButton .glass { fill: rgba(27, 95, 168, 0.08); }
.examplesButton .liquid { fill: #DAB5F7; }  /* the logo's purple */

.examplesButton .bubble {
    fill: #D58C44;  /* the logo's orange */
    stroke: currentColor;
    stroke-width: 0.9;
    transform-box: fill-box;
    transform-origin: 50% 50%;
    opacity: 0;  /* there are bubbles only while it bubbles */
}

#examplesHover:hover .examplesButton .bubble {
    animation: bubble-rise 1.65s ease-in infinite;
    animation-delay: var(--delay);
    /* until its turn comes, a bubble waits, not yet formed, in the liquid */
    animation-fill-mode: backwards;
}

@keyframes bubble-rise {
    0% { transform: translate(0, 0) scale(0); opacity: 1; }
    20% { transform: translate(0, -1px) scale(1); opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    #examplesHover:hover .examplesButton .bubble { animation: none; }
}
