/*
 * Everything the Rails site adds to the ported theme stylesheet (biys.css), which loads
 * first. Three kinds of rule live here:
 *
 *   1. Replacements for what the theme's JavaScript did (timetable layout, floating
 *      labels, lazy images, the carousel, the announcement bar).
 *   2. The page column and the default look of plain HTML inside it, so a page written
 *      as unstyled semantic HTML reads as part of the site.
 *   3. Components the theme did not have: notices, form errors, badges, pagination,
 *      empty states, the account sub-navigation.
 *   4. The signed-in student's pages and the shop.
 *
 * docs/FRONT_END.md lists the class names. /style-guide shows them in development.
 *
 * State is shown with a full background tint and words. There are no coloured
 * left-border stripes, no dots inside badges and no dots before headings.
 */

:root {
  --navy: #2f3f5c;
  --cream: #fef8f2;
  --cream-dark: #f6ede3;
  --sand: #efe8e1;
  --sage: #ced0be;
  --rose: #e27f7b;
  --rose-soft: #f6d5d2;
  --amber-soft: #f7e3bd;
  --line: #ddd5cb;
  --muted: #5d6a82;
  --radius: 3px;
}

/* ---- 1. Replacements for the theme's JavaScript ------------------------------------ */

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--navy);
  color: var(--cream);
}
.skip-link:focus {
  left: 10px;
  top: 10px;
  color: var(--cream);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A field people never see. A filled one marks the sender as a script. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}
.invert :focus-visible,
.timetable__event :focus-visible {
  outline-color: var(--cream);
}

/* The menu button is a real <button> now. */
button#toggle-menu {
  background: none;
  border: 0;
  cursor: pointer;
}
.icon__toggle {
  display: block;
}
header.header #main-menu a.current-page {
  font-weight: bold;
}
.inline-form {
  display: inline;
}

/* Floating labels: the theme's script added .used to a filled input. An input with
   placeholder=" " tells us the same through :placeholder-shown. */
.custom-input--text input:not(:placeholder-shown) ~ label,
.custom-input--text textarea:not(:placeholder-shown) ~ label,
.custom-input--text input:-webkit-autofill ~ label {
  top: 4px;
  left: 10px;
  font-size: 12px;
  color: var(--color);
}
.custom-input--text input,
.custom-input--text textarea,
.custom-input--select select {
  background: #fff;
}

/* Images: the theme swapped real sources in with a script. Here they are plain <img>
   tags with loading="lazy", inside the same ratio boxes. */
.p-img.show {
  background: var(--sand);
  overflow: hidden;
}
.p-img.show .p-img__img {
  object-fit: cover;
}
.arrow--light {
  filter: invert(1) grayscale(0.9) hue-rotate(50deg) brightness(1.5);
}
.row-block--photo {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}
.news-card__img img {
  display: block;
  width: 100%;
  height: auto;
}

/* The timetable. The theme's script measured the page and positioned each class. Here
   each class carries --start (hours from the top) and --length (hours long), and the
   grid has --rows hour rows. --hour is the height of an hour, as in the theme. */
.timetable--placed {
  opacity: 1;
}
.timetable[hidden],
.timetable__event[hidden] {
  display: none !important;
}
@media (max-width: 899px) {
  .timetable__day--empty {
    display: none;
  }
}
@media (min-width: 900px) {
  .timetable--placed {
    --hour: 130px;
  }
  .timetable--placed .timetable__day {
    min-height: calc(40px + var(--rows) * var(--hour));
  }
  .timetable--placed .timetable__event {
    position: absolute;
    left: 1px;
    width: calc(100% - 2px);
    top: calc(40px + var(--start) * var(--hour));
    height: auto;
    min-height: calc(var(--length) * var(--hour));
    display: block;
  }
}
@media (min-width: 1100px) {
  .timetable--placed {
    --hour: 115px;
  }
}

/* How a class can be attended is said by its buttons: "Book in studio" on every class,
   and "Book streaming" under it on the ones that are streamed. */
.timetable-event__footer .btn + .btn,
.timetable-class__book .btn + .btn {
  margin-top: 8px;
}
/* The grid's cards are narrow. Their buttons are smaller, never clip their words, and a
   card with two of them keeps room for both under its text. */
@media (min-width: 900px) {
  .timetable-event__footer .btn {
    padding: 3px 2px;
    font-size: 0.72rem;
    line-height: 1.3;
    white-space: nowrap;
    text-align: center;
  }
  .timetable-event__footer .btn + .btn {
    margin-top: 4px;
  }
  .timetable-event__inner--two-actions {
    padding-bottom: 62px;
  }
}
/* Seven columns in a narrow window leave each card about 100px wide. */
@media (min-width: 900px) and (max-width: 1179px) {
  .timetable-event__footer .btn {
    padding: 3px 0;
    font-size: 0.64rem;
    letter-spacing: -0.01em;
  }
}
@media (min-width: 1400px) {
  .timetable-event__footer .btn {
    font-size: 0.8rem;
  }
  .timetable-event__inner--two-actions {
    padding-bottom: 66px;
  }
}

/* The beginner classes: a row that scrolls sideways on a phone, in place of Slick. */
.feed-section .container {
  padding-left: 20px;
}
.card-scroller {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 10px 20px 20px;
  justify-content: safe center;
}
.card-scroller .card {
  flex: 0 0 240px;
  width: auto;
  margin: 0;
  scroll-snap-align: start;
}

/* The announcement bar is fixed to the foot of the window, so the page ends higher. */
body.has-announcements {
  padding-bottom: 60px;
}
.announcements a {
  text-decoration: underline;
}

/* Small pieces of the public pages. */
.credits-section {
  margin-top: -40px;
  margin-bottom: 40px;
}
.pack-prices {
  list-style: none;
  margin: 15px 0 0;
  padding: 0;
  text-align: left;
}
.pack-prices li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.contact-form__subject {
  width: 200px;
}
.faq {
  margin-bottom: 20px;
}
.newsletter-form {
  position: relative;
}
.timetable-intro {
  margin: 20px 0;
}
.news--announcements .news__list-post + .news__list-post {
  margin-top: 30px;
}

/* ---- 2. The page column, and plain HTML inside it ---------------------------------- */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
.page--wide {
  max-width: 1100px;
}
.account-area .page {
  max-width: 860px;
  margin-left: 0;
  padding: 30px 20px 80px;
}
@media (min-width: 900px) {
  .account-area .page {
    padding-left: 40px;
    padding-right: 40px;
  }
}
.account-area .page--wide {
  max-width: none;
}

.page h1 {
  font-size: 2.4rem;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.page h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
}
.page h3 {
  margin-top: 1.5rem;
}
.page a:not([class]) {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.page hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

/* Forms written as a label followed by its field. */
.page form br {
  display: none;
}
.page form:not(.button_to):not(.inline-form) {
  margin-bottom: 1.5rem;
}
.page label {
  display: block;
  margin: 16px 0 6px;
  font-weight: bold;
  font-size: 0.95rem;
}
.page .custom-input--text label,
.page .custom-input--select label {
  margin: 0;
  font-weight: normal;
}
.page input:not([type]),
.page input[type="text"],
.page input[type="email"],
.page input[type="password"],
.page input[type="tel"],
.page input[type="number"],
.page input[type="search"],
.page input[type="url"],
.page input[type="date"],
.page input[type="time"],
.page select,
.page textarea,
.input {
  display: block;
  width: 100%;
  padding: 11px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
}
.page .custom-input--text input,
.page .custom-input--text textarea {
  padding: 18px 10px 4px 8px;
}
.page textarea {
  min-height: 132px;
}
.page input[type="checkbox"],
.page input[type="radio"] {
  margin-right: 6px;
}
.page label:has(> input[type="checkbox"]),
.page label:has(> input[type="radio"]) {
  font-weight: normal;
}
.page fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 20px 20px;
  margin: 0 0 1.5rem;
}
.page legend {
  padding: 0 6px;
  font-weight: bold;
}
.field_with_errors {
  display: contents;
}
.field_with_errors input,
.field_with_errors select,
.field_with_errors textarea {
  background: var(--rose-soft);
}

/* A button or submit with no class of its own is the primary action. */
.page button:not([class]),
.page input[type="submit"]:not([class]) {
  display: inline-block;
  margin-top: 20px;
  padding: 0.5rem 1rem;
  font: inherit;
  line-height: 1.25;
  color: var(--cream);
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 4px;
  cursor: pointer;
}
.page form.button_to button:not([class]) {
  margin-top: 0;
  color: var(--navy);
  background: transparent;
}
.page td form.button_to button:not([class]) {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}
.page button:disabled,
.page input[type="submit"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Tables. A table with no class looks like .table. Wrap a wide one in .table-responsive. */
.page table:not([class]) {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
}
.page table:not([class]) th,
.page table:not([class]) td,
.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line);
}
.page table:not([class]) thead th,
.table thead th {
  border-top: 0;
  border-bottom: 2px solid var(--line);
  font-size: 0.9rem;
}
.table-responsive {
  overflow-x: auto;
  /* The containing block for a .visually-hidden label in a cell. Without it the label is
     placed against the page, escapes this box's clipping, and widens the page on a phone. */
  position: relative;
}
.numeric {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.page dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 8px 20px;
}
.page dd {
  margin: 0;
}
@media (max-width: 599px) {
  .page dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .page dd {
    margin-bottom: 10px;
  }
}
.page code,
.page pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.page pre {
  padding: 15px;
  overflow-x: auto;
  background: var(--sand);
  border-radius: var(--radius);
}

/* ---- 3. Components ----------------------------------------------------------------- */

/* Notices: a message about what just happened, or about the state of the page. */
.flash-messages {
  max-width: 640px;
  margin: 20px auto;
  padding: 0 20px;
}
.page .flash-messages {
  max-width: none;
  margin: 0 0 20px;
  padding: 0;
}
.notice {
  margin: 0 0 15px;
  padding: 12px 15px;
  border-radius: 4px;
  background: var(--sand);
  text-align: left;
}
.notice--success {
  background: var(--sage);
}
.notice--error {
  background: var(--rose-soft);
}
.notice--warning {
  background: var(--amber-soft);
}

/* The errors on a form, listed above it. */
.form-errors {
  margin: 0 0 20px;
  padding: 12px 15px 12px 35px;
  border-radius: 4px;
  background: var(--rose-soft);
  text-align: left;
}
.form-errors li + li {
  margin-top: 4px;
}
.field-error {
  display: block;
  margin-top: 4px;
  font-size: 0.875rem;
  font-weight: bold;
}
.hint {
  display: block;
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Badges: one fact each, in words. */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--sand);
  /* Its own text colour: a badge on a navy card would otherwise inherit cream on sand. */
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: bold;
  line-height: 1.5;
  white-space: nowrap;
}
.badge--success {
  background: var(--sage);
}
.badge--warning {
  background: var(--amber-soft);
}
.badge--danger {
  background: var(--rose-soft);
}
.badge--dark {
  background: var(--navy);
  color: var(--cream);
}

/* Pagination. */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 30px 0;
}
.pagination a,
.pagination span {
  min-width: 40px;
  padding: 8px 12px;
  border: 1px solid var(--navy);
  border-radius: 4px;
  text-align: center;
  text-decoration: none !important;
}
.pagination [aria-current="page"],
.pagination .pagination__current {
  background: var(--navy);
  color: var(--cream);
}
.pagination .pagination__gap,
.pagination [aria-disabled="true"] {
  border-color: transparent;
  color: var(--muted);
}

/* Empty states: what to say when a list has nothing in it. */
.empty-state {
  margin: 20px 0;
  padding: 40px 20px;
  border-radius: 4px;
  background: var(--sand);
  text-align: center;
}
.empty-state > :last-child {
  margin-bottom: 0;
}

/* A stand-alone card, outside the .cards grid. */
.panel-card {
  margin-bottom: 20px;
  padding: 20px;
  border-radius: 2px;
  background: var(--cream);
  box-shadow: 0 0 10px rgba(1, 1, 1, 0.1);
}
.panel-card > :last-child {
  margin-bottom: 0;
}

/* Button rows. */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.btn--danger {
  color: #fff;
  background: #b8433d;
  border-color: #b8433d;
}

/* The links between the account settings pages. */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 30px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.page .subnav a {
  text-decoration: none;
}
.page .subnav a.current-page {
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* The signed-in side navigation. */
aside.nav-panel form.button_to {
  margin: 10px 15px;
}
aside.nav-panel a.current-page {
  font-weight: bold;
}

/* ---- 4. The signed-in student's pages and the shop ----------------------------------- */

/* A heading with a link beside it. */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
}
/* The theme already has a .section-heading: the centred "Articles" heading on the news
   page and under an article. It is not a row with a link beside it. */
.news--articles .section-heading {
  display: block;
}
.acc-section {
  margin-top: 40px;
}
.page .acc-section .subheading,
.page .panel-card .subheading {
  margin-top: 0;
  font-size: 1.2rem;
}
.page .acc-hero h1 {
  text-transform: none;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
}
.page .acc-hero a,
.page .acc-section a:not(.btn) {
  border-bottom: 0;
}

/* The credit summary: the figures side by side. */
.credit-summary__figures {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 40px;
  margin: 10px 0;
}
.credit-summary__figures dt {
  font-size: 0.875rem;
  font-weight: normal;
  color: var(--muted);
}
.credit-summary__figures dd {
  margin: 0;
  font-weight: bold;
}
.credit-summary .notice {
  margin: 10px 0 0;
}

/* Booking cards, as on the WordPress dashboard. */
.booking-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin: 10px 0 0;
}
.booking-cards .card {
  float: none;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
}
.booking-cards .card__inner {
  height: 100%;
}
.page .booking__when {
  margin: 0;
  font-size: 1rem;
  font-weight: normal;
}
.booking__when span {
  display: block;
}
.booking__class,
.booking__badges,
.booking__access,
.booking__cancel-by {
  margin: 8px 0 0;
}
.booking__badges .badge {
  margin-right: 4px;
}
.booking--cancelled .card__inner,
.booking--no_show .card__inner {
  background: var(--sand);
}
.booking-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 20px;
}
.booking-details dt {
  color: var(--muted);
  font-weight: normal;
}
.booking-details dd {
  margin: 0;
}

/* The bookable timetable: a column for each day on a wide screen, a list on a phone, with
   each class as a card in the manner of the public timetable. */
.timetable-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 20px 0 10px;
}
.timetable-filter,
.timetable-weeks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.page .timetable-filter label,
.page .timetable-filter select {
  width: auto;
  margin: 0;
}
.timetable-days {
  display: grid;
  gap: 20px 10px;
  margin-top: 20px;
}
@media (min-width: 1100px) {
  .timetable-days {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: start;
  }
}
.page .timetable-day__heading {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--navy);
  font-size: 1rem;
  text-transform: uppercase;
}
.timetable-day__classes {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 600px) and (max-width: 1099px) {
  .timetable-day__classes {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}
.timetable-class {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 2px;
  background: var(--cream-dark);
  font-size: 0.9rem;
}
.timetable-class--booked {
  background: var(--sage);
}
.timetable-class--cancelled,
.timetable-class--holiday {
  background: var(--sand);
  color: var(--muted);
}
.timetable-class__time {
  font-weight: bold;
}
.timetable-class__title {
  font-size: 1rem;
  font-weight: bold;
}
.timetable-class__action p {
  margin: 0 0 8px;
}
.timetable-class__modes,
.repeat-booking__modes,
.repeat-booking__dates {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.timetable-class__modes legend {
  font-size: 0.8rem;
  color: var(--muted);
}
.repeat-booking legend {
  font-size: 1.1rem;
  font-weight: bold;
  text-transform: uppercase;
}
.timetable-class__mode {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page .timetable-class__mode label {
  margin: 0;
  font-weight: normal;
}
.page .timetable-class form.button_to {
  margin: 0;
}

/* Booking several dates of one class. */
.repeat-booking__list {
  margin: 10px 0 20px;
  padding: 0;
  list-style: none;
}
.repeat-booking__date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.page .repeat-booking__date label {
  flex: 1;
  margin: 0;
  font-weight: normal;
}
.repeat-booking__date--unavailable label {
  color: var(--muted);
}
.repeat-booking__outcome ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

/* The shop: class packs, product pages, the checkout, orders and receipts. */
.credit-packs.cards {
  margin-top: 0;
}
.credit-pack__sizes,
.buy__options {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.credit-pack__size,
.buy__option {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 15px;
  border: 1px solid var(--navy);
  border-radius: 2px;
  font-weight: bold;
  text-decoration: none !important;
}
.credit-pack__size:hover,
.credit-pack__size:focus-visible,
.buy__option:hover,
.buy__option:focus-visible {
  background: var(--navy);
  color: var(--cream);
}
.product__body,
.product__buy,
.product__access {
  margin-top: 30px;
}
.buy__state {
  padding: 12px 15px;
  border-radius: 4px;
  background: var(--sand);
}
.order-summary__table th {
  font-weight: normal;
}
.order-summary__total th,
.order-summary__total td,
.order-summary__due th,
.order-summary__due td {
  font-weight: bold;
}
.order-summary__table td {
  text-align: right;
}
.checkout-form fieldset {
  margin: 30px 0 0;
  padding: 0;
  border: 0;
}
.checkout-form legend {
  font-size: 1.2rem;
  font-weight: bold;
  text-transform: uppercase;
}
.checkout-form .field {
  margin-top: 15px;
}
.field__hint {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.field__error {
  margin: 4px 0 0;
  font-size: 0.875rem;
  font-weight: bold;
}
.checkout-form__pay {
  margin-top: 10px;
}
.checkout-form__apply {
  margin-top: 12px;
}
.page .order-summary h2 {
  margin-top: 0;
}
.receipt {
  padding: 30px;
  background: #fff;
  box-shadow: 0 0 10px rgba(1, 1, 1, 0.1);
}
@media print {
  .header,
  .acc-header,
  .nav-panel,
  .footer,
  .announcements,
  .receipt__actions {
    display: none !important;
  }
  .receipt {
    box-shadow: none;
    padding: 0;
  }
}

/* "My Account" in the public header: the signed-in navigation as a menu that opens
   without a script. */
.account-dropdown {
  position: relative;
}
.account-dropdown summary {
  list-style: none;
  cursor: pointer;
}
.account-dropdown summary::-webkit-details-marker {
  display: none;
}
.account-dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 220px;
  margin: 0;
  padding: 10px 15px;
  list-style: none;
  background: var(--cream);
  box-shadow: 0 0 10px rgba(1, 1, 1, 0.15);
  text-align: left;
}
.account-dropdown__menu li {
  display: block;
  margin: 0;
  padding: 6px 0;
}
.account-dropdown__menu i {
  display: inline-block;
  width: 1.4em;
}
.account-dropdown__menu a.current-page {
  font-weight: bold;
}

/* The living style page. */
.style-guide section {
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.style-guide__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.style-guide__swatches div {
  width: 110px;
  padding: 40px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* The two-factor set-up code. Black on white whatever the page colours, and large enough
   to scan from a laptop screen. */
.two-factor-qr {
  margin: 16px 0;
}
.two-factor-qr .qr-code {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
}
