/*
Theme Name: UCD Rowing
Theme URI: https://ucdrowing.ie
Author: UCD Rowing Club
Description: Block theme for ucdrowing.ie, successor to ucdbc.ie.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Version: 0.5.29
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ucdrowing
*/

/*
 * Design tokens and most styling live in theme.json.
 * Keep this file for the few things theme.json can't express.
 */

a:where(:not(.wp-element-button)) {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

:where(.wp-site-blocks) :focus-visible {
  outline: 2px solid var(--wp--preset--color--mid-blue);
  outline-offset: 2px;
}

/* Header, main and footer sit flush; sections set their own padding. */
.wp-site-blocks > * + * {
  margin-block-start: 0;
}

/*
 * Masked (arc) sections are composited as their own layer, so a fractional bottom edge can
 * leave a hairline above the footer. Overlap by 1px and paint the footer on top.
 */
.wp-site-blocks > footer {
  position: relative;
  margin-block-start: -1px;
}

:where(h1, h2, h3, h4) strong {
  font-weight: 700;
  letter-spacing: 0.01em;
}

/*
 * The UCD Arc, from the top third of the UCD crest (UCD Brand Guidelines 2026, pp. 62–68).
 * The path is the official vector from the guidelines, normalised: the chord rises 11° left to
 * right and the drop is 20.2% of the width. It must only ever scale proportionally, so the mask
 * is sized "100% auto" and the SVG runs 40× its width tall to cover any element below the curve.
 * "Image Container" behaviour on images; "Text Holder" behaviour on groups and covers.
 */
.is-style-arc,
.is-style-arc-cropped,
.ucdrs-anniversary__photo,
.ucdrs-season-card__photo {
  --ucd-arc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1068.01 42720.47'%3E%3Cpath d='M1068.01 3.79C1068.01 3.79 483.04-46.08 0 216.09V42720.47H1068.01Z'/%3E%3C/svg%3E");
}

.wp-block-image.is-style-arc img,
.wp-block-video.is-style-arc video,
.wp-block-post-featured-image.is-style-arc img,
.ucdrs-anniversary__photo img,
.ucdrs-season-card__photo,
.wp-block-cover.is-style-arc,
.wp-block-group.is-style-arc {
  -webkit-mask: var(--ucd-arc) top center / 100% auto no-repeat;
  mask: var(--ucd-arc) top center / 100% auto no-repeat;
}

/* Keep text clear of the curve, which drops 20.2% of the width at its left edge. */
.wp-block-cover.is-style-arc,
.wp-block-group.is-style-arc {
  padding-top: calc(20.2% + var(--wp--preset--spacing--50));
}

/*
 * Cropped arc for wide sections: the arc is drawn at 2× the element width and anchored right, so
 * only its flatter right half shows. Cropping is allowed by the guidelines; scaling stays
 * proportional. Visible drop is 6.84% of the width, with the curve leaving the left edge at ~10°.
 */
.wp-block-cover.is-style-arc-cropped,
.wp-block-group.is-style-arc-cropped {
  -webkit-mask: var(--ucd-arc) right top / 200% auto no-repeat;
  mask: var(--ucd-arc) right top / 200% auto no-repeat;
  padding-top: calc(6.84% + var(--wp--preset--spacing--60));
}

/*
 * Eyebrow: small uppercase label above a heading.
 * Darkest Blue on light backgrounds; Saffron on navy, per the brand colour rules.
 */
p.is-style-eyebrow {
  margin-block-end: 0.5rem;
  font-size: var(--wp--preset--font-size--small);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wp--preset--color--darkest-blue);
}

.has-darkest-blue-background-color p.is-style-eyebrow,
.has-dark-blue-background-color p.is-style-eyebrow {
  color: var(--wp--preset--color--saffron);
}

/* A post's category above its title, as an eyebrow. */
.wp-block-post-terms.is-style-eyebrow {
  font-size: var(--wp--preset--font-size--small);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wp-block-post-terms.is-style-eyebrow a {
  text-decoration: none;
}

/* News: links between all news and its categories, as pills. */
.news-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
  font-size: var(--wp--preset--font-size--small);
}

.news-filter a {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  text-decoration: none;
}

.news-filter a:hover,
.news-filter a:focus-visible,
.news-filter a[aria-current="page"] {
  color: var(--wp--preset--color--white);
  background: var(--wp--preset--color--darkest-blue);
}

/* Hand-set line breaks in headings only make sense at desktop widths. */
@media (max-width: 600px) {
  h1.wp-block-heading br {
    display: none;
  }
}

/* Tables: ruled rows and left-aligned headings, matching the Seasons plugin's rolls of honour. */
.wp-block-table thead {
  border-bottom: 1px solid currentColor;
}

.wp-block-table th,
.wp-block-table td {
  padding: 0.6rem 1rem 0.6rem 0;
  border: 0;
  border-bottom: 1px solid var(--wp--preset--color--tint);
  text-align: left;
  vertical-align: top;
}

.wp-block-table thead th {
  font-weight: 600;
  border-bottom-color: currentColor;
}

/* Club crest beside the homepage call to action; smaller once the columns stack. */
.site-crest {
  margin: 0 auto;
  max-width: 250px;
}

.site-crest img {
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 741;
}

@media (max-width: 781px) {
  .site-crest {
    margin-top: var(--wp--preset--spacing--50);
  }
}

/* ---------------------------------------------------------------------------
 * Header
 * ------------------------------------------------------------------------ */

/* Links to a heading on the page (such as /about/#crest) stop clear of the sticky header. */
html {
  scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 6rem);
}

.wp-site-blocks > header {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 100;
}

.site-header .wp-block-button__link {
  padding: 0.55em 1.1em;
  font-size: var(--wp--preset--font-size--small);
}

.site-nav {
  font-weight: 500;
}

.site-nav.items-justified-right {
  gap: 0 var(--wp--preset--spacing--40);
}

/* Dropdowns (desktop). Overlay colours come from the block's overlay settings. */
/* Core right-aligns dropdowns in a right-justified menu; open them left, text under the label. */
.site-nav.items-justified-right
  .wp-block-navigation__container
  > .has-child
  > .wp-block-navigation__submenu-container {
  left: -1.25rem;
  right: auto;
}

.site-nav .wp-block-navigation__submenu-container {
  min-width: 15rem !important;
  padding-block: 0.5rem;
  border: 0 !important;
  box-shadow: 0 12px 32px rgb(4 32 76 / 0.35);
}

.site-nav
  .wp-block-navigation__submenu-container
  .wp-block-navigation-item__content {
  padding: 0.5rem 1.25rem !important;
  font-size: var(--wp--preset--font-size--small);
  font-weight: 400;
}

.site-nav .wp-block-navigation-item__content:hover,
.site-nav .wp-block-navigation-item__content:focus-visible {
  color: var(--wp--preset--color--light-blue);
}

.site-nav a.wp-block-navigation-item__content {
  text-decoration: none;
}

/* Members only appears in the mobile overlay; on desktop it lives in the footer. */
.site-nav
  .wp-block-navigation__responsive-container:not(.is-menu-open)
  .is-overlay-only {
  display: none;
}

/*
 * Six menu items plus the buttons need ~1200px, so switch to the overlay menu below that
 * rather than at core's 600px. These mirror core's own min-width: 600px rules.
 */
@media (min-width: 600px) and (max-width: 1199px) {
  .site-nav .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: flex;
  }

  .site-nav
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(
      .is-menu-open
    ) {
    display: none;
  }
}

/* Keep the menu toggle at the far right, after the buttons. */
@media (max-width: 1199px) {
  .site-header__actions .site-nav {
    order: 2;
  }
}

@media (max-width: 599px) {
  .site-header .wp-block-buttons > .wp-block-button.site-header__support {
    display: none;
  }
}

/* Mobile overlay: full-screen navy, big top-level items, sub-items in Light Blue. */
.site-nav .wp-block-navigation__responsive-container.is-menu-open {
  padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

/* Core repeats items-justified-right on the inner list, so left-align every level of the overlay. */
.site-nav
  .is-menu-open
  :is(
    .wp-block-navigation__responsive-container-content,
    .wp-block-navigation__container,
    .wp-block-navigation__submenu-container,
    .wp-block-navigation-item
  ) {
  --navigation-layout-justification-setting: flex-start;
  --navigation-layout-justify: flex-start;
  --navigation-layout-align: flex-start;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}

.site-nav .is-menu-open .wp-block-navigation__responsive-container-content {
  gap: var(--wp--preset--spacing--40);
  padding-top: var(--wp--preset--spacing--50);
}

.site-nav
  .is-menu-open
  .wp-block-navigation__container
  > .wp-block-navigation-item
  > .wp-block-navigation-item__content {
  font-size: var(--wp--preset--font-size--x-large);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.site-nav .is-menu-open .wp-block-navigation__submenu-container {
  gap: 0.25rem;
  padding: 0.5rem 0 0 !important;
  box-shadow: none;
}

.site-nav
  .is-menu-open
  .wp-block-navigation__submenu-container
  .wp-block-navigation-item__content {
  padding: 0.25rem 0 !important;
  font-size: var(--wp--preset--font-size--medium);
  color: var(--wp--preset--color--light-blue);
}

/* ---------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------ */

.site-footer__links {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--wp--preset--font-size--small);
}

.site-footer__links li + li {
  margin-top: 0.5rem;
}

.site-footer a:where(:not(.wp-element-button)) {
  text-decoration: none;
}

.site-footer a:where(:not(.wp-element-button)):hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
 * Ambient video (muted, looping, no controls); see assets/js/ambient-video.js
 * ------------------------------------------------------------------------ */

.wp-block-video:has(> video[autoplay][loop]:not([controls])) {
  position: relative;
}

/* Square crop inside the arc, matching the encoded hero loop. */
.wp-block-video.is-style-arc video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

/*
 * The hero's "Ad Astra", translated: hover, focus or a tap slides "To the stars" out beside it in
 * a navy label with a twinkling Saffron star (assets/js/motto.js). The label sits beside the word when the rest of the line is empty
 * (.is-beside, set by the script), and under it otherwise, such as on narrow phones where the
 * motto ends a line. A dotted underline says there's more to the motto.
 */
.motto {
  position: relative;
  display: inline-block;
}

.motto__term {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline dotted var(--wp--preset--color--mid-blue);
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.14em;
  cursor: help;
}

.motto__term:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

.motto__translation {
  --motto-from: translate(0, -0.5rem);
  --motto-to: none;
  --motto-label: var(--wp--preset--color--darkest-blue);
  position: absolute;
  left: 0;
  top: calc(100% + 0.7rem);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.6em 0.3em 0.75em;
  border-radius: 4px;
  background: var(--motto-label);
  color: var(--wp--preset--color--white);
  font-size: var(--wp--preset--font-size--large);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: var(--motto-from);
  transition: opacity 0.2s ease-in, transform 0.2s ease-in;
}

.motto__translation::before {
  content: "";
  position: absolute;
  left: 1rem;
  bottom: 100%;
  border: 7px solid transparent;
  border-bottom-color: var(--motto-label);
}

.motto.is-beside .motto__translation {
  --motto-from: translate(-0.75rem, -50%);
  --motto-to: translate(0, -50%);
  left: calc(100% + 1.4rem); /* Past the full stop, plus room for the arrow. */
  top: 50%;
}

.motto.is-beside .motto__translation::before {
  left: auto;
  right: 100%;
  bottom: auto;
  top: 50%;
  border-bottom-color: transparent;
  border-right-color: var(--motto-label);
  transform: translateY(-50%);
}

/*
 * "Coṁṫrom Féinne" in an eyebrow on navy, translated as "Fair play": a white label in sentence
 * case, and an underline in the eyebrow's own Saffron. No star; that belongs to "To the stars".
 */
.motto.is-eyebrow .motto__term {
  text-transform: inherit;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.motto.is-eyebrow .motto__translation {
  --motto-label: var(--wp--preset--color--white);
  color: var(--wp--preset--color--darkest-blue);
  font-size: var(--wp--preset--font-size--medium);
  letter-spacing: -0.02em;
  text-transform: none;
}

/*
 * A five-pointed star after the text: it pops in once the label is out, then twinkles, pulsing
 * and fading while it turns, fastest when it's biggest and slowest when it's smallest. The
 * keyframes are sampled from speed = 1 + 0.7 cos(2πt), two fifths of a turn per pulse, so the
 * loop is seamless (the star looks the same every 72°) as long as it turns about its own centre,
 * which sits 54.75% down its box. They use the separate rotate and scale properties, so the
 * pop-in's transform isn't overridden.
 */
.motto__star {
  flex: none;
  width: 0.95em;
  height: 0.95em;
  background: var(--wp--preset--color--saffron);
  transform-origin: 50% 54.75%;
  clip-path: polygon(50% 4.8%, 61.2% 39.3%, 97.6% 39.3%, 68.2% 60.7%, 79.4% 95.3%, 50% 73.9%, 20.6% 95.3%, 31.8% 60.7%, 2.4% 39.3%, 38.8% 39.3%);
  transform: scale(0);
  transition: transform 0.15s ease-in;
}

.motto.is-open .motto__translation,
.motto:not(.is-dismissed):has(.motto__term:focus-visible) .motto__translation {
  opacity: 1;
  transform: var(--motto-to);
  transition: opacity 0.3s ease-out, transform 0.45s cubic-bezier(0.34, 1.8, 0.64, 1);
}

.motto.is-open .motto__star,
.motto:not(.is-dismissed):has(.motto__term:focus-visible) .motto__star {
  transform: scale(1);
  transition: transform 0.4s cubic-bezier(0.34, 1.8, 0.64, 1) 0.2s;
  animation: motto-twinkle 1.6s linear 0.6s infinite;
}

@media (hover: hover) {
  .motto:not(.is-dismissed):has(.motto__term:hover) .motto__translation {
    opacity: 1;
    transform: var(--motto-to);
    transition: opacity 0.3s ease-out, transform 0.45s cubic-bezier(0.34, 1.8, 0.64, 1);
  }

  .motto:not(.is-dismissed):has(.motto__term:hover) .motto__star {
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.34, 1.8, 0.64, 1) 0.2s;
    animation: motto-twinkle 1.6s linear 0.6s infinite;
  }
}

@keyframes motto-twinkle {
  0% { rotate: 0deg; scale: 1; opacity: 1; }
  6.25% { rotate: 15.1deg; scale: 0.99; opacity: 0.981; }
  12.5% { rotate: 29.3deg; scale: 0.963; opacity: 0.927; }
  18.75% { rotate: 41.8deg; scale: 0.923; opacity: 0.846; }
  25% { rotate: 52deg; scale: 0.875; opacity: 0.75; }
  31.25% { rotate: 59.8deg; scale: 0.827; opacity: 0.654; }
  37.5% { rotate: 65.3deg; scale: 0.787; opacity: 0.573; }
  43.75% { rotate: 69.1deg; scale: 0.76; opacity: 0.519; }
  50% { rotate: 72deg; scale: 0.75; opacity: 0.5; }
  56.25% { rotate: 74.9deg; scale: 0.76; opacity: 0.519; }
  62.5% { rotate: 78.7deg; scale: 0.787; opacity: 0.573; }
  68.75% { rotate: 84.2deg; scale: 0.827; opacity: 0.654; }
  75% { rotate: 92deg; scale: 0.875; opacity: 0.75; }
  81.25% { rotate: 102.2deg; scale: 0.923; opacity: 0.846; }
  87.5% { rotate: 114.7deg; scale: 0.963; opacity: 0.927; }
  93.75% { rotate: 128.9deg; scale: 0.99; opacity: 0.981; }
  100% { rotate: 144deg; scale: 1; opacity: 1; }
}

/* Fade only: the label doesn't slide and the star doesn't move. */
@media (prefers-reduced-motion: reduce) {
  .motto__translation {
    transform: var(--motto-to) !important;
    transition: opacity 0.2s linear !important;
  }

  .motto__star {
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}

.ambient-video-toggle {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(4 32 76 / 0.7);
  color: var(--wp--preset--color--white);
  cursor: pointer;
}

.ambient-video-toggle:hover {
  background: var(--wp--preset--color--darkest-blue);
}

.ambient-video-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.ambient-video-toggle[data-state="playing"] .ambient-video-toggle__play,
.ambient-video-toggle[data-state="paused"] .ambient-video-toggle__pause {
  display: none;
}

/* News cards without a photo: a tint panel with the club shield (see functions.php). */
.ucdrowing-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wp--preset--color--tint);
}

.ucdrowing-placeholder.is-style-arc {
  -webkit-mask: var(--ucd-arc) top center / 100% auto no-repeat;
  mask: var(--ucd-arc) top center / 100% auto no-repeat;
}

.ucdrowing-placeholder a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.ucdrowing-placeholder.is-style-arc img {
  -webkit-mask: none;
  mask: none;
}

.ucdrowing-placeholder img {
  width: 18%;
  height: auto;
  margin-top: 8%; /* Below the curve, so the shield looks centred in what's visible. */
  opacity: 0.35;
}

/*
 * Pages and posts set their text in a 720px column on the left of the 1240px area. Core floats
 * right-aligned images to the area's right edge, away from the text; keep them at the column's
 * edge instead, so the text wraps around them.
 */
.wp-block-post-content.is-content-justification-left > .alignright {
	margin-inline-end: max(0px, calc(100% - var(--wp--style--global--content-size, 720px)));
}

/*
 * Timeline (Seasons plugin) with the rowing boat (functions.php, assets/js/timeline-boat.js).
 * The line runs unbroken through the decades so the boat has a course: each decade carries it,
 * rather than each list, and the decade headings line up with the milestones' text.
 */
.ucdrs-timeline.has-boat {
	position: relative;
}

.ucdrs-timeline.has-boat .ucdrs-timeline__decade {
	margin: 0 0 0 0.5rem;
	border-left: 2px solid var(--wp--preset--color--light-blue);
}

.ucdrs-timeline.has-boat .ucdrs-timeline__decade + .ucdrs-timeline__decade {
	padding-top: var(--wp--preset--spacing--50);
}

.ucdrs-timeline.has-boat .ucdrs-timeline__heading {
	padding-left: var(--wp--preset--spacing--50);
}

.ucdrs-timeline.has-boat .ucdrs-timeline__list {
	margin-left: 0;
	border-left: 0;
}

/* A zero-width course down the middle of the line; the boat is centred on it. */
.timeline-boat {
	position: absolute;
	top: 0;
	bottom: 0;
	left: calc(0.5rem + 1px);
	width: 0;
	pointer-events: none;
}

/*
 * Milestone dots shrink away while the boat passes over them, then surface from the navy wake
 * behind it, overshooting a little before settling. (A transition takes the timing of the state
 * it moves to, so each rule times its own direction.)
 */
.ucdrs-timeline.has-boat .ucdrs-milestone::before {
	transition: opacity 0.2s, transform 0.45s cubic-bezier(0.34, 1.8, 0.64, 1);
}

.ucdrs-timeline.has-boat .ucdrs-milestone.is-under-boat::before {
	opacity: 0;
	transform: scale(0.4);
	transition: opacity 0.2s, transform 0.2s ease-in;
}

@media (prefers-reduced-motion: reduce) {
	.ucdrs-timeline.has-boat .ucdrs-milestone::before {
		transition: none;
	}
}

.timeline-boat__wake {
	position: absolute;
	top: 0;
	left: -1px;
	width: 2px;
	height: 0;
	background: var(--wp--preset--color--darkest-blue);
}

.timeline-boat__boat {
	position: sticky;
	z-index: 2;
	top: calc(50vh - 84px);
	display: block;
	margin-left: -32px;
	overflow: visible;
}

.timeline-boat__hull,
.timeline-boat__oar path {
	fill: var(--wp--preset--color--darkest-blue);
}

.timeline-boat__oar line {
	stroke: var(--wp--preset--color--darkest-blue);
	stroke-width: 1;
	stroke-linecap: round;
}

.timeline-boat__rower {
	fill: var(--wp--preset--color--mid-blue);
}

.timeline-boat__cockpit {
	fill: var(--wp--preset--color--light-blue);
}

.timeline-boat__bow-ball {
	fill: var(--wp--preset--color--white);
}

/* On phones the text sits nearer the line, so the boat is smaller to keep its oars clear of it. */
@media (max-width: 599px) {
	.timeline-boat__boat {
		top: calc(50vh - 63px);
		width: 48px;
		height: 126px;
		margin-left: -24px;
	}
}

/*
 * Countdown (Seasons plugin) on navy, as on the homepage: a Saffron eyebrow, Light Blue unit
 * labels and details, and a white button, since the default navy one would vanish.
 */
.wp-block-ucdrowing-countdown.has-darkest-blue-background-color .ucdrs-countdown__eyebrow {
	color: var(--wp--preset--color--saffron);
}

.wp-block-ucdrowing-countdown.has-darkest-blue-background-color :is(.ucdrs-countdown__label, .ucdrs-countdown__when) {
	color: var(--wp--preset--color--light-blue);
}

.wp-block-ucdrowing-countdown.has-darkest-blue-background-color .wp-element-button {
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--darkest-blue);
}

.wp-block-ucdrowing-countdown.has-darkest-blue-background-color .wp-element-button:hover {
	background-color: var(--wp--preset--color--light-blue);
}

/* While it's on, "Racing now" is the headline news. */
.wp-block-ucdrowing-countdown.is-live .ucdrs-countdown__eyebrow {
	font-size: var(--wp--preset--font-size--medium);
}

/*
 * The countdown's flip clock (ucdrowing_flip_clock() in functions.php, assets/js/flip-clock.js):
 * a split-flap card per digit, white on Dark Blue, with the hinge across the middle. Each card is
 * two clipped halves of the same digit, plus two leaves that only show while it flips.
 */
.flip-clock {
	display: block;
}

.flip-clock__cards {
	--flip-height: 1.3em;
	display: flex;
	justify-content: center;
	gap: 0.08em;
	font-size: min(var(--wp--preset--font-size--xx-large), 9vw);
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

/* The plugin's own numbers and labels, for screen readers. */
.flip-clock ~ :is(.ucdrs-countdown__number, .ucdrs-countdown__label) {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.wp-block-ucdrowing-countdown .ucdrs-countdown__unit {
	text-align: center;
}

/* Four numbers need tighter spacing to fit a phone. */
@media (max-width: 599px) {
	.wp-block-ucdrowing-countdown .ucdrs-countdown__clock {
		gap: var(--wp--preset--spacing--30);
	}

	.wp-block-ucdrowing-countdown .flip-clock .ucdrs-countdown__label {
		letter-spacing: 0.08em;
	}
}

/* Without motion, no ticking seconds: the clock changes once a minute. */
@media (prefers-reduced-motion: reduce) {
	.flip-clock__seconds {
		display: none;
	}
}

.flip-card {
	position: relative;
	width: 0.82em;
	height: var(--flip-height);
	border-radius: 0.1em;
	box-shadow: 0 0.06em 0.14em rgb(0 0 0 / 0.45);
	color: var(--wp--preset--color--white);
	perspective: 4em;
}

.flip-card__half {
	position: absolute;
	left: 0;
	right: 0;
	height: 50%;
	overflow: hidden;
	background-color: var(--wp--preset--color--dark-blue);
	backface-visibility: hidden;
}

.flip-card__half > span {
	display: block;
	height: var(--flip-height);
	line-height: var(--flip-height);
	text-align: center;
}

.flip-card__top {
	top: 0;
	border-radius: 0.1em 0.1em 0 0;
	background-image: linear-gradient(rgb(255 255 255 / 0.07), rgb(255 255 255 / 0.02));
	transform-origin: 50% 100%;
}

.flip-card__bottom {
	bottom: 0;
	border-radius: 0 0 0.1em 0.1em;
	transform-origin: 50% 0;
}

.flip-card__bottom > span {
	margin-top: calc(var(--flip-height) / -2);
}

/* The hinge: a gap between the halves, with a pin either side. */
.flip-card::before,
.flip-card::after {
	content: "";
	position: absolute;
	z-index: 3;
	top: 50%;
	transform: translateY(-50%);
}

.flip-card::before {
	left: 0;
	right: 0;
	height: max(1px, 0.03em);
	background-color: var(--wp--preset--color--darkest-blue);
}

.flip-card::after {
	left: -0.04em;
	right: -0.04em;
	height: 0.14em;
	background: linear-gradient(to right, var(--wp--preset--color--darkest-blue) 0.07em, transparent 0.07em calc(100% - 0.07em), var(--wp--preset--color--darkest-blue) calc(100% - 0.07em));
	border-radius: 0.02em;
}

.flip-card__leaf {
	display: none;
	z-index: 2;
}

.flip-card.is-flipping .flip-card__leaf {
	display: block;
}

.flip-card.is-flipping .flip-card__top.flip-card__leaf {
	animation: flip-card-fall 0.25s ease-in both;
}

.flip-card.is-flipping .flip-card__bottom.flip-card__leaf {
	animation: flip-card-land 0.25s 0.25s ease-out both;
}

@keyframes flip-card-fall {
	to {
		transform: rotateX(-90deg);
		filter: brightness(0.7);
	}
}

@keyframes flip-card-land {
	from {
		transform: rotateX(90deg);
		filter: brightness(1.4);
	}
}

/*
 * Anniversaries (Seasons plugin) on the tint band, as on the homepage. The featured photo is in
 * the UCD Arc (with the Arc rules above). Club and result badges are tint by default, so they
 * turn white to show against the band.
 */
.wp-block-ucdrowing-anniversaries.has-tint-background-color :is(.ucdrs-club--ucdbc, .ucdrs-result) {
	background-color: var(--wp--preset--color--white);
}

/*
 * Season cards (Seasons plugin index): the season's photo is in the UCD Arc (with the Arc rules
 * above), and a season without one shows the shield on tint, like the news placeholder.
 */
.ucdrs-season-card__photo.is-empty {
	position: relative;
}

.ucdrs-season-card__photo.is-empty::after {
	content: "";
	position: absolute;
	inset: 8% 0 0; /* Below the curve, so the shield looks centred in what's visible. */
	background: url("assets/images/ucd-rowing-icon.svg") center / 18% auto no-repeat;
	opacity: 0.35;
}

.ucdrs-anniversary__when strong {
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
 * Newsletter sign-up: Brevo's embedded form (patterns/newsletter-signup.php), restyled to sit in
 * the page like the site's own text, under the newsletter's masthead. Brevo's stylesheet loads
 * after this one, so every rule here starts from div.newsletter-signup, which outranks it.
 * ------------------------------------------------------------------------ */

div.newsletter-signup {
	margin-top: var(--wp--preset--spacing--50); /* Room above the masthead's arc. */
}

div.newsletter-signup .sib-form {
	padding: 0;
	background: none;
	font: inherit;
	text-align: left;
}

div.newsletter-signup #sib-container {
	display: block;
	padding: 0;
	background: none;
	border: 0;
}

div.newsletter-signup #sib-form {
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

div.newsletter-signup .sib-form-block {
	padding: 0;
}

div.newsletter-signup .sib-image-form-block img {
	display: block;
	width: 100%;
	height: auto;
}

div.newsletter-signup .sib-form-block h3 {
	margin: 0 0 var(--wp--preset--spacing--20);
}

div.newsletter-signup .sib-form-block p {
	line-height: 1.5;
}

div.newsletter-signup .sib-form .form__entry:not(:first-child) {
	margin-top: 0;
}

div.newsletter-signup .entry__label {
	margin-bottom: 0.4rem;
	font-weight: 500;
}

div.newsletter-signup .entry__label > * {
	float: none; /* Brevo floats whatever's in a label, which put "(optional)" first. */
}

div.newsletter-signup .entry__optional {
	font-weight: 400;
}

div.newsletter-signup .sib-form .entry__field {
	display: flex;
	width: 100%;
	margin: 0;
	border: 1px solid var(--wp--preset--color--mid-blue);
	border-radius: 4px;
	background: var(--wp--preset--color--white);
}

div.newsletter-signup .sib-form .entry__field:focus-within {
	box-shadow: none;
	outline: 2px solid var(--wp--preset--color--darkest-blue);
	outline-offset: 2px;
}

div.newsletter-signup .sib-form .input {
	box-sizing: border-box;
	width: 100%;
	height: 2.75rem;
	padding: 0 0.75rem;
	color: var(--wp--preset--color--darkest-blue);
	font-size: 1rem; /* 16px or more, so iPhones don't zoom in on the field. */
}

div.newsletter-signup .sib-form .entry__specification {
	margin: 0.4rem 0 0;
	color: inherit;
	font-size: var(--wp--preset--font-size--small);
}

/* Errors: the text stays Darkest Blue, as all text on white; a red edge marks the field. */
div.newsletter-signup .entry__error {
	margin: 0.4rem 0 0;
	padding: 0.35rem 0.6rem;
	border-left: 3px solid #b3261e;
	background: #fdeeed;
	color: var(--wp--preset--color--darkest-blue);
	font-size: var(--wp--preset--font-size--small);
}

div.newsletter-signup .sib-form .sib-entry_errored::before {
	content: none;
}

div.newsletter-signup .entry_errored .entry__field {
	border-color: #b3261e;
	box-shadow: inset 0 0 0 1px #b3261e;
}

/* The consent checkbox: Brevo hides the real input and draws its own box. */
div.newsletter-signup .sib-form .entry__choice {
	padding-left: 0;
	text-indent: 0; /* Brevo's hanging indent slid the text under the box. */
	font-family: inherit;
}

div.newsletter-signup .entry__choice label {
	display: grid !important;
	grid-template-columns: auto 1fr;
	gap: 0.6rem;
	align-items: start;
	cursor: pointer;
}

div.newsletter-signup .sib-form .entry__choice .checkbox {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.15rem 0 0;
	border: 1px solid var(--wp--preset--color--mid-blue);
	border-radius: 3px;
	vertical-align: 0;
}

div.newsletter-signup .sib-form .input_replaced:checked + .checkbox_tick_positive {
	border-color: var(--wp--preset--color--darkest-blue);
	background: var(--wp--preset--color--darkest-blue);
}

div.newsletter-signup .sib-form .input_replaced:focus-visible + .checkbox {
	box-shadow: none;
	outline: 2px solid var(--wp--preset--color--darkest-blue);
	outline-offset: 2px;
}

div.newsletter-signup .sib-form__declaration {
	display: block;
	font-size: var(--wp--preset--font-size--small);
}

div.newsletter-signup .sib-form a {
	color: inherit;
}

/* Subscribe is the site's own button (wp-element-button); Brevo shows a spinner in it while sending. */
div.newsletter-signup .sib-form-block__button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 0;
	padding: 0.75em 1.5em;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.3;
}

div.newsletter-signup .sib-form .clickable__icon:not(.sib-icon_standalone) {
	width: 1.1em;
	height: 1.1em;
	margin: 0;
	fill: currentColor;
}

div.newsletter-signup .sib-form .clickable__icon.sib-hide-loader-icon {
	display: none;
}

/* Sent, or not: a tint panel with a coloured edge, above the form. */
div.newsletter-signup .sib-form-message-panel {
	margin: 0 0 var(--wp--preset--spacing--40);
	padding: 0.25rem 0.5rem;
	border: 0;
	border-left: 3px solid var(--wp--preset--color--green);
	border-radius: 0;
	background: var(--wp--preset--color--tint);
	color: var(--wp--preset--color--darkest-blue);
}

div.newsletter-signup #error-message {
	border-left-color: #b3261e;
	background: #fdeeed;
}

div.newsletter-signup .sib-form-message-panel--active {
	display: block;
}
