/*
  Rega Companies: the layout of regacorp.com.

  Colours, fonts and sizes come from tokens.css (loaded first). This file
  only arranges them. The approved mockups are in design/.

  Every page has the same three layers: the satin, fixed to the screen at the
  back; the page itself, scrolling over it; and the header bar, frozen at the
  top. On the three pages the text below the title sits on cards.
*/

/* ---- Page ------------------------------------------------------------- */

/* An in-page link or a reload lands a heading below the bar, not under it. */
html {
  scroll-padding-top: calc(var(--bar-height) + 24px);
}

body {
  margin: 0;
  background: var(--rega-black);
}

a {
  color: var(--rega-ivory);
  text-decoration: none;
}

a:hover {
  color: var(--rega-gold-light);
}

/* Keyboard focus: a thin gold outline, kept off the text. Mouse clicks do
   not show it on links and buttons (:focus-visible); a field being typed in
   always shows it. */
a:focus-visible,
summary:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--rega-gold-light);
  outline-offset: 4px;
}

a:focus-visible {
  color: var(--rega-gold-light);
}

/* The satin (partials/satin.php): fixed to the screen, behind everything,
   never clickable. A positioned element, not a fixed background, because
   phones ignore fixed backgrounds. Its height is the screen's largest, so
   it does not jump while a phone's address bar slides away. */
.satin {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;  /* the large viewport on phones: the toolbar never resizes it */
  pointer-events: none;
}

/* Everything else scrolls over the satin. */
.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--rega-ivory);
  font-family: var(--font-body);
  font-weight: var(--weight-light);
}

/* ---- The header bar (partials/header.php), every page ------------------ */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--rega-bar);
  border-bottom: 1px solid var(--rega-bar-edge);
}

.bar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-sizing: border-box;
  height: calc(var(--bar-height) - 1px);  /* + the 1px edge = --bar-height */
  padding: 0 var(--page-pad-inline);
}

/* On the three pages and the 404 page the bar lines up with the column
   below it. */
.inner .bar-row {
  max-width: 1120px;
  margin: 0 auto;
}

/* The R monogram (partials/monogram.php): 48px, 40px on a phone. */
.mark {
  display: block;
  flex: none;
  width: 48px;
  height: 48px;
}

.monogram-mark {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The page links and Client access, on wide screens. */
.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: var(--size-nav);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-nav);
  text-transform: uppercase;
}

.nav a {
  color: var(--rega-ivory);
  padding: var(--link-pad) 0;
}

/* The page you are on, and hover. */
.nav a[aria-current="page"],
.nav a:hover,
.nav a:focus-visible {
  color: var(--rega-gold-light);
}

/* The thin line between the page links and Client access. */
.nav-divider {
  width: 1px;
  align-self: stretch;
  background: var(--rega-underline);
  margin: 12px 0;
}

/* The Menu: phones only, see below. */
.menu {
  display: none;
}

@media (max-width: 768px) {
  /* The R is drawn at 40px; its link keeps a 44px touch area. */
  .mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
  }

  .mark .monogram-mark {
    width: 40px;
    height: 40px;
  }

  .nav {
    display: none;
  }

  .menu {
    display: block;
  }
}

/* The Menu button: the word, then two gold hairlines that cross into an X
   when the Menu is open. No JavaScript: <details> opens and closes itself. */
.menu-button {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
  font-size: var(--size-caps);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-menu);
  text-transform: uppercase;
  color: var(--rega-ivory);
}

.menu-button::-webkit-details-marker {
  display: none;
}

.menu-word-close,
.menu[open] .menu-word-open {
  display: none;
}

.menu[open] .menu-word-close {
  display: inline;
}

.menu-lines {
  position: relative;
  width: 22px;
  height: 7px;
}

.menu-lines::before,
.menu-lines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rega-gold-light);
}

.menu-lines::before {
  top: 0;
}

.menu-lines::after {
  bottom: 0;
}

.menu[open] .menu-lines::before {
  top: 3px;
  transform: rotate(45deg);
}

.menu[open] .menu-lines::after {
  bottom: 3px;
  transform: rotate(-45deg);
}

/* While the Menu is open the page below the bar is dimmed. The dim is part
   of the button, so a tap on the page closes the Menu too. */
.menu-dim {
  display: none;
}

.menu[open] .menu-dim {
  display: block;
  position: fixed;
  top: var(--bar-height);
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--rega-dim);
}

/* The open Menu drops down under the bar, full width. */
.menu-panel {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px var(--page-pad-inline) 32px;
  background: var(--rega-menu);
  border-bottom: 1px solid var(--rega-divider);
  /* On a short screen (a phone on its side) the Menu scrolls inside itself,
     so Client access is always reachable. */
  max-height: calc(100vh - var(--bar-height));
  box-sizing: border-box;
  overflow-y: auto;
}

.menu-page {
  padding: 8px 0;
  font-family: var(--font-display);
  font-size: var(--size-menu);
  font-weight: var(--weight-regular);
  line-height: 1.2;
}

.menu-page[aria-current="page"] {
  color: var(--rega-gold-light);
}

.menu-rule {
  width: 56px;
  height: 1px;
  margin: 20px 0 12px;
  background: var(--rega-gold);
}

.menu-access {
  padding: var(--link-pad) 0;
  font-size: var(--size-caps);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-menu);
  text-transform: uppercase;
}

/* ---- The home and 404 pages ------------------------------------------- */

.frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0 var(--page-pad-inline) var(--page-pad-block);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 72px 0 56px;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: var(--size-wordmark);
  letter-spacing: var(--tracking-wordmark);
  line-height: 1;
  /* Letter-spacing adds space after the last letter too; the same amount on
     the left keeps the word optically centred. */
  padding-left: var(--tracking-wordmark);
}

.rule {
  width: 56px;
  height: 1px;
  background: var(--rega-gold);
}

.hero .rule {
  margin: 40px 0 28px;
}

.tagline {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--size-tagline);
  color: var(--rega-cream);
}

/* The two divisions on the home page. */
.divisions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 88px;
  width: 100%;
  max-width: 980px;
}

.division {
  flex: 1 1 360px;
  padding: 32px clamp(16px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.eyebrow {
  font-size: var(--size-caps);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--rega-gold);
}

.division h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-size: var(--size-heading);
  letter-spacing: var(--tracking-heading);
}

.division p {
  margin: 0;
  font-size: var(--size-text);
  line-height: var(--leading-text);
  color: var(--rega-mist);
  max-width: 340px;
}

.division-links {
  display: flex;
  gap: 32px;
  font-size: var(--size-link);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-links);
  text-transform: uppercase;
  margin-top: 8px;
}

.division-links a {
  padding: var(--link-pad) 0;
  border-bottom: 1px solid var(--rega-underline);
}

.divider {
  width: 1px;
  align-self: stretch;
  background: var(--rega-divider);
  margin: 24px 0;
}

.notfound {
  padding-bottom: 72px;
}

.notfound .division-links {
  margin-top: 48px;
}

/* ---- The three pages: /travel, /corporate, /consulting ----------------- */

.inner main {
  flex: 1;
}

/* The title, directly on the satin. The title area runs the full width of
   the screen, so the soft darkening behind it (below) fades out at the
   screen's edges; the words keep to the 1120px column. */
.page-hero {
  min-height: calc(var(--hero-height) - var(--bar-height));
  display: flex;
  flex-direction: column;
}

.hero-copy {
  flex: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 28px;
  padding: 72px var(--page-pad-inline) 120px;
}

/* The small gold line and the title can cross the brightest parts of the
   satin as the page scrolls. A soft darkening behind the title, moving with
   it, keeps every line at least 4.5:1 (measured). */
.page-hero {
  position: relative;
  z-index: 0;
}

.page-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--rega-hush);
  pointer-events: none;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: var(--size-title);
  letter-spacing: var(--tracking-title);
  line-height: 1.05;
}

.page-title.long {
  font-size: var(--size-title-long);
  line-height: 1.08;
  max-width: 900px;
}

.lede {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--size-tagline);
  line-height: 1.4;
  color: var(--rega-cream);
}

/* The cards: one per section, with the satin showing between them. */
.cards {
  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--page-pad-inline) var(--card-gap);
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
}

.card {
  padding: var(--card-pad);
  background: var(--rega-card);
  border: 1px solid var(--rega-card-edge);
}

.intro {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--size-intro);
  line-height: 1.6;
  color: var(--rega-pearl);
  max-width: 820px;
}

.card h2 {
  margin: 0 0 48px;
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-size: var(--size-section);
  letter-spacing: var(--tracking-title);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 48px 72px;
}

.item h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-size: var(--size-item);
  letter-spacing: 0.02em;
  color: var(--rega-ivory);
}

.item p {
  margin: 0;
  font-size: var(--size-text);
  line-height: var(--leading-text);
  color: var(--rega-mist);
}

.num {
  display: block;
  font-size: var(--size-caps);
  letter-spacing: var(--tracking-caps);
  color: var(--rega-gold);
  margin-bottom: 14px;
}

.card.closing {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.cta {
  display: inline-block;
  font-size: var(--size-link);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-links);
  text-transform: uppercase;
  padding: var(--link-pad) 0;
  border-bottom: 1px solid var(--rega-bronze);
}

/* ---- The forms: /circle, and the inquiry on /corporate and /consulting -- */

/* /circle: the contact card, a card per question and the button, with the
   same gap as the cards. */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
}

/* /corporate and /consulting: the form sits in the closing card, under its
   line and gold rule, one field under another. */
.form.inquiry {
  box-sizing: border-box;
  width: 100%;
  max-width: 640px;
  gap: 36px;
  text-align: left;
}

/* The field only robots fill in: never shown. */
.hp {
  display: none;
}

/* The message at the top of a form that has come back to the visitor. */
.form-notice {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--size-tagline);
  line-height: 1.4;
  color: var(--rega-gold-light);
}

.card > .form-notice {
  margin-bottom: 48px;
}

/* /circle's contact details: two columns where there is room. */
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 40px 72px;
}

/* A field: its label in small capitals, then any message, then the field. */
.field {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.field {
  display: block;
}

.field > label,
.field > legend {
  padding: 0;
  font-size: var(--size-caps);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-menu);
  text-transform: uppercase;
  color: var(--rega-cream);
}

.field > legend + * {
  margin-top: 12px;
}

/* "(optional)" after a label: the same muted colour and size, in lower case. */
.optional {
  margin-left: 8px;
  color: var(--rega-mist);
  text-transform: none;
  letter-spacing: 0.06em;
}

.field-error {
  margin: 0;
  font-size: var(--size-text);
  font-weight: var(--weight-regular);
  line-height: 1.5;
  color: var(--rega-gold-light);
}

/* A line of text: a gold line under it. The message: a gold box. */
.field > input,
.phone input,
.phone select,
.field > textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 10px 0 11px;
  border: 0;
  border-bottom: 1px solid var(--rega-gold);
  border-radius: 0;
  background: transparent;
  color: var(--rega-ivory);
  font-family: var(--font-body);
  font-size: var(--size-text);
  font-weight: var(--weight-light);
  line-height: 1.5;
}

.field > textarea {
  min-height: 180px;
  padding: 12px 14px;
  border: 1px solid var(--rega-gold);
  resize: vertical;
}

.field > input:focus,
.phone input:focus,
.phone select:focus,
.field > textarea:focus {
  border-color: var(--rega-gold-light);
}

/* The phone: the country, then the number, side by side; where there is no
   room for both, the number goes under the country. The country list opens
   from a small gold chevron. */
.phone {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.phone select {
  /* As wide as its longest country name where there is room, so the calling
     code is never cut off; narrower only on a phone. */
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding-right: 26px;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--rega-gold) 50%), linear-gradient(135deg, var(--rega-gold) 50%, transparent 50%);
  background-position: right 7px center, right 2px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* /circle's contact details: the phone takes the whole width of the card,
   so its two parts sit side by side there too. */
.fields > fieldset.field {
  grid-column: 1 / -1;
}

.phone option {
  background: var(--rega-black);
  color: var(--rega-ivory);
}

.phone input {
  flex: 1 1 180px;
  min-width: 0;
}

/* A browser filling in a saved address keeps the page's colours. */
.field > input:-webkit-autofill,
.phone input:-webkit-autofill {
  -webkit-text-fill-color: var(--rega-ivory);
  caret-color: var(--rega-ivory);
  box-shadow: inset 0 0 0 100px var(--rega-black);
}

/* A Circle question: the numeral, the question as a heading, the answers. */
.question {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.question > legend {
  padding: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-size: var(--size-section);
  letter-spacing: var(--tracking-title);
  line-height: 1.25;
}

.question > legend + * {
  margin-top: 36px;
}

.question > .field-error + .choices {
  margin-top: 20px;
}

/* The answers: a quiet gold ring, filled with a gold dot when chosen. The
   whole line is the target, at least 44px high. */
.choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 760px;
}

.choices.side-by-side {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px 40px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
  font-size: var(--size-text);
  line-height: var(--leading-text);
  color: var(--rega-mist);
}

.choice input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  margin: 4px 0 0;
  border: 1px solid var(--rega-gold);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.choice input:checked {
  border-color: var(--rega-gold-light);
  background: radial-gradient(circle closest-side, var(--rega-gold-light) 44%, transparent 54%);
}

.choice:hover input {
  border-color: var(--rega-gold-light);
}

.choice:hover span,
.choice input:checked + span {
  color: var(--rega-ivory);
}

/* In Windows' high-contrast mode the browser's own round buttons come back. */
@media (forced-colors: active) {
  .choice input,
  .phone select {
    -webkit-appearance: auto;
    appearance: auto;
    background-image: none;
  }
}

/* The button that sends a form: the capitalised link, as a button. */
.form-send {
  display: flex;
  justify-content: center;
}

button.cta {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--rega-bronze);
  border-radius: 0;
  background: none;
  color: var(--rega-ivory);
  font-family: var(--font-body);
  line-height: normal;
  cursor: pointer;
}

button.cta:hover,
button.cta:focus-visible {
  color: var(--rega-gold-light);
}

/* /thank-you, and the page asking the visitor to email when a request could
   not be stored: one card in the middle of the screen. */
.notice-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 72px;
}

.notice-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-light);
  font-size: var(--size-section);
  letter-spacing: var(--tracking-title);
}

.notice-page .intro a {
  border-bottom: 1px solid var(--rega-bronze);
}

/* ---- Footer (partials/footer.php), every page ------------------------- */

/* Three columns: email left, cities centre, Team access right. On a narrow screen
   they stack, centred. */
.foot {
  font-size: var(--size-footer);
  letter-spacing: var(--tracking-footer);
  text-transform: uppercase;
  color: var(--rega-taupe);
}

.foot-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.foot-row > :first-child { justify-self: start; }
.foot-row > :nth-child(2) { justify-self: center; }
.foot-row > :last-child { justify-self: end; }

.foot a {
  color: var(--rega-taupe);
  padding: 14px 0;  /* a 44px touch target */
}

.foot a:hover,
.foot a:focus-visible {
  color: var(--rega-gold-light);
}

/* Home: a line at the bottom of the frame, as approved. */
.frame > .foot {
  border-top: 1px solid var(--rega-footer-rule);
  padding-top: 24px;
}

/* The three pages and the 404 page: a full-width strip, like the bar. */
.page > .foot {
  background: var(--rega-bar);
  border-top: 1px solid var(--rega-bar-edge);
}

.page > .foot > .foot-row {
  box-sizing: border-box;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px var(--page-pad-inline) 40px;
}

@media (max-width: 640px) {
  .foot-row {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .foot-row > :first-child,
  .foot-row > :nth-child(2),
  .foot-row > :last-child {
    justify-self: center;
  }
}
