/*
 * Dev adaptations for the recreated legacy theme.
 *
 * The legacy markup is rendered inside WordPress' `.wp-site-blocks` wrapper, so
 * the original html/body height chain needs a nudge and theme.json's base
 * typography/background must yield to the legacy defaults.
 */

html,
body {
  height: 100%;
}

body {
  background: url(/assets/legacy/images/purple-pattern.gif) repeat !important;
  font-size: 16px;
  line-height: normal;
}

.wp-site-blocks {
  background: transparent;
  font-size: 16px;
  line-height: normal;
}

/* The legacy templates own their own spacing; kill block-theme gutters. */
.wp-site-blocks > * {
  margin-block-start: 0;
}

/* Original: .header-wrapper{height:100%} with html,body{height:100%} (home only). */
.home .header-wrapper {
  height: 100vh;
  min-height: 560px;
}

.home main {
  padding: 0 20px;
}

/* theme.json ships a 1.75 line-height and a ~22px base font size; the original
   design relies on the browser defaults (16px / normal), and the legacy
   stylesheet only sets them where it wants one
   (e.g. #footer ul li{line-height:100%}). */
#contact ul,
#footer ul {
  font-size: 16px;
  line-height: normal;
}

/* Pin the few line boxes the original inherits from the browser default: the
   minified original has no whitespace nodes, so these lists collapse to the
   line-height of their <li>, and its box links are exactly the image height. */
#footer ul {
  line-height: 15px;
}

#contact ul.address {
  line-height: 18px;
}

#contact ul.details {
  line-height: 16px;
}

#contact ul.socials {
  line-height: 0;
}

#contact ul.socials img {
  display: block;
}

.links a img {
  display: block;
}

/* Inner pages: the heading band carries the page title plus its excerpt. */
.page-title-inner .wp-block-post-title {
  margin: 0;
}

.page-title-inner .wp-block-post-excerpt,
.page-title-inner .wp-block-post-excerpt__excerpt {
  margin: 0;
  color: #fff;
  font-size: 18px;
  line-height: 175%;
  font-weight: 300;
}

/* The block library injects
   `:root :where(.is-layout-flow) > * { margin-block: 1.2rem 0 }`, which resolves
   to specificity (0,1,0) — `:root` counts as a pseudo-class — so it BEATS
   front.css's `* { margin: 0 }` at (0,0,0). Live's content wrapper is not
   `is-layout-flow`, so live has no top margin on page content. The 19.2px only
   becomes visible where a zero-margin heading precedes a paragraph (between two
   paragraphs the sibling margins collapse and absorb it) — on `/resources/`
   four h2→p pairs added 4 x 19.2 = 76.8px, exactly the measured gap vs live.
   Zero it so our pages match live. */
main .wp-block-post-content > * {
  margin-top: 0;
  margin-block-start: 0;
}

/* Page content sits on the purple ground like the original.
   Paragraphs are excluded: the live theme's `main p { margin-bottom: 25px }`
   has NO last-child exception (live's content wrapper is not `is-layout-flow`,
   so the block library's zero-specificity reset never applies there), and live
   keeps that trailing 25px before the contact band. Suppressing it only for
   block children still kills the stray gap under a trailing columns/table. */
main .wp-block-post-content > :not(p):last-child {
  margin-bottom: 0;
}

/* A trailing paragraph must keep live's 25px. The block library injects
   `:root :where(.is-layout-flow) > :last-child { margin-block-end: 0 }` at
   specificity (0,2,0), which outranks `main .wp-block-post-content p` (0,1,2) —
   live never hits it because live's content wrapper is not `is-layout-flow`.
   Restate the margin here (0,2,2) so the cascade lands where live's does. */
main .wp-block-post-content > p:last-child {
  margin-bottom: 25px;
  margin-block-end: 25px;
}

/* The legacy stylesheet's type rhythm, re-stated explicitly: theme.json /
   core block styles otherwise zero the paragraph margin and override the
   heading line-heights (h2 125%, h3 normal, h4 60px — see front.css). */
main .wp-block-post-content p {
  margin-bottom: 25px;
}

main .wp-block-post-content li {
  margin: 2px auto;
}

main h2.wp-block-heading {
  line-height: 125%;
}

main h3.wp-block-heading {
  line-height: normal;
}

main h4.wp-block-heading {
  line-height: 60px;
}

main a {
  color: #fdcb01;
}

main a:hover {
  color: #fff;
}

/* WP's skip link must not disturb the legacy layout. */
.skip-link.screen-reader-text {
  position: absolute;
}

/* Contact page — the live site's `.page-id-17` table rules, re-scoped to the
   ported two-column layout (the dev page has a different body class):
     table{width:100%} · td{vertical-align:top;width:400px}
     td:last-child{width:calc(100% - 400px);position:relative;vertical-align:bottom;text-align:right}
     td:last-child img{padding-left:20px;height:40px;width:40px}
     iframe{width:100%;height:calc(100% - 85px);position:absolute;top:0;right:0;max-width:750px;filter:grayscale(100%)} */
.rlt-contact.wp-block-columns {
  width: 100%;
  gap: 0;
  align-items: stretch;
  margin-bottom: 0;
}

.rlt-contact .wp-block-column:first-child {
  width: 400px;
  flex-basis: 400px;
}

.rlt-contact .wp-block-column:last-child {
  position: relative;
  width: calc(100% - 400px);
  flex-basis: calc(100% - 400px);
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.rlt-contact .wp-block-column:last-child figure.wp-block-image {
  margin: 0;
}

.rlt-contact .wp-block-column:last-child img {
  padding-left: 20px;
  height: 40px;
  width: 40px;
}

.rlt-contact .rlt-contact-map {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: calc(100% - 85px);
  max-width: 750px;
  filter: grayscale(100%);
}

@media all and (max-width: 1050px) {
  .home .header-wrapper {
    min-height: 480px;
  }
}

@media all and (max-width: 800px) {
  .rlt-contact .wp-block-column:first-child,
  .rlt-contact .wp-block-column:last-child {
    width: 100%;
    flex-basis: 100%;
  }

  .rlt-contact .wp-block-column:last-child {
    text-align: left;
  }

  .rlt-contact .wp-block-column:last-child img {
    padding: 0 20px 0 0;
  }

  .rlt-contact .rlt-contact-map {
    position: static;
    width: 100%;
    height: 150px;
    padding-top: 10px;
  }
}

@media all and (max-width: 850px) {
  .page-title-inner .wp-block-post-title {
    font-size: 54px;
  }
}

/* ---------------------------------------------------------------------------
 * The home hero's details panel, for copy of ANY length.
 *
 * The ported rule is a one-line teaser: `width:190px` on desktop, and a hard
 * `height:140px` with `overflow:visible` on a phone. The office now writes the whole
 * current-production blurb in there — nine paragraphs and a key-art image, 822
 * characters — which that box cannot hold. Measured BEFORE this fix:
 *
 *   desktop 1440x900  panel 190x1213 at `bottom:70px` with no cap, so it grew UPWARD
 *                     to top:-383px — the copy ran off the top of the screen;
 *   phone   390x844   a 140px box holding 663px of content, 523px of it spilling out
 *                     over the heading and the scroll cue.
 *
 * Both are one defect: a fixed-size box holding unbounded content. So the panel gets a
 * readable measure and a height it cannot exceed, scrolling inside. That holds for any
 * amount of copy — the real invariant, since the admin lets an author type what they
 * like — and the SHORT shipped default still renders in its designed band.
 */
:root {
  /* How tall the panel may get on a phone, and therefore what the heading has to
     reserve for it. One variable, so the two can never drift apart. */
  --hero-details-max: min(34vh, 260px);
}

/* The panel holds arbitrary author content, so nothing inside may outgrow it. */
.show-details img {
  max-width: 100%;
  height: auto;
}

.show-details {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* Desktop and tablet: a 190px column cannot set real copy — that is roughly eleven
   characters to the line. Widen it to a readable measure and cap it to the hero, so it
   can never reach the top of the screen. */
@media all and (min-width: 851px) {
  .show-details {
    width: min(460px, 42vw);
    max-height: calc(100% - 90px);
  }
}

/* Phone: grow to a bounded height rather than spilling out of a fixed 140px box.
   `min-height` keeps the designed band for the short default, and the heading reserves
   the same maximum, so however long the copy runs the two can never collide. */
@media all and (max-width: 850px) {
  .show-details {
    height: auto;
    min-height: 140px;
    max-height: var(--hero-details-max);
    -webkit-overflow-scrolling: touch;
  }

  .show-title {
    padding-bottom: calc(var(--hero-details-max) + 100px);
  }
}