/* TRIBAL — What's On (/events).
   Built on the tokens in style.css, which is loaded first: palm-forest ground,
   cream text, gold accents, Cormorant for headings. Only what the homepage
   does not already provide lives here. */

/* A sent request hides the form fields and the submit button with
   `el.hidden = true` (js/events.js) and shows the confirmation instead. Every
   one of those elements is given a `display` below — `.btn` inline-flex,
   `.ev-field-row` grid, labels block — and an author rule outranks the
   browser's own `[hidden] { display: none }` whatever its specificity, since
   that one lives in the user-agent origin. Without this line the button stayed
   on screen reading "Sending…" on a request that had already been stored, so a
   success was indistinguishable from a hang. css/takeaway.css carries the same
   guard for the same reason. */
[hidden] { display: none !important; }

/* The homepage header sits over a full-bleed hero and starts transparent.
   This page has its own hero, so the bar needs its own ground. */
.site-header.is-solid {
  background: rgba(11, 18, 14, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.primary-nav a[aria-current="page"] { color: var(--gold); }

/* ---------- Hero ---------- */
.ev-hero {
  position: relative;
  min-height: 72vh;
  display: flex;
  align-items: center;      /* centred, so the text is not pinned to the fold */
  padding: 10rem 0 6rem;    /* clears the fixed header and breathes underneath */
  overflow: hidden;
}
@media (max-width: 760px) {
  .ev-hero { min-height: 62vh; padding: 8rem 0 4rem; }
}
.ev-hero-media { position: absolute; inset: 0; z-index: 0; }
.ev-hero-img { width: 100%; height: 100%; object-fit: cover; }
.ev-hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--bg) 4%, rgba(11,18,14,.55) 55%, rgba(11,18,14,.7) 100%);
}
.ev-hero-content { position: relative; z-index: 1; padding-block: 1rem; }
.ev-hero-content .eyebrow { letter-spacing: .22em; }
.ev-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 1.14;        /* the two lines were almost touching */
  margin: 1.1rem 0 1.6rem;
  max-width: 18ch;          /* keeps the break where it is meant to be */
}
.ev-hero-title em { color: var(--gold); font-style: italic; }
.ev-hero-sub {
  color: var(--fg-muted);
  max-width: 58ch;          /* was wrapping into three short lines */
  font-size: 1.08rem;
  line-height: 1.75;
}

/* ---------- Cards ----------
   One card under another, each full width. Above 860px a card is laid out
   side-on (image left, everything else right) — see the block after the body
   rules below. The previous two-across grid left a single event stranded in
   half a row, which is most of the time. */
.ev-grid { display: grid; gap: 2.5rem; }

.ev-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* The date chip lives inside the media box and is rendered for every event,
   with or without a photograph, so the box needs a ground of its own. Without
   one, an imageless evening collapsed to zero height and `overflow:hidden`
   clipped the date away entirely. */
.ev-card-media {
  position: relative;
  min-height: 140px;
  background: linear-gradient(160deg, var(--bg-2), var(--surface));
}
.ev-card-media img { width: 100%; height: 260px; object-fit: cover; display: block; }

/* Date tab, so the night it runs reads before anything else. */
.ev-date-chip {
  position: absolute; top: clamp(.55rem, 2vw, 1rem); left: clamp(.55rem, 2vw, 1rem);
  display: grid; place-items: center;
  width: clamp(46px, 12vw, 62px); padding: .45rem 0;
  background: rgba(11, 18, 14, .88);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}
.ev-date-day { font-family: var(--font-serif); font-size: clamp(1.1rem, 3.6vw, 1.6rem); line-height: 1; color: var(--gold); }
.ev-date-mon { font-family: var(--font-sans); font-size: clamp(.55rem, 1.7vw, .68rem); letter-spacing: .12em; color: var(--fg-dim); margin-top: .2rem; }

.ev-card-body { padding: 1.75rem; }
.ev-when { font-size: .8rem; letter-spacing: .08em; color: var(--fg-dim); text-transform: uppercase; }
.ev-title { font-family: var(--font-serif); font-size: 1.9rem; margin: .35rem 0 0; }
.ev-sub { color: var(--fg-muted); margin-top: .35rem; }
.ev-price { margin-top: 1rem; }
.ev-price strong { font-family: var(--font-serif); font-size: 1.5rem; color: var(--gold); }
.ev-price span { color: var(--fg-dim); font-size: .85rem; margin-left: .4rem; }
.ev-desc { color: var(--fg-muted); margin-top: 1rem; line-height: 1.7; }

/* Side-on card, at every width — image left, everything else right.
   These rules sit after the body rules deliberately: a media query adds no
   specificity, so an earlier `.ev-card-body { padding }` would win on source
   order and the phone padding would never apply. */
.ev-card { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); }
.ev-card-media { min-height: 100%; }
.ev-card-media img { height: 100%; min-height: 190px; }
/* Centred, so a short evening does not sit pinned to the top of a card the
   photograph made tall. */
.ev-card-body { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; justify-content: center; }

/* The text column is narrow on a phone, so the headings come down with it. */
.ev-title { font-size: clamp(1.2rem, 5vw, 1.9rem); }
.ev-when { font-size: .68rem; letter-spacing: .06em; }
.ev-sub { font-size: .9rem; }
.ev-price { margin-top: .7rem; }
.ev-price strong { font-size: 1.2rem; }
.ev-desc { margin-top: .7rem; font-size: .9rem; line-height: 1.6; }
.ev-included li { padding: .32rem 0 .32rem 1.3rem; font-size: .88rem; }
.ev-included li::before { top: .8rem; width: 6px; height: 6px; }
.ev-actions { margin-top: 1.1rem; }

@media (min-width: 860px) {
  .ev-card { grid-template-columns: minmax(0, 42%) minmax(0, 1fr); }

  /* The photo gets a shape of its own rather than lending the card its
     own. A tall upload used to make a 650px card with 280px of nothing
     under the buttons, and the next event's landscape photo made a short
     one — the row height was whatever had last been uploaded.

     The image is taken out of flow so this box can still stretch when the
     text column is the taller of the two; cover then fills whatever height
     it ends up with, and nothing is cropped to a fixed frame. */
     Deliberately a padding-ratio spacer rather than `aspect-ratio`. This is a
     stretched grid item, so its height is already definite; aspect-ratio would
     then work backwards and compute the WIDTH from it — a 693px row made a
     924px-wide photograph that ran straight over the text column. Padding
     percentages always resolve against the width, so this can only ever add
     height. */
  .ev-card-media::before { content: ""; display: block; padding-top: 75%; }
  .ev-card-media img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; min-height: 0;
  }

  .ev-card-body { padding: 2.25rem 2.5rem; }
  .ev-when { font-size: .8rem; letter-spacing: .08em; }
  .ev-sub { font-size: 1rem; }
  .ev-price { margin-top: 1rem; }
  .ev-price strong { font-size: 1.5rem; }
  .ev-desc { margin-top: 1rem; font-size: 1rem; line-height: 1.7; }
  .ev-included li { padding: .4rem 0 .4rem 1.6rem; font-size: 1rem; }
  .ev-included li::before { top: .95rem; width: 7px; height: 7px; }
  .ev-actions { margin-top: 1.75rem; }
}

.ev-included { list-style: none; margin: .6rem 0 0; padding: 0; }
.ev-included li {
  position: relative; padding: .4rem 0 .4rem 1.6rem;
  color: var(--fg-muted); border-bottom: 1px solid var(--line);
}
.ev-included li:last-child { border-bottom: 0; }
.ev-included li::before {
  content: ""; position: absolute; left: .1rem; top: .95rem;
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
}

/* ---------- The two facts, side by side ----------
   When it starts and what it costs are what a guest decides on, so they sit
   together in one row instead of stacked among the prose. */
.ev-key {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .6rem 1.1rem;
  margin-top: .9rem;
}
.ev-key .ev-price { margin: 0; }   /* the row owns the spacing now */

.ev-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .7rem;
  font-family: var(--font-sans);
  font-size: .82rem; letter-spacing: .04em;
  color: var(--fg-muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.ev-chip svg { color: var(--gold); flex: none; }

/* ---------- What's included & more ----------
   One native disclosure, closed by default: every card then sits at the same
   height whatever the evening involves, and the whole reading is still one
   click away rather than on another page. */
.ev-more {
  margin-top: 1.1rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ev-more-sum {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 0;
  font-family: var(--font-sans);
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold);
  -webkit-user-select: none; user-select: none;
}
.ev-more-sum::-webkit-details-marker { display: none; }  /* Safari's own arrow */
.ev-more-sum:hover { color: var(--gold-2); }
.ev-more-sum:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.ev-more-chev { flex: none; transition: transform .2s ease; }
.ev-more[open] .ev-more-chev { transform: rotate(180deg); }
.ev-more-body { padding-bottom: 1.1rem; }
.ev-more-body .ev-desc { margin-top: 0; }
.ev-more-body .ev-desc + .ev-included { margin-top: 1rem; }

/* ---------- Actions ----------
   Tickets lead; asking us sits beside it, quieter. They wrap rather than
   shrink, so neither label is cut in half in a narrow text column. */
.ev-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.ev-actions .btn { flex: 0 1 auto; }

/* Below the side-on breakpoint the text column is around 220px and these
   labels do not wrap, so side by side they ran straight out of the card.
   Stacked and full width they also give a bigger thing to tap. */
@media (max-width: 859px) {
  .ev-actions { flex-direction: column; align-items: stretch; }
  .ev-actions .ev-ask { display: block; }
  /* 100% is not enough on its own: the label plus the button's own padding
     has a min-content width wider than the column, and it overflowed by a
     few pixels. Narrower padding buys the room; wrapping is the backstop
     for a longer word in another language. */
  .ev-actions .btn {
    width: 100%;
    padding-left: .9rem; padding-right: .9rem;
    white-space: normal;
  }
}

/* ---------- Request popup ----------
   The form used to expand inline inside the card, which on a side-on card
   squeezes it into the narrow text column. It now opens in a dialog.
   Without JavaScript the dialog is shown inline instead — see the <noscript>
   block in events.php — so the form is never unreachable. */
.ev-ask-btn { cursor: pointer; }

.ev-dialog {
  width: min(560px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.ev-dialog::backdrop { background: rgba(11, 18, 14, .74); }

/* Browsers with JS but no <dialog> support: positioned by hand, with a scrim
   element the script inserts. */
.ev-dialog.is-fallback[open] {
  display: block; position: fixed; z-index: 90;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.ev-dialog-scrim { position: fixed; inset: 0; z-index: 89; background: rgba(11, 18, 14, .74); }

.ev-dialog-inner { position: relative; padding: 1.6rem 1.4rem 1.8rem; }
@media (min-width: 560px) { .ev-dialog-inner { padding: 2rem 2.1rem 2.2rem; } }

.ev-dialog-close {
  position: absolute; top: .6rem; right: .6rem;
  width: 2.2rem; height: 2.2rem; line-height: 1;
  display: grid; place-items: center;
  font-size: 1.5rem; cursor: pointer;
  color: var(--fg-dim); background: transparent;
  border: 1px solid var(--line); border-radius: 50%;
}
.ev-dialog-close:hover { color: var(--gold); border-color: var(--gold); }
.ev-dialog-title { font-family: var(--font-serif); font-size: 1.6rem; margin: .3rem 2rem .2rem 0; }
.ev-dialog-when { color: var(--fg-dim); font-size: .85rem; }

.ev-form { margin-top: 1rem; }
.ev-field-row { display: grid; gap: 1rem; }
@media (min-width: 540px) { .ev-field-row { grid-template-columns: 1fr 1fr; } }

.ev-form label {
  display: block; margin-top: 1rem;
  font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-dim);
}
.ev-form label span { text-transform: none; letter-spacing: 0; }
.ev-form input, .ev-form textarea {
  width: 100%; margin-top: .4rem; padding: .85rem 1rem;
  font: inherit; color: var(--fg);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.ev-form input:focus, .ev-form textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,169,97,.18);
}
.ev-form .btn { margin-top: 1.4rem; width: 100%; }
.ev-note { color: var(--fg-dim); font-size: .85rem; margin-top: 1.2rem; }
.ev-err { color: var(--danger); font-size: .88rem; margin-top: .8rem; }
.ev-hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

.ev-done { text-align: center; padding-top: .5rem; }
.ev-code {
  font-family: var(--font-display); font-size: 2rem; letter-spacing: .18em;
  color: var(--gold); margin: .3rem 0 1rem;
}

/* ---------- Empty state ---------- */
.ev-none { text-align: center; max-width: 42ch; margin: 2rem auto 4rem; }
.ev-none h2 { font-family: var(--font-serif); font-size: 2rem; margin: .4rem 0 .8rem; }
.ev-none p { color: var(--fg-muted); }
.ev-none a { color: var(--gold); }

/* ---------- Footer ---------- */
.ev-footer { text-align: center; padding: 2.5rem 0; }
.ev-footer p { color: var(--fg-muted); }
.ev-footer p + p { margin-top: .6rem; }
.ev-footer a { color: var(--fg-muted); }
.ev-footer a:hover { color: var(--gold); }
