/*
 * Port layer. Loads after the untouched 2013 stylesheets (normalize, Foundation 4, mellowpages.css).
 * Everything here is either a shim for the port or a legibility/accessibility fix that keeps the
 * 2013 look: white italic Times over the photo, dotted rules, transparent inputs.
 */

/* ---------- fonts & shims ---------------------------------------------------------------- */

/* 2013 loaded Vollkorn from a <link>; next/font self-hosts it under a generated family name. */
.homecontentlarger { font-family: var(--font-vollkorn), 'Vollkorn', serif; }

/* mellowpages.js faded sections and images in with jQuery; same timings in CSS. */
@keyframes mp-fade { from { opacity: 0; } to { opacity: 1; } }
.meat { animation: mp-fade 400ms ease-out; }
.headfoot { animation: mp-fade 200ms ease-out; }
.bookshowimgs { animation: mp-fade 500ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .meat, .headfoot, .bookshowimgs { animation: none; }
}

/* ---------- legibility over the photo ------------------------------------------------------ */

/* A light, even scrim under everything: same photo and colours, ~1.5x the contrast for white text. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(20, 24, 28, 0.22);
}

/* 2013 put a soft shadow on headings only; extend a tighter one to body text so it holds on light patches. */
.bodycontent, #mellow, footer { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); }
#example thead, .button.success, select, .skip-link:focus { text-shadow: none; }

/* 14px italic Times was hard going in long lists; same face, a step larger with more air. */
.bodycontent { font-size: 16px; line-height: 1.5; }
#example td, #example th { font-size: 15px; line-height: 1.45; }
.press, .followcontact, .homecontent { font-size: 15px; line-height: 1.5; }
/* Size the footer's text, not the footer: Foundation sizes .row in em, so this would widen its rule. */
footer p, footer li { font-size: 15px; }

/* Page titles are real <h1>s now, drawn exactly like the 2013 <h6> titles. */
h1.mp-title {
  font-family: 'Times', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 30px;
  line-height: 42px;
  margin: 6px 0 15px;
  color: #fff;
  text-shadow: 0 0 5px #666;
}
h2.mp-subtitle {
  font-family: 'Times', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.3;
  margin: 24px 0 8px;
  color: #fff;
  text-shadow: 0 0 5px #666;
}
.homecontentlarger h1.mp-home-title {
  font-family: inherit;
  font-size: 60px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.3;
  margin: 0;
  color: #fff;
}

/* ---------- alignment: text starts and ends exactly on the dotted rules -------------------- */

/* The rules are the borders of these three rows; 2013 inset their content 27-32px inside them. */
#mellow.row, #annoying.row, #footerpadding { padding-left: 0; padding-right: 0; }
#mellow > .columns, #footerpadding > .columns, #footerpadding .large-6.columns { padding-left: 0; padding-right: 0; }
#footerpadding .row { margin: 0; padding: 0; width: auto; max-width: none; }
#annoying > .bodycontent { width: auto; padding-left: 0; padding-right: 0; }
#logotop { margin-left: 0; padding-left: 0; }
/* The last nav item ends on the rule: plain links lose their trailing padding; the Login pill keeps its box. */
.button-group li:last-child .button:not(.success), .button-group li:last-child .buttonlogout { padding-right: 0; }
.button-group li:last-child .buttonlogout:hover { padding-right: 0; }
#footerpadding .inline-list { margin-right: 0; }
#footerpadding .inline-list > li { margin-left: 0; margin-right: 0; }

/* ---------- focus, skip link, screen-reader text ------------------------------------------- */

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.5);
}
#main:focus { outline: none; box-shadow: none; }
.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  background: #fff;
  color: #333;
  padding: 8px 14px;
  font-weight: 700;
}
.skip-link:focus { left: 16px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- nav ---------------------------------------------------------------------------- */

/* Same buttons; taller hit area (2013 was 14px tall) and a visible "you are here". */
.button-group .button { font-size: 15px; padding: 6px 10px; line-height: 1.2; }
.button-group .button[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.button-group .button.success { padding: 6px 12px; }
.nav-logout { display: inline; margin: 0; }
button.buttonlogout {
  font: italic 700 15px/1.2 'Times', serif;
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
}

/* ---------- controls ----------------------------------------------------------------------- */

/* Buttons in content echo the 2013 input shape (10px 0 10px 0 corners) and hover (white, #666). */
.bodycontent button.button,
.bodycontent input[type="submit"] {
  font: italic 700 15px/1.2 'Times', serif;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 10px 0 10px 0;
  padding: 6px 12px;
  margin: 0;
  width: auto;
  cursor: pointer;
  box-shadow: none;
}
.bodycontent button.button:hover,
.bodycontent input[type="submit"]:hover:not(:disabled) { background: #fff; color: #666; text-shadow: none; }
.bodycontent button:disabled, .bodycontent input:disabled { opacity: 0.55; cursor: not-allowed; }
.linkbutton {
  font: inherit;
  color: #fff;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkbutton:hover { text-decoration-thickness: 2px; }

/* Login inputs keep the dotted underline; text and caret stay white and readable. */
.bodycontent input[type="email"], .bodycontent input[type="password"], .bodycontent input[type="text"], .bodycontent input[type="search"] {
  font-size: 16px; /* also stops iOS zooming on focus */
  caret-color: #fff;
}
.bodycontent input::placeholder { color: rgba(255, 255, 255, 0.7); }
.bodycontent input[aria-invalid="true"] { border-bottom-color: #ffd0c8 !important; }

/* Status lines for actions and errors (role=status / role=alert). */
.flash { display: block; margin-top: 4px; font-size: 14px; }
.flash:empty { display: none; }
.flash-error { color: #fff; background: rgba(120, 20, 20, 0.55); padding: 2px 6px; }
.circulation { margin: 0; }
.circulation .button { white-space: nowrap; }

/* ---------- DataTables ---------------------------------------------------------------------- */

/* 2013 search box drew near-black text on the photo; white text on a faint field instead. */
.dataTables_filter input {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  height: auto !important;
  padding: 4px 8px !important;
}
.dataTables_length select { display: inline-block; font-size: 15px; height: auto; padding: 2px 4px; }
#example th a { color: inherit; padding: 0; text-decoration: none; }
#example th a:hover { text-decoration: underline; }
#example th[aria-sort] a::after { content: " \2191"; }
#example th[aria-sort="descending"] a::after { content: " \2193"; }
.dataTables_paginate a, .dataTables_paginate span { margin-right: 10px; font-size: 20px; }
.dataTables_paginate a { cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.dataTables_paginate span[aria-disabled="true"] { opacity: 0.5; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- lists that replaced layout tables ------------------------------------------------ */

.mp-list { list-style: none; margin: 0 0 0 1.4em; padding: 0; }
.mp-list li { padding: 4px 0; font-size: 15px; }
.mp-list .count { margin-left: 8px; opacity: 0.85; }
.mp-list a.button { padding: 0 10px 0 0; }

/* ---------- book page -------------------------------------------------------------------- */

.book-show { display: flex; gap: 24px; align-items: flex-start; margin-top: 2em; }
.book-show-cover { flex: 0 0 314px; }
.book-meta { margin: 0; }
.book-meta dt { position: absolute; left: -9999px; }
.book-meta dd { margin: 0; }
.book-actions { margin-top: 16px; }

/* Goodreads conversation, set like the home page's dotted-rule columns. */
.conversation { border-top: 1px dotted #fff; margin-top: 32px; padding-top: 8px; max-width: 640px; }
.conversation blockquote {
  margin: 8px 0 16px;
  padding: 0 0 0 14px;
  border-left: 1px dotted #fff;
  color: #fff;
  font-size: 17px;
  line-height: 1.55;
}
.conversation .meta { font-size: 14px; opacity: 0.9; }
.conversation ol { list-style: none; margin: 0; padding: 0; }
.conversation li { margin: 0 0 16px; }
.conversation .stars { letter-spacing: 2px; }

/* ---------- sandbox ------------------------------------------------------------------------ */

.sandbox-note {
  border-top: 1px dotted #fff;
  margin-top: 28px;
  padding-top: 10px;
  max-width: 520px;
  font-size: 15px;
}
.sandbox-note code { background: rgba(255, 255, 255, 0.15); color: #fff; padding: 0 4px; font-style: normal; }
.quick-login { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.quick-login form { margin: 0; }
.dashboard-section { border-top: 1px dotted #fff; margin-top: 20px; padding-top: 6px; }
.mail-item { border-top: 1px dotted #fff; padding: 10px 0; }
.mail-item pre { white-space: pre-wrap; font: inherit; color: #fff; background: none; border: 0; padding: 0; margin: 6px 0 0; }
/* Foundation paints every <thead> light grey; on this table the header text is white, so clear it. */
.users-table, .users-table thead, .users-table tr { background: transparent !important; border: 0; }
.users-table th { text-align: left; color: #fff; background: transparent; font-style: italic; border-bottom: 1px dotted #fff; }
.users-table td, .users-table th { padding: 4px 12px 4px 0; font-size: 15px; }

/* ---------- small screens: 2013 was a fixed 875px layout ---------------------------------- */

@media (max-width: 920px) {
  body { padding-top: 12px; }
  #mellow.row, #annoying.row, #footerpadding { width: auto !important; max-width: none !important; margin: 0 16px !important; padding-left: 0 !important; padding-right: 0 !important; }
  #mellow.row { padding-top: 12px; padding-bottom: 6px; }
  .nav-bar.right { float: none !important; }
  .button-group { display: flex; flex-wrap: wrap; gap: 2px; margin: 6px 0 0; }
  .bodycontent { width: auto !important; padding: 0 !important; min-height: 0; }
  .homecontentlarger { width: auto !important; float: none; font-size: 26px !important; margin-right: 0; }
  .homecontentlarger h1.mp-home-title { font-size: 40px; }
  .homecontent, .press, .followcontact { width: 100% !important; float: none !important; margin-right: 0 !important; }
  .actmap { float: none; width: 100% !important; }
  .actmap iframe { width: 100%; }
  table#example { width: 100% !important; }
  .dataTables_length, .dataTables_filter { float: none !important; width: auto !important; }
  .book-show { flex-direction: column; }
  .book-show-cover { flex-basis: auto; max-width: 240px; }
  .bookshowimgs { width: 100% !important; }
  #footerpadding .large-6.columns, #footerpadding .right { float: none !important; width: 100% !important; }
}

/* ---------- press ------------------------------------------------------------------------- */

.press-list li { padding: 8px 0; }
.press-meta { font-size: 14px; opacity: 0.95; }
.press-video { margin: 8px 0 24px; max-width: 640px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; width: 100%; border: 1px dotted #fff; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.press a.press-all { display: inline-block; margin-top: 6px; }

/* ======================================================================================
 * Layout system. Every margin and padding on the site comes from these tokens and rules.
 *
 *   Grid      8px base, 4px half-step for tight pairs.
 *   Tokens    4 · 8 · 12 · 16 · 24 · 32 · 48 · 64
 *
 *   R1 Proximity   related < item < group < section:  4 · 12 · 24 · 48
 *                  (each tier roughly doubles, so grouping reads without borders)
 *   R2 Headings    space above >= 2x space below; a heading binds to what follows it
 *   R3 Sections    dotted rule, 48 above / 24 below, identical everywhere
 *   R4 Lists       12 between items; 4 between an item's title and its meta line
 *   R5 Frame       32 top · header · 12 · rule · 32 · content · 64 · rule · 16 · footer · 48
 *   R6 Horizontal  32 column gutter; 24 between inline controls; buttons 4 x 16
 *   R7 Text        paragraphs 16 apart (~one line of 18/27 body text)
 *
 * Loads after mellowpages.css and the earlier port rules on purpose: it supersedes them.
 * ====================================================================================== */

:root {
  --space-3xs: 4px;
  --space-2xs: 8px;
  --space-xs: 12px;
  --space-s: 16px;
  --space-m: 24px;
  --space-l: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  /* Legacy aliases used by rules above. */
  --s1: var(--space-3xs); --s2: var(--space-2xs); --s3: var(--space-s); --s4: var(--space-m); --s5: var(--space-l);
}

/* R5 Frame */
body { padding-top: var(--space-l); }
#mellow.row { padding-top: 0; padding-bottom: var(--space-xs); }
#annoying.row { padding-top: var(--space-l); padding-bottom: var(--space-2xl); }
.bodycontent { min-height: 60vh; }
#footerpadding { padding-top: var(--space-s); padding-bottom: var(--space-xl); }
#footerpadding p { margin: 0; }

/* Nested Foundation grids inside content (login, books) indented 17-32px; flush them. */
.bodycontent .row { padding: 0; margin: 0; width: auto; max-width: none; }
.bodycontent .columns { padding-left: 0; padding-right: 0; }
.bodycontent .five.columns { width: 100%; max-width: 480px; float: none; }
.bodycontent .seven.columns { display: none; }

/* R7 Text */
.bodycontent p { margin: 0 0 var(--space-s); }
.bodycontent p:last-child { margin-bottom: 0; }

/* R2 Headings. Page title: content starts 32 below the rule (R5), 24 below the title. */
h1.mp-title { margin: 0 0 var(--space-m); }
h2.mp-subtitle { margin: 0 0 var(--space-xs); }
.homecontentlarger h1.mp-home-title { margin: 0 0 var(--space-xs); }

/* R4 Lists */
.mp-list { margin: 0; padding: 0; }
.mp-list li { padding: 0; margin: 0 0 var(--space-xs); }
.mp-list li:last-child { margin-bottom: 0; }
.press-list li { margin-bottom: var(--space-m); }           /* two-line items are a group (R1) */
.press-list li br + .press-meta { display: inline-block; margin-top: var(--space-3xs); }
.mp-list a.button { padding: 0; margin-right: var(--space-2xs); }
#example td a.button, .users-table a.button { padding: 0; }

/* R3 Sections */
.dashboard-section, .conversation, .sandbox-note {
  margin: var(--space-xl) 0 0;
  padding: var(--space-m) 0 0;
  border-top: 1px dotted #fff;
  max-width: none;
}
.press-video { margin: 0; }
.press-video .press-meta { display: block; margin-top: var(--space-2xs); }
.mp-title + p, .mp-title + .press-video { margin-top: 0; }

/* Home: statement, then the three 2013 columns on a 32px gutter (R6). */
.homecontentlarger { width: auto; padding: 0; float: none; margin: 0 0 var(--space-xl); }
.homecontent, .press, .followcontact {
  width: calc((100% - 2 * var(--space-l)) / 3);
  margin: 0 var(--space-l) 0 0;
  padding: var(--space-m) 0 0;   /* below their dotted top rule (R3) */
}
.followcontact { margin-right: 0; }
.homecontent strong, .press strong, .followcontact strong { display: inline-block; margin-bottom: var(--space-3xs); }
.actmap { width: 100%; float: none; margin-top: var(--space-2xs); }
.actmap iframe { width: 100%; }

/* Books table (R6 controls, R4 rows) */
.dataTables_wrapper::after { content: ""; display: table; clear: both; }
.dataTables_length, .dataTables_filter { margin: 0 0 var(--space-s); }
.dataTables_length { width: auto; margin-right: var(--space-m); }
.dataTables_filter { width: auto; }
.dataTables_filter input { margin: 0 0 0 var(--space-2xs) !important; width: 240px !important; display: inline-block; }
table#example, .users-table { width: 100%; margin: 0 0 var(--space-s); }
#example th, #example td { padding: var(--space-xs) var(--space-2xs); }
.dataTables_info { margin: 0 0 var(--space-2xs); }
.dataTables_paginate a, .dataTables_paginate span { margin-right: var(--space-m); }
.users-table td, .users-table th { padding: var(--space-2xs) var(--space-m) var(--space-2xs) 0; }

/* Book page: cover and details on the column gutter; actions are a group (R1). */
.book-show { margin-top: 0; gap: var(--space-l); }
.book-show h1.mp-title { margin-top: 0; }
.book-meta dd + dd, .book-meta dt + dd { margin-top: var(--space-3xs); }
.book-actions { margin-top: var(--space-m); }
.conversation blockquote { margin: 0 0 var(--space-s); }
.conversation li { margin-bottom: var(--space-m); }

/* Forms: label binds to its field (4), fields are items (24), submit is its own group (32). */
.bodycontent label { margin: var(--space-m) 0 0; display: block; }
.bodycontent form > label:first-of-type { margin-top: 0; }
.bodycontent form input[type="email"], .bodycontent form input[type="password"] { margin: var(--space-3xs) 0 0; }
.bodycontent form input[type="submit"] { margin-top: var(--space-l); }
.quick-login { margin: var(--space-s) 0 0; gap: var(--space-xs); }

/* R6 controls */
.bodycontent button.button, .bodycontent input[type="submit"] { padding: var(--space-3xs) var(--space-s); }
.button-group .button, button.buttonlogout { padding: var(--space-3xs) var(--space-2xs); }
.button-group .button.success { padding: var(--space-3xs) var(--space-s); }
.flash { margin-top: var(--space-3xs); }
.flash-error { padding: var(--space-3xs) var(--space-2xs); }
.mail-item { padding: var(--space-m) 0; }
.mail-item pre { margin-top: var(--space-2xs); }

@media (max-width: 920px) {
  :root { --space-xl: 40px; --space-2xl: 48px; }
  body { padding-top: var(--space-s); }
  #annoying.row { padding-top: var(--space-m); }
  .homecontent, .press, .followcontact { width: 100% !important; margin-right: 0 !important; }
  .press, .followcontact { margin-top: var(--space-m) !important; }
  .dataTables_length, .dataTables_filter { margin-right: 0; }
  .dataTables_filter input { width: 100% !important; max-width: 320px; margin: var(--space-3xs) 0 0 !important; display: block; }
}

/* The 2013 float on "Show N entries" let the table wrap beside it; controls share one line, table below. */
.dataTables_length, .dataTables_filter { float: none !important; display: inline-block; vertical-align: baseline; }
.dataTables_wrapper .table-scroll { clear: both; }
/* Form-label stacking above is for login fields; DataTables controls read as one line ("Show [10] entries"). */
.dataTables_length label, .dataTables_filter label { display: inline; margin: 0; }
.dataTables_length select { width: auto !important; margin: 0 var(--s1); }

/* ======================================================================================
 * Type scale (original theme). Every size on the site comes from these six values,
 * ~110% of the 2013 sizes, which read better over the photo. Loads last; supersedes the
 * scattered 14/15/16/17/20/22px sizes in mellowpages.css and above.
 * ====================================================================================== */

:root {
  --fs-sm: 16px;     /* nav, meta, tables, footer, controls */
  --fs-body: 18px;   /* running text */
  --fs-h2: 24px;     /* section headings */
  --fs-h1: 33px;     /* page titles (2013 h6 was 30px) */
  --fs-lede: 44px;   /* home statement (2013: 40px) */
  --fs-display: 66px;/* "Mellow Pages..." (2013: 60px) */
  --lh-tight: 1.25;
  --lh-text: 1.5;
}

body, .bodycontent { font-size: var(--fs-body); line-height: var(--lh-text); }
.bodycontent p, .bodycontent li, .bodycontent dd, .bodycontent label, .conversation blockquote { font-size: var(--fs-body); }

/* Small: one size for every secondary line. */
#logotop, .button-group .button, button.buttonlogout,
.press-meta, .conversation .meta, .mp-list .count, .flash,
#example td, #example th, .users-table td, .users-table th,
.dataTables_length, .dataTables_filter, .dataTables_length select, .dataTables_info,
.dataTables_paginate a, .dataTables_paginate span,
.press, .followcontact, .homecontent, .homecontent small,
footer p, footer li, .sandbox-note, .sandbox-note p, .mail-item pre,
.bodycontent button.button, .bodycontent input[type="submit"], .linkbutton, .circulation-status {
  font-size: var(--fs-sm);
  line-height: var(--lh-text);
}
.bodycontent input[type="email"], .bodycontent input[type="password"], .bodycontent input[type="text"], .bodycontent input[type="search"] { font-size: var(--fs-sm); }

h2.mp-subtitle { font-size: var(--fs-h2); line-height: var(--lh-tight); }
h1.mp-title, #authorindexname { font-size: var(--fs-h1); line-height: var(--lh-tight); }
.homecontentlarger { font-size: var(--fs-lede) !important; line-height: 1.3; }
.homecontentlarger h1.mp-home-title { font-size: var(--fs-display); line-height: 1.15; }

@media (max-width: 920px) {
  :root { --fs-h1: 28px; --fs-lede: 28px; --fs-display: 40px; }
}

/* mellowpages.css sizes these by id (20px); match the id to bring them onto the small size. */
#example_info, #example_next, #example_previous { font-size: var(--fs-sm); }

/* R2: whatever follows a page title starts 24 below it, even a ruled section (no 24+48 stacking). */
h1.mp-title + * { margin-top: 0 !important; }

/* "Show N entries": same field treatment as the Search box beside it. */
.dataTables_length select,
.dataTables_filter input {
  box-sizing: border-box;
  height: 36px !important;
  line-height: 1.2;
  vertical-align: middle;
}
.dataTables_length select {
  -webkit-appearance: none;
  appearance: none;
  min-width: 72px;
  width: auto !important;
  margin: 0 var(--space-2xs) !important;
  padding: 0 var(--space-l) 0 var(--space-xs) !important;
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
  /* Thin white chevron, drawn inline so there's no extra request. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-xs) center;
  background-size: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px 0 10px 0;
  font: inherit;
  font-size: var(--fs-sm);
  text-shadow: none;
  cursor: pointer;
}
.dataTables_length select:hover { background-color: rgba(255, 255, 255, 0.2); }
/* The open menu is drawn by the OS on white: keep its options dark so they stay readable. */
.dataTables_length select option { color: #2b2d2f; background: #fff; }
.dataTables_filter input { padding: 0 var(--space-xs) !important; }

/* ======================================================================================
 * Links: no colour change on hover (Foundation turned them blue). A 1px underline fades in on
 * hover/focus. It's drawn as a background line, not text-decoration: the text-shadow used for
 * legibility would otherwise paint a dark line under even a transparent underline.
 * Links inside running text keep a faint underline at rest (WCAG 1.4.1).
 * ====================================================================================== */

@property --ul {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

/* Links are white on the photo in every state; the table header's links take its dark text. */
#mellow a, #mellow a:hover, #mellow a:focus, #mellow a:visited,
.bodycontent a, .bodycontent a:hover, .bodycontent a:focus, .bodycontent a:visited,
footer a, footer a:hover, footer a:focus, footer a:visited { color: #fff; }
#example th a, #example th a:hover, #example th a:visited { color: #222; }

#mellow a, .bodycontent a, footer a {
  --ul: 0;
  text-decoration: none !important;
  background-image: linear-gradient(rgba(255, 255, 255, var(--ul)), rgba(255, 255, 255, var(--ul)));
  background-repeat: no-repeat;
  background-origin: content-box;
  background-size: 100% 1px;
  background-position: 0 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: --ul 220ms ease;
}
#mellow a:hover, #mellow a:focus-visible,
.bodycontent a:hover, .bodycontent a:focus-visible,
footer a:hover, footer a:focus-visible { --ul: 1; }

/* In sentences: faint at rest, full on hover. */
.bodycontent p a, .bodycontent dd a { --ul: 0.4; }
.bodycontent p a:hover, .bodycontent p a:focus-visible,
.bodycontent dd a:hover, .bodycontent dd a:focus-visible { --ul: 1; }

/* Current page in the nav: underline stays on. */
#mellow .button-group .button[aria-current="page"] { --ul: 1; }

/* Filled controls keep their own hover, no underline. */
#mellow a.button.success, #mellow a.button.success:visited { background-image: none; color: #666; }
#mellow a.button.success:hover { background-color: #ddd; color: #666; }
a.button:not(.success):hover { background-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  #mellow a, .bodycontent a, footer a { transition: none; }
}

/* Hover = underline only, everywhere. No fills, boxes, or colour shifts on any link or button. */
#mellow .button-group .button:hover,
#mellow .button-group .button:focus-visible,
.bodycontent a.button:hover {
  background-color: transparent !important;
  color: #fff !important;
}
#mellow a.button.success:hover, #mellow a.button.success:focus-visible {
  background-color: #fff !important;
  color: #666 !important;
  background-image: linear-gradient(#666, #666);
  background-repeat: no-repeat;
  background-origin: content-box;
  background-size: 100% 1px;
  background-position: 0 100%;
}
button.buttonlogout {
  --ul: 0;
  color: #fff;
  background: transparent;
  background-image: linear-gradient(rgba(255, 255, 255, var(--ul)), rgba(255, 255, 255, var(--ul)));
  background-repeat: no-repeat;
  background-origin: content-box;
  background-size: 100% 1px;
  background-position: 0 100%;
  transition: --ul 220ms ease;
}
button.buttonlogout:hover, button.buttonlogout:focus-visible {
  --ul: 1;
  background-color: transparent !important;
  color: #fff !important;
  padding-right: 0;
}
/* Content buttons (Reserve!, Login to Mellow Pages, quick logins): keep the outline, underline the label. */
.bodycontent button.button:hover,
.bodycontent input[type="submit"]:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.dataTables_length select:hover { background-color: rgba(255, 255, 255, 0.1); }

/* ======================================================================================
 * Frame alignment (layout system R5/R6, applied to header and footer rows).
 *   - logo, nav and footer text share one baseline
 *   - items are spaced by a single gap token, never by per-item padding
 * ====================================================================================== */

/* Header: logo left, nav right, one baseline, nav items 24 apart. */
#mellow > .columns {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-m);
}
#mellow .nav-bar.right { float: none !important; margin: 0; }
#mellow .button-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-m);
  margin: 0;
}
#mellow .button-group li { float: none; margin: 0; }
#logotop,
#mellow .button-group .button,
#mellow button.buttonlogout {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.5;
}
/* The Login pill keeps a box, but only horizontal padding so its text stays on the baseline. */
#mellow .button-group .button.success { padding: 0 var(--space-xs) !important; }

/* Footer: credit left, type switch + year right, one baseline. */
#footerpadding > .columns > .row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-m);
}
#footerpadding .large-6.columns { width: auto !important; float: none !important; }
#footerpadding .inline-list { display: flex; align-items: baseline; gap: var(--space-m); float: none !important; margin: 0; }
#footerpadding .inline-list > li { float: none; margin: 0; }

/* Tables: every row on the same 12px step (R4), header included. */
#example th, #example td { padding: var(--space-xs) var(--space-2xs); }
.users-table th, .users-table td { padding: var(--space-xs) var(--space-m) var(--space-xs) 0; }
.users-table td:last-child, .users-table th:last-child { padding-right: 0; }
.users-table a.button { padding: 0 !important; margin: 0; }
/* Foundation's clearfix ::before/::after become phantom flex items (an extra 24px gap); remove them. */
#mellow .button-group::before, #mellow .button-group::after,
#footerpadding > .columns > .row::before, #footerpadding > .columns > .row::after,
#footerpadding .inline-list::before, #footerpadding .inline-list::after { display: none !important; }

/* One line box for every header/footer item, so links, the Logout <button> and plain text align exactly. */
#mellow > .columns, #mellow .button-group, #footerpadding > .columns > .row, #footerpadding .inline-list { align-items: center; }
#logotop, #mellow .button-group .button, #mellow button.buttonlogout, #mellow .nav-logout,
#footerpadding p, #footerpadding li, #footerpadding li * {
  line-height: 24px !important;
  height: 24px;
  vertical-align: top;
}
#mellow .nav-logout { display: flex; }
#mellow button.buttonlogout { border: 0; display: block; }
/* Nav <li>s inherited the body line-height (28.8px) and pinned their link to the top: make each a 24px box. */
#mellow .button-group li { display: flex; align-items: center; height: 24px; line-height: 24px; }

/* Donors + Authors: flow the list into columns (one per 220px, so 4 on desktop, 1 on phones), each entry kept whole. */
.count-columns.mp-list {
  columns: 220px;
  column-gap: var(--space-l);
}
.count-columns.mp-list li {
  break-inside: avoid;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2xs);
  margin: 0;
  padding: var(--space-3xs) 0;
}

/* Stylesheet URLs are content-versioned in layout.tsx; edits here reach open tabs on their next reload. */

/* Donors + Authors rows: whole row is one link; name left (one line, ellipsis), count right; one underline across. */
.count-columns.mp-list li { display: block; padding: 0; margin: 0; }
.count-columns .count-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2xs);
  padding: var(--space-3xs) 0;
  background-origin: border-box !important;
  background-position: 0 calc(100% - var(--space-3xs)) !important;
}
.count-columns .count-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
}
.count-columns .count-num { flex: 0 0 auto; font-variant-numeric: tabular-nums; opacity: 0.85; }

/* "Created by Joe Waine": the 2013 `a { padding: 4px }` read as a double space before the name. */
#footerpadding p a { padding: 0 !important; margin: 0 !important; }
