/* ============================================================
   OVERLAYS — everything drawn on top of the room: the shared button,
   the overlay panel (case studies / profile / contact), and the
   entry plaque. Behavior is in overlays.js.
   ============================================================ */

/* ============================================================
   BUTTON — the ONE button style, used everywhere a button or link-
   as-button appears (entry plaque, case-study CTAs, contact form).
   No variants, no size overrides. Sage gray-green, not blue.
   ============================================================ */
.btn {
  display: inline-block;
  padding: 8px 30px;
  background: rgba(159, 170, 160, 1);
  border: 2px solid rgba(110, 120, 112, 1);
  color: #1a1510;
  font-family: 'Jost', sans-serif;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.25s ease;
  touch-action: manipulation;   /* a double-tap on ENTER must not zoom the page */
}
.btn:hover {
  background: rgba(140, 150, 142, 1);
  border-color: rgba(90, 100, 92, 1);
}
/* On the plaque the button sits on bronze, where the sage ring from
   room.css's global rule would vanish — dark ring here instead. */
.btn:focus-visible { outline-color: #1a1510; }

/* ============================================================
   OVERLAY CARD — one shared white card for case studies (scrolls),
   the profile (portrait), and the contact form (hand). Translucent
   backdrop so the room stays visible behind it. Opened from
   overlays.js.
   ============================================================ */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  /* Height from the REAL visible viewport, not `vh`. On iOS, vh is the
     tall viewport with the browser toolbars hidden, so a 92vh card ran
     off the top and bottom whenever the toolbars were showing. The live
     site sizes its modals from --viewport-height for the same reason.
     On desktop the two are identical. */
  bottom: auto;
  height: var(--viewport-height, 100vh);
  background: rgba(0, 0, 0, 0.6);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.overlay-backdrop.is-open { opacity: 1; visibility: visible; }

/* OVERLAY CARD — the white box itself. Sized directly (no wrapper, no
   background art); the 6% inset the old wrap gave it is now baked into
   the backdrop's padding. */
.overlay-card {
  position: relative;
  width: min(1050px, 92vw);
  height: min(calc(var(--viewport-height, 100vh) * 0.92), 950px);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #1f3d3a;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  font-family: 'Source Serif 4', Georgia, serif;
}

.overlay-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid #e3dfd4;
}
/* An invisible ::before extends the ×'s HIT AREA past the glyph
   without reflowing the header — see the inset below. */
.overlay-close::before {
  content: '';
  position: absolute;
  inset: -5px;
}

/* The header's small Jost label style for the back link. #4d6b45 (the
   nav green) on white is ~6.3:1. The header holds only controls — no
   titles or labels, since everything up there reads as clickable. */
.overlay-back {
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #4d6b45;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
/* "← All case studies" — the only way through the set (Nov 4, 2026: no
   prev/next; the grid is how you choose). The spacer pushes the × alone
   to the right edge, where a modal's close normally lives. */
.overlay-spacer { flex: 1; }
.overlay-back {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
  touch-action: manipulation;
}
.overlay-back::before { content: ''; position: absolute; inset: -6px -4px; }   /* 44px tap height */
.overlay-back:hover { color: #1f3d3a; }
.overlay-close {
  position: relative;            /* for the ::before hit extender above */
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #1f3d3a;
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.2s ease;
}
/* The × glyph box is ~26x30 with its padding; -8px on each side takes
   the tappable area to ~44x46. */
.overlay-close::before { inset: -8px; }
.overlay-close:hover { color: #4d6b45; }


/* The content region takes focus when the card opens (overlays.js) so
   keys scroll it. It's a reading surface, not a control, so no ring:
   the card appearing IS the focus indication. Controls inside it keep
   theirs via the global rule. */
.overlay-content:focus { outline: none; }
.overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 44px 40px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transition: opacity 0.2s ease;
}
.overlay-content h1 { margin: 0 0 6px; font-family: 'Jost', sans-serif; font-weight: 700; font-size: 38px; line-height: 1.15; color: #1f3d3a; }
.overlay-content h2 { margin: 0 0 28px; font-family: 'Jost', sans-serif; font-weight: 400; font-size: 21px; color: #4d6b45; }
.overlay-content h3 { margin: 30px 0 10px; font-family: 'Jost', sans-serif; font-weight: 700; font-size: 23px; color: #1f3d3a; }
.overlay-content p, .overlay-content li { font-size: 17px; line-height: 1.65; color: #2c2b26; }
.overlay-content p { margin: 0 0 15px; }
.overlay-content ul { margin: 15px 0; padding-left: 32px; }
.overlay-content li { margin-bottom: 12px; }
.overlay-content li strong { color: #1f3d3a; font-weight: 600; }
.overlay-quote { font-style: italic; color: #4a4a45; margin: 0 0 18px; }
.overlay-quote-source { font-style: normal; font-family: 'Jost', sans-serif; font-size: 13px; color: #6b7366; letter-spacing: 0.5px; }

/* ============================================================
   LINKS — the one text-link style for everything in the card (case
   studies, profile, contact). Nav green (#4d6b45, ~6.3:1 on white)
   with a soft underline that firms up on hover. The underline stays
   on at rest on purpose: green body copy is close enough to green
   links that color alone wouldn't mark them (WCAG 1.4.1). Visited
   links stay green — no browser purple. Buttons (.btn) are excluded,
   or this would repaint and underline them.
   ============================================================ */
.overlay-content a:not(.btn) {
  color: #4d6b45;
  text-decoration: underline;
  text-decoration-color: rgba(77, 107, 69, 0.4);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.overlay-content a:not(.btn):hover {
  color: #1f3d3a;
  text-decoration-color: currentColor;
}

/* ============================================================
   CASE-STUDY INDEX — an h1 and h2 (styled like every page's title and
   subhead; copy lives in overlays.js) and then the grid the scrolls open on (overlays.js builds
   it from each page's <h1>/<h2>). Two columns of tiles on desktop, one
   on phones. Each tile is a real <button>: Tab reaches it, Enter opens
   it, and the card's focus trap already includes it. No numbers: the
   order shows on its own.
   ============================================================ */
/* Scoped under .overlay-content so it outranks the page's own list
   rules (.overlay-content ul / li add a 32px indent and 12px gaps),
   which were shifting the whole grid right. */
.overlay-content .cs-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.overlay-content .cs-index li { margin: 0; }
.cs-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 150px;
  padding: 22px 24px 24px;
  background: #fbfaf7;
  border: 1.5px solid #e3dfd4;
  border-radius: 4px;
  text-align: left;
  color: #1f3d3a;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  touch-action: manipulation;
}
.cs-tile:hover {
  border-color: #4d6b45;
  background: #fff;
}
@media (hover: hover) and (pointer: fine) {
  .cs-tile:hover { transform: translateY(-2px); }
}
.cs-tile-title {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  color: #1f3d3a;
}
.cs-tile-sub {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  line-height: 1.5;
  color: #2c2b26;
}

.overlay-field { display: block; margin-bottom: 18px; font-family: 'Jost', sans-serif; }
.overlay-field span { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; color: #4d6b45; margin-bottom: 6px; }
.overlay-field input, .overlay-field textarea {
  width: 100%;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  padding: 10px 12px;
  border: 1.5px solid #d6d0c2;
  border-radius: 4px;
  color: #1f3d3a;
  background: #fbfaf7;
}
/* Border darkens on focus as before; the outline is no longer removed,
   so the global :focus-visible ring (room.css) shows for keyboard users.
   The border change alone was a 1.5px shift from beige to green — not
   enough to find your place in a form by eye. */
.overlay-field input:focus, .overlay-field textarea:focus {
  border-color: #4d6b45;
}
.overlay-field textarea { resize: vertical; }

/* ============================================================
   ENTRY PLAQUE — the greeting on the bot wall. Same translucent-
   backdrop pattern as .overlay-backdrop, but the copy sits directly
   on the plaque image rather than in a white card.
   ============================================================ */
.entry-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.entry-backdrop.is-open { opacity: 1; visibility: visible; }

.entry-plaque {
  position: relative;
  width: min(1100px, 92vw);
  /* The copy below is sized in cqw (1cqw = 1% of the plaque's width),
     so type, gaps and padding all scale WITH the plaque instead of with
     the viewport. The plaque's aspect ratio is fixed, so if the copy
     fits at one size it fits at every size — no tablet overflow. */
  container-type: inline-size;
}
.entry-plaque img {
  display: block;
  width: 100%;
  height: auto;
  /* Reserve the plaque's height before the file arrives, so the copy
     sits in its final place from first paint instead of collapsing onto
     a zero-height box and jumping when the image lands. Update if the
     plaque art's proportions change. */
  aspect-ratio: 5671 / 2779;
}
/* Fallback if plaque_entry.webp 404s — an explicit size instead of
   collapsing to zero. */
.entry-plaque.bg-failed {
  width: min(1100px, 92vw);
  height: min(500px, 60vh);
  background: #2a2a2a;
  border-radius: 8px;
}
.entry-plaque.bg-failed img { display: none; }

.entry-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5cqw 8cqw;
  color: #1a1510;
  font-family: 'Jost', sans-serif;
  /* ONE scale for the whole plaque. Everything scales with the plaque's
     width (cqw) but never below a readable floor, and the disclaimer is
     always a fixed fraction of the description — so the hierarchy
     h1 > description > disclaimer holds at every size. Tune here, not
     in the rules below. */
  --h1:     max(22px, 3.6cqw);
  --desc:   max(16px, 1.7cqw);
  --notice: calc(var(--desc) * 0.85);
}
.entry-copy h1 {
  margin: 0;
  font-family: 'Jost', sans-serif;
  font-weight: 600;
  font-size: var(--h1);
  line-height: 1.2;
}
.entry-copy p {
  margin: 1.4em 0 0;
  font-family: 'Jost', sans-serif;
  font-weight: 400;
  font-size: var(--desc);
  line-height: 1.5;
}
/* The description under the h1 — bold. The <br> in index.html is the
   only intended break; on narrow plaques it's dropped (see the phone
   block) rather than letting line one wrap. */
.entry-copy .entry-desc {
  margin-top: 2.4cqw;
  font-weight: 600;
  line-height: 1.6;
}
/* The logging notice under the button — 85% of the description, never
   bigger, never smaller than ~13.6px. */
.entry-copy .entry-notice {
  margin-top: 3cqw;
  font-size: var(--notice);
  font-weight: 500;
  letter-spacing: 0.02em;
}
/* Below ~900px of plaque the first sentence can't fit on one line at
   the 16px floor, so the forced break comes out and the two sentences
   flow as one paragraph. Phones get this too (their block below). */
@container (max-width: 900px) {
  .entry-copy .entry-desc br { display: none; }
}
/* spacing only — color/shape/etc. all come from .btn at the top of this file */
.entry-copy .btn {
  margin-top: 3cqw;
}

/* ---- Phones: the square plaque (plaque_entry_mobile.webp, via the
   <picture> in index.html) ------------------------------------------
   Ported from the live site's modals.css: a square placard, 75vw wide
   (95vw on phones under 400px), centred on the frame and dropped so the
   eyes show above it. The only change from the live site is HOW FAR it
   drops: not a viewport-% fudge but the frame's own geometry — the
   plaque's top edge lands exactly on the chat box's top edge (same
   variables chatbot.css positions the frame with), so eyes and frame-top
   are visible above it and the greeting text is covered, on every phone.
   The image sets its own height (`auto` ratio), never squashed. */
@media (max-width: 599px) {
  .entry-backdrop {
    display: block;
    padding: 0;
    --plaque-top: calc(
      var(--viewport-height, 100vh) / 2
      - var(--frame-vertical-offset)
      - var(--frame-size) / 2
      + var(--frame-size) * var(--chat-top-pct)
    );
  }
  .entry-plaque {
    position: absolute;
    left: 50%;
    top: var(--plaque-top);
    transform: translateX(-50%);
    /* PLAQUE SIZE ON PHONES — this one line. 100vw = edge to edge (the
       art's own bevel is the margin, as on the live site). Height follows
       the image; the top edge stays pinned to the chat box, so a bigger
       plaque grows downward. */
    width: 100vw;
    max-width: none;
    height: auto;
  }
  .entry-plaque img {
    width: 100%;
    height: auto;
    /* plaque_entry_mobile.webp's own proportions (1290x1446). Update if
       the art changes shape, or the copy will jump when the file lands. */
    aspect-ratio: auto 1290 / 1446;
  }
  .entry-plaque.bg-failed { width: 100vw; max-width: none; height: 112vw; }
  .entry-copy { padding: 9% 9%; }
  .entry-copy h1 { font-size: 19px; line-height: 1.25; }
  .entry-copy p  { font-size: 13px; line-height: 1.45; margin-top: 1em; max-width: none; }
  /* The desktop <br> after "emerging tech." is dropped here: at phone
     width the first sentence can't be one line at any readable size, so
     the copy flows as one paragraph and wraps where it wraps. */
  .entry-copy .entry-desc { font-size: 16px; line-height: 1.5; margin-top: 14px; }
  .entry-copy .entry-desc br { display: none; }
  /* 14px: the logging/IP disclosure. Don't go below 13 — pinch-zoom is
     blocked on phones, so nobody can enlarge it, and it's the one line
     on the plaque that has to stay readable. */
  .entry-copy .entry-notice { font-size: 14px; margin-top: 22px; }
  .entry-copy .btn { margin-top: 16px; padding: 7px 24px; font-size: 15px; letter-spacing: 2px; }
}
@media (max-width: 399px) {
  /* Smaller phones: same full width; only the type steps up a notch. */
  .entry-copy h1 { font-size: 20px; }
  .entry-copy p  { font-size: 14px; }
  .entry-copy .entry-desc { font-size: 16px; }
}

.case-study-video { position: relative; width: 100%; padding-bottom: 56.25%; height: 0; margin: 10px 0 26px; border-radius: 4px; overflow: hidden; background: #111; }
.case-study-video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

.overlay-footer { margin-top: 44px; padding-top: 30px; border-top: 1px solid #e3dfd4; text-align: center; }
.overlay-footer p { font-family: 'Jost', sans-serif; font-size: 19px; font-weight: 500; color: #1f3d3a; margin: 0 0 20px; }
/* A line AFTER the button (contact's "or email …") gets its gap above,
   not below — the rule above is built for a lead-in line before it. */
.overlay-footer .btn + p { margin: 20px 0 0; }

@media (max-width: 700px) {
  /* Phones: the card becomes a sheet — nearly the full visible height,
     a grab handle on top, and pulling its top strip (the back link/× bar)
     down closes it (pull-to-close.js). The card's height comes from stretching to the
     backdrop's content box, so the margins live in ONE place: the
     backdrop's padding. The bottom margin also clears the home indicator
     when the browser's toolbar is tucked away. */
  .overlay-backdrop {
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .overlay-card {
    width: 94vw;
    height: auto;
    align-self: stretch;
    will-change: transform;   /* it moves with the finger */
  }
  .overlay-card::before {
    content: '';
    position: absolute;
    top: 7px; left: 50%;
    width: 38px; height: 4px;
    border-radius: 2px;
    background: #d6d0c2;
    transform: translateX(-50%);
    pointer-events: none;
  }
  .overlay-header { padding: 20px 18px 12px; gap: 10px; }
  .overlay-content { padding: 22px 22px 34px; }
  .overlay-content h1 { font-size: 28px; }
  .overlay-content h2 { font-size: 17px; margin-bottom: 20px; }
  .overlay-content h3 { font-size: 19px; }
  .overlay-content p, .overlay-content li { font-size: 16px; }
  .overlay-content .cs-index { grid-template-columns: 1fr; gap: 12px; }
  .cs-tile { min-height: 0; padding: 18px 20px 20px; }
  .cs-tile-title { font-size: 20px; }
  .cs-tile-sub { font-size: 15px; }
}