/* ============ Fonts ============ */

@font-face {
  font-family: 'MeathFLF';
  src: url('/fonts/MeathFLF.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Neue Haas Display';
  src: url('/fonts/NeueHaasDisplayRoman.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Neue Haas Display';
  src: url('/fonts/NeueHaasDisplayBold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Neue Haas Display';
  src: url('/fonts/NeueHaasDisplayRomanItalic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ============ Base ============ */

:root {
  --node-bg: #f4f4f4;
  --line: 1px solid #000;
  --stack-offset: 0.45rem;
  --tab-h: 4.5rem;
  --radius-card: 0.6rem;
  --radius-node: 0.75rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: #000;
  font-family: 'Neue Haas Display', Helvetica, Arial, sans-serif;
}

body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }

a { color: #000; }

/* ============ Type styles ============ */

.style-H {
  font-family: 'MeathFLF', serif;
  font-weight: normal;
  font-size: 2.5rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 1rem 0;
}

.style-p, p {
  font-family: 'Neue Haas Display', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.45;
}

.style-N {
  font-family: 'Neue Haas Display', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  margin: 0;
}

.style-S {
  font-family: 'Neue Haas Display', sans-serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.3;
  margin: 0;
}

.style-W {
  font-family: 'MeathFLF', serif;
  font-weight: normal;
  font-size: clamp(5rem, 13.5vw, 16rem);
  line-height: 0.85;
  letter-spacing: 0.02em;
}

/* ============ Header ============ */

.logo {
  position: fixed;
  top: 1.2rem;
  left: 1.8rem;
  z-index: 40;
  display: block;
  line-height: 0;
  text-decoration: none;
}

.logo img {
  display: block;
  height: 4rem;
  width: auto;
}

.bg-title {
  position: fixed;
  top: 1.2rem;
  right: 0.5rem;
  z-index: 0;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  /* MeathFLF leaves ~0.046em of space above the capitals; pull it up so the
     visible letters align flush with the top of the logo at every size */
  transform: translateY(-0.046em);
}

/* ============ Tab container stack (desktop) ============ */

.stack {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  margin: 7.5rem 2.5rem 2rem 2.8rem; /* top right bottom left — bottom keeps the cards off the body edge */
}

.card {
  position: absolute;
  inset: 0;
  background: #fff;
  border: var(--line);
  border-radius: var(--radius-card);
}

/* cascading offsets: front card (home) anchored at the bottom-right, cards
   behind it fan out up and to the left. Positions never change, only z-index. */
.card-projects   { transform: translate(calc(var(--stack-offset) * -3), calc(var(--stack-offset) * -3)); z-index: 1; }
.card-guidelines { transform: translate(calc(var(--stack-offset) * -2), calc(var(--stack-offset) * -2)); z-index: 2; }
.card-equipment  { transform: translate(calc(var(--stack-offset) * -1), calc(var(--stack-offset) * -1)); z-index: 3; }
.card-home       { transform: translate(0, 0); z-index: 4; }

body.page-projects   .card-projects,
body.page-guidelines .card-guidelines,
body.page-equipment  .card-equipment,
body.page-home       .card-home { z-index: 10; }

/* tab element welded on top of the card */
.tab {
  position: absolute;
  top: calc(var(--tab-h) * -1 + 1px);
  height: var(--tab-h);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0 2.6rem;
  background: #fff;
  border: var(--line);
  border-bottom: none;
  border-radius: 1.6rem 1.6rem 0 0;
  z-index: 2;
}

.card-home       .tab { left: 11%; }
.card-equipment  .tab { left: 30%; }
.card-guidelines .tab { left: 49%; }
.card-projects   .tab { left: 68%; }

.tab-link {
  font-family: 'MeathFLF', serif;
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: #000;
  white-space: nowrap;
}

.burger {
  display: none;
  background: none;
  border: none;
  padding: 0.2rem;
  cursor: pointer;
}
.burger span {
  display: block;
  width: 1.6rem;
  height: 0.2rem;
  background: #000;
  margin: 0.3rem 0;
  border-radius: 0.1rem;
}

.card-content {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 3.25rem 3.25rem 2.5rem;
  border-radius: var(--radius-card);
  /* soft fade at the top and bottom so scrolling content doesn't hit the border */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2.75rem, #000 calc(100% - 2rem), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 2.75rem, #000 calc(100% - 2rem), transparent 100%);
}

/* mobile dropdown menu */
.mobile-menu {
  display: none;
  position: absolute;
  top: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  min-width: 60%;
  background: #fff;
  border: var(--line);
  border-radius: var(--radius-node);
  padding: 0.8rem 1.6rem;
  z-index: 100;
}
.mobile-menu a {
  display: block;
  padding: 0.55rem 0;
  text-decoration: none;
}

/* ============ Node component ============ */

.node {
  background: var(--node-bg);
  border: var(--line);
  border-radius: var(--radius-node);
  padding: 1.4rem 1.6rem;
}

.node .node-title { margin-bottom: 0.1rem; }
.node .node-subtitle { margin-bottom: 0.9rem; }

.node-body { display: flex; gap: 1.2rem; align-items: flex-start; }
.node-text { flex: 1 1 55%; }
.node-text p:first-child { margin-top: 0; }
.node-img { flex: 0 1 45%; align-self: stretch; }
.node-img img { width: 100%; height: 100%; max-height: 18rem; object-fit: cover; }

.node-more { margin-top: 1rem; }
.node-more summary {
  cursor: pointer;
  list-style: none;
  text-align: center;
  padding: 0.4rem 0;
}
.node-more summary::-webkit-details-marker { display: none; }
.node-more summary::before { content: '> '; }
.node-more[open] summary::before { content: 'v '; }
.node-more .node-more-content { text-align: left; padding-top: 0.5rem; }

/* grid of nodes: 3 per row on desktop */
.node-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
  align-items: start;
  margin: 1.5rem 0 3rem;
}

/* ============ Home page ============ */

.home-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.6rem;
  align-items: start;
}

.home-left { display: grid; gap: 1.6rem; align-content: start; }

.home-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
  align-items: start;
}

/* photo carousel */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-node);
  aspect-ratio: 3 / 4;
  width: 31.5rem;
  max-width: 100%;
  justify-self: center;
  background: var(--node-bg);
}
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.6s ease;
}
.carousel-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill the 4:3 frame */
  display: block;
}
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Neue Haas Display', sans-serif;
  font-size: 3.5rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.carousel-arrow:hover { color: rgba(255, 255, 255, 0.95); }
.carousel-prev { left: 0.3rem; }
.carousel-next { right: 0.3rem; }

.card-credit { margin-top: 2.5rem; }
.card-credit a { display: inline-block; line-height: 0; }
.card-credit img { height: 2.5rem; width: auto; }

/* home: Contact node + academy logo stacked in one column, logo right under Contact */
.home-contact { display: grid; gap: 1.6rem; align-content: start; }
.home-contact .card-credit { margin-top: 0; }

/* Left-aligned heart bullets for all home boxes */
.home-grid .node ul {
  list-style: none;
  margin: 0.6rem 0;
  padding-left: 0;
}
.home-grid .node li {
  position: relative;
  padding-left: 1.5rem;
}
.home-grid .node li::before {
  content: '\2665\FE0E';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72em;
  line-height: 1;
}
.home-opening-hours .node-text {
  container-type: inline-size;
}
.home-opening-hours em {
  /* scale the note to fill the column width, capped, always one line */
  font-size: clamp(0.58rem, 6.2cqw, 0.95rem);
  white-space: nowrap;
}

.booking-button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 2.4rem 1rem;
  text-align: center;
}

/* ============ Sections (equipment / projects) ============ */

.page-section { margin-bottom: 3.5rem; }
.section-intro { max-width: 60rem; }
.section-meta { margin: 0 0 1rem; }

.project-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-top: 1.5rem;
}
.project-gallery img { width: 100%; height: 16rem; object-fit: cover; border-radius: var(--radius-node); }

/* markdown content (guidelines) */
.md-content { max-width: 60rem; }
.md-content h1, .md-content h2 {
  font-family: 'MeathFLF', serif;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.md-content h1 { font-size: 2.5rem; }
.md-content h2 { font-size: 1.9rem; margin-top: 2.5rem; }
.md-content h3 { font-size: 1.25rem; margin-top: 1.8rem; }
.md-content li { line-height: 1.45; margin-bottom: 0.3rem; }

/* ============ Guidelines page ============ */

.guidelines-intro { margin-bottom: 2.5rem; }
.guidelines-intro h2:first-child { margin-top: 0; }
.guidelines-intro strong { font-size: 0.9rem; }

.guidelines-search { position: relative; max-width: 32rem; margin: 0 0 1.6rem; }
.guidelines-search-input {
  width: 100%;
  padding: 0.7rem 2.6rem 0.7rem 1rem;
  border: var(--line);
  border-radius: var(--radius-node);
  background: #fff;
  color: #000;
  font-family: inherit;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}
/* keep the border black; just make it bolder when focused (no coloured ring) */
.guidelines-search-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px #000;
}
/* hide the browser's native (blue) clear button — we use our own */
.guidelines-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.guidelines-search-input::-ms-clear { display: none; }

/* custom clear button using the MeathFLF display "X" */
.guidelines-search-clear {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  padding: 0 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #000;
  font-family: 'MeathFLF', serif;
  font-size: 1.5rem;
  line-height: 1;
}

.guidelines-list { display: flex; flex-direction: column; gap: 1.6rem; }

/* guideline blocks span the full page width */
.guideline-links {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.guideline-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: var(--line);
  border-radius: var(--radius-node);
  background: #fff;
  text-decoration: none;
}
.guideline-link:hover { background: var(--node-bg); }

.guidelines-no-results { color: #666; }

/* guideline block body: text left, photo carousel right (wider text than equipment) */
.guideline-body { align-items: flex-start; }
.guideline-body .node-text { flex: 1 1 74%; }
.guideline-media { flex: 0 0 22%; }
.guideline-media .carousel {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 0;
}
/* arrows + a thin black frame appear only on hover */
.guideline-media .carousel .carousel-arrow {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.guideline-media .carousel:hover .carousel-arrow {
  opacity: 1;
}
.guideline-media .carousel:hover {
  box-shadow: inset 0 0 0 1px #000;
}
.carousel-zoom { cursor: zoom-in; }

/* guideline "More information" toggle: right-aligned, underlined, bold on hover */
.guideline .node-title {
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.guideline .node-more summary {
  text-align: center;
  text-decoration: none;
}
.guideline .node-more summary:hover {
  font-weight: 700;
}
/* CSS chevron pointing down — rotates up when expanded (signals a dropdown) */
.guideline .node-more summary::before {
  content: '';
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin: 0 0.55em 0.18em 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 0.2s ease;
  vertical-align: middle;
}
.guideline .node-more[open] summary::before {
  transform: rotate(-135deg);
}

/* ============ Lightbox overlay ============ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  /* keep the page visible behind, just blurred — not darkened */
  background: transparent;
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 92vw;
  max-height: 88vh;
}
.lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
}
.lightbox-arrow,
.lightbox-close {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  font-family: 'Neue Haas Display', sans-serif;
}
/* arrows hug the image edges (toward the middle), large, legible on any image */
.lightbox-arrow {
  top: 50%;
  transform: translateY(-50%);
  font-size: 6rem;
  padding: 0 0.6rem;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.lightbox-prev { left: 0.4rem; }
.lightbox-next { right: 0.4rem; }
.lightbox-close { top: 0.6rem; right: 1.2rem; font-size: 3rem; color: #000; }
body.lightbox-open { overflow: hidden; }

/* ============ Footer (sits below the card stack, outside the containers) ============ */

.site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2.5rem;
  /* left/right match the stack's side margins; top = gap from the stack */
  margin: 2rem 2.5rem 1.25rem 2.8rem;
}
.site-footer a { display: block; line-height: 0; }
.site-footer img { height: 2.5rem; width: auto; }

/* ============ Mobile ============ */

@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) {
  body {
    height: auto;
    overflow: auto;
  }

  .logo { top: 0.9rem; left: 1rem; }
  .logo img { height: 2.4rem; }
  .bg-title { position: absolute; top: 0.9rem; right: 0.3rem; }

  .stack {
    margin: 4.5rem 0.8rem 1.5rem;
    height: auto;
  }

  /* single container: only the active card exists visually */
  .card {
    display: none;
    position: relative;
    inset: auto;
    transform: none !important;
    margin-top: var(--tab-h);
  }
  body.page-projects   .card-projects,
  body.page-guidelines .card-guidelines,
  body.page-equipment  .card-equipment,
  body.page-home       .card-home { display: block; }

  .card .tab {
    left: 50% !important;
    transform: translateX(-50%);
    justify-content: center;
    min-width: 60%;
    padding: 0 1.6rem;
  }

  .burger { display: block; }

  .card-content {
    position: static;
    overflow: visible;
    padding: 1.8rem 1.2rem 2rem;
  }

  .node-grid,
  .home-grid,
  .home-row,
  .project-gallery { grid-template-columns: 1fr; }

  /* stack each node: image on top (full width), text below */
  .node-body { flex-direction: column; align-items: stretch; }
  .node-img { order: -1; flex: none; width: 100%; }
  .node-text { flex: none; width: 100%; }

  .carousel { order: -1; width: auto; justify-self: stretch; }

  /* guidelines: stack the photo underneath the text on mobile */
  .guideline-body { flex-direction: column; align-items: stretch; }
  .guideline-media { width: 100%; max-width: 18rem; margin-top: 0.4rem; }
  .guideline-media .carousel { width: 100%; }

  /* booking comes right after the main text and looks like a solid button */
  .home-row .booking-button { order: -1; }
  .booking-button {
    background: #000;
    color: #fff;
    border-color: #000;
    padding: 1rem 1.5rem;
    border-radius: 0.6rem;
  }

  .style-H { font-size: 1.9rem; }
  .style-W { font-size: clamp(2.5rem, 11vw, 4rem); }


  /* no internal scroll on mobile, so drop the fade */
  .card-content { -webkit-mask-image: none; mask-image: none; }
}

/* ============ Tablet / landscape phone: desktop layout, scaled down ============ */

@media (min-width: 769px) and (max-width: 1024px) and (min-height: 501px) {
  /* Shrinking the root font scales the whole rem-based desktop layout down
     to fit smaller / landscape screens without switching to mobile. */
  html { font-size: 12px; }
  .bg-title.style-W { font-size: clamp(3rem, 11vw, 7rem); }
  .stack { margin: 5.5rem 1.5rem 0; }
}
