/* Hallmark · macrostructure: Long Document · tone: editorial travel guide · anchor hue: Aegean blue
 * pre-emit critique: P5 H4 E4 S4 R5 V4  · component styles for audited (Basecoat+Tailwind) pages
 * roman display only · real content · tokens · mobile-safe 320/375/414/768 */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700&display=swap');

:root {
  --f2g-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f2g-sky: oklch(0.55 0.13 230);
  --f2g-ink: oklch(0.145 0 0);
  --f2g-line: oklch(0.922 0 0);
  --f2g-shadow: 0 10px 30px oklch(0.2 0.03 240 / 0.16);
  --f2g-mega-size: 0.9rem;       /* mega-menu link text size — adjust here */
  --f2g-mega-head-size: 0.85rem; /* mega-menu group header text size */
}

/* Roman editorial display for headings (no italic headers) */
.f2g-page h1, .f2g-page h2, .f2g-page h3 { font-family: var(--f2g-display); font-style: normal; letter-spacing: -0.01em; }

/* ============ MEGA-MENU ============ */
.site-topnav-list { align-items: center; gap: 0.125rem; flex-wrap: wrap; }
.nav-link {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.4rem 0.6rem; border-radius: 0.5rem; font-size: 0.9rem; line-height: 1;
  color: var(--f2g-ink); white-space: nowrap; background: transparent;
  border: 0; cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover, .nav-link:focus-visible { background: var(--color-muted, oklch(0.97 0 0)); }
.nav-link-nl { border: 1px solid var(--f2g-line); }
.nav-dd { position: relative; }
.nav-dd > summary { list-style: none; }
.nav-dd > summary::-webkit-details-marker { display: none; }
.nav-dd > summary::after { content: '▾'; font-size: 0.7em; opacity: 0.6; }
.nav-dd[open] > summary { background: var(--color-muted, oklch(0.97 0 0)); }

.mega {
  display: grid; gap: 0.15rem 1.25rem; padding: 1rem;
  background: var(--color-background, #fff); border: 1px solid var(--f2g-line);
  border-radius: 0.75rem; box-shadow: var(--f2g-shadow);
}
.mega-mainland { grid-template-columns: repeat(2, minmax(0,1fr)); }
.mega-sub-1 { grid-template-columns: minmax(0,1fr); }
.mega-sub-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
a.mega-head { text-decoration: none; }
a.mega-head:hover { text-decoration: underline; }
.mega-col { min-width: 0; }

/* ---- Tabbed mega (Greek Islands, Plan): left heading tabs + right panel ---- */
.mega-tab-radio { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mega-tabs { display: block; }
.mega-tablist { display: flex; flex-direction: column; gap: 0.15rem; }
.mega-tab {
  display: block; cursor: pointer; padding: 0.42rem 0.7rem; border-radius: 0.5rem;
  font-family: var(--f2g-display); font-weight: 600; font-size: 1rem;
  color: var(--f2g-ink); white-space: nowrap; transition: background-color .12s ease, color .12s ease;
}
.mega-tab:hover { background: var(--color-muted, oklch(0.97 0 0)); }
.mega-panels { min-width: 0; }
.mega-panel { display: none; columns: 12rem; column-gap: 1.4rem; }
.mega-panel > .mega-link { break-inside: avoid; }
.mega-tab-radio:focus-visible ~ .mega-tablist .mega-tab { outline: none; }
/* active panel (indices 1-8) */
.mega-tab-radio:nth-of-type(1):checked ~ .mega-panels > .mega-panel:nth-of-type(1),
.mega-tab-radio:nth-of-type(2):checked ~ .mega-panels > .mega-panel:nth-of-type(2),
.mega-tab-radio:nth-of-type(3):checked ~ .mega-panels > .mega-panel:nth-of-type(3),
.mega-tab-radio:nth-of-type(4):checked ~ .mega-panels > .mega-panel:nth-of-type(4),
.mega-tab-radio:nth-of-type(5):checked ~ .mega-panels > .mega-panel:nth-of-type(5),
.mega-tab-radio:nth-of-type(6):checked ~ .mega-panels > .mega-panel:nth-of-type(6),
.mega-tab-radio:nth-of-type(7):checked ~ .mega-panels > .mega-panel:nth-of-type(7),
.mega-tab-radio:nth-of-type(8):checked ~ .mega-panels > .mega-panel:nth-of-type(8) { display: block; }
/* active tab highlight (indices 1-8) */
.mega-tab-radio:nth-of-type(1):checked ~ .mega-tablist > .mega-tab:nth-of-type(1),
.mega-tab-radio:nth-of-type(2):checked ~ .mega-tablist > .mega-tab:nth-of-type(2),
.mega-tab-radio:nth-of-type(3):checked ~ .mega-tablist > .mega-tab:nth-of-type(3),
.mega-tab-radio:nth-of-type(4):checked ~ .mega-tablist > .mega-tab:nth-of-type(4),
.mega-tab-radio:nth-of-type(5):checked ~ .mega-tablist > .mega-tab:nth-of-type(5),
.mega-tab-radio:nth-of-type(6):checked ~ .mega-tablist > .mega-tab:nth-of-type(6),
.mega-tab-radio:nth-of-type(7):checked ~ .mega-tablist > .mega-tab:nth-of-type(7),
.mega-tab-radio:nth-of-type(8):checked ~ .mega-tablist > .mega-tab:nth-of-type(8) {
  background: var(--f2g-sky); color: #fff;
}
.mega-head {
  font-family: var(--f2g-display); font-weight: 600; font-size: var(--f2g-mega-head-size);
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--f2g-sky);
  margin: 0.5rem 0 0.15rem; break-after: avoid;
}
.mega-link {
  display: block; padding: 0.3rem 0.5rem; border-radius: 0.375rem; line-height: 1.5;
  font-size: var(--f2g-mega-size); color: var(--color-muted-foreground, #555); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mega-link:hover, .mega-link:focus-visible { background: var(--color-muted, oklch(0.97 0 0)); color: var(--f2g-ink); }

/* Desktop: dropdowns float; wide islands panel spans full width */
@media (min-width: 768px) {
  .nav-dd > .mega { position: absolute; top: calc(100% + 0.4rem); left: 0; z-index: 60; }
  .nav-dd-wide { position: static; }
  /* Centered tabbed mega: heading tabs on the left, links panel on the right */
  .nav-dd-wide > .mega-tabs {
    position: absolute; left: 50%; right: auto; top: 5rem; transform: translateX(-50%);
    width: min(76rem, calc(100vw - 2rem));
    display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 0 1.25rem;
    max-height: calc(100vh - 6rem); overflow: hidden; overscroll-behavior: contain;
  }
  .mega-tabs > .mega-tablist {
    border-right: 1px solid var(--f2g-line); padding-right: 0.75rem;
    max-height: calc(100vh - 8rem); overflow-y: auto;
  }
  .mega-tabs > .mega-panels {
    max-height: calc(100vh - 8rem); overflow-y: auto; padding-right: 0.25rem;
  }
  .mega-mainland { width: max-content; min-width: 22rem; }
  .nav-dd > .mega-sub-1 { min-width: 14rem; }
  .nav-dd > .mega-sub-2 { min-width: 32rem; max-height: 72vh; overflow-y: auto; }
  /* right-anchored dropdowns (triggers near the right edge open leftward) */
  .nav-dd > .mega-right { left: auto; right: 0; }
}

/* Mobile: nav becomes a full-width panel under the bar; dropdowns expand inline */
@media (max-width: 767px) {
  .site-topnav-list {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch;
    background: var(--color-background, #fff); border-bottom: 1px solid var(--f2g-line);
    padding: 0.75rem; gap: 0.15rem; max-height: 80vh; overflow-y: auto; box-shadow: var(--f2g-shadow);
  }
  .nav-link { justify-content: space-between; }
  .mega { box-shadow: none; border: 0; border-left: 2px solid var(--f2g-line);
          border-radius: 0; margin: 0.15rem 0 0.4rem 0.5rem; padding: 0.25rem 0.5rem; grid-template-columns: 1fr; }
  .mega-tabs { display: block; }
  .mega-tabs > .mega-tablist { flex-direction: row; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
  .mega-tabs .mega-tab { padding: 0.25rem 0.55rem; font-size: 0.9rem; border: 1px solid var(--f2g-line); }
  .mega-panel { columns: 1 !important; }
}

/* ============ TABLE OF CONTENTS ============ */
.f2g-toc { border: 1px solid var(--f2g-line); border-radius: 0.75rem; padding: 1rem 1.25rem; background: var(--color-muted, oklch(0.98 0 0)); }
.f2g-toc > p { font-family: var(--f2g-display); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--f2g-sky); margin: 0 0 0.5rem; }
.f2g-toc-toggle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.f2g-toc-links { display: flex; flex-direction: column; }
.f2g-toc-links a {
  display: block; width: max-content; max-width: 100%; margin: 0.12rem 0;
  color: var(--f2g-ink); text-decoration: none; font-size: 0.95rem;
  border-bottom: 1px solid transparent;
}
.f2g-toc-links a.lvl3 { margin-left: 1.1rem; color: var(--color-muted-foreground, #555); font-size: 0.9rem; }
.f2g-toc-links a:hover, .f2g-toc-links a:focus-visible { color: var(--f2g-sky); border-bottom-color: var(--f2g-sky); }
/* Collapsed: show at most 5 rows until the toggle is checked */
.f2g-toc-toggle:not(:checked) ~ .f2g-toc-links a:nth-child(n+6) { display: none; }
.f2g-toc-more {
  display: inline-block; margin-top: 0.55rem; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--f2g-sky);
}
.f2g-toc-more:hover { text-decoration: underline; }
.f2g-toc-more::after { content: 'Show all'; }
.f2g-toc-toggle:checked ~ .f2g-toc-more::after { content: 'Close'; }
.f2g-page :is(h2,h3) { scroll-margin-top: 6rem; } /* offset for sticky header */

/* ============ WRITER BOX (avatar + CSS tooltip) ============ */
.f2g-byline { display: inline-flex; align-items: center; gap: 0.6rem; }
.f2g-writer { position: relative; display: inline-flex; }
.f2g-writer img { height: 40px; width: 40px; border-radius: 9999px; object-fit: cover; border: 2px solid var(--color-background,#fff); box-shadow: 0 0 0 1px var(--f2g-line); cursor: help; display: block; }
.f2g-writer .f2g-bio {
  position: absolute; top: calc(100% + 0.6rem); left: 0; z-index: 40;
  width: min(22rem, 78vw); padding: 0.85rem 1rem;
  background: var(--color-background,#fff); border: 1px solid var(--f2g-line);
  border-radius: 0.75rem; box-shadow: var(--f2g-shadow);
  font-size: 0.85rem; line-height: 1.5; color: var(--color-muted-foreground,#555);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.f2g-writer:hover .f2g-bio, .f2g-writer:focus-within .f2g-bio { opacity: 1; visibility: visible; transform: translateY(0); }
.f2g-byline .f2g-by-name { font-weight: 600; }
.f2g-byline .f2g-by-role { color: var(--color-muted-foreground,#666); font-size: 0.85rem; }

/* ============ ONE-ROW CAROUSEL ============ */
.f2g-carousel {
  display: flex; gap: 0.6rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0.25rem 0.25rem 0.75rem; scroll-behavior: smooth; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.f2g-carousel::-webkit-scrollbar { height: 8px; }
.f2g-carousel::-webkit-scrollbar-thumb { background: var(--f2g-line); border-radius: 99px; }
.f2g-cell {
  flex: 0 0 auto; width: clamp(150px, 42vw, 230px); aspect-ratio: 4/3;
  scroll-snap-align: start; border-radius: 0.6rem;
  border: 1px solid var(--f2g-line); cursor: zoom-in; display: block;
  object-fit: cover; transition: box-shadow .2s ease, filter .2s ease;
}
.f2g-cell:hover { box-shadow: 0 8px 24px oklch(0.2 0.03 240 / 0.18); filter: brightness(1.04); }
.f2g-cell:focus-visible { outline: 2px solid var(--f2g-sky); outline-offset: 2px; }

/* Carousel prev/next buttons (injected by audit-ui.js) */
.f2g-carousel-wrap { position: relative; }
.f2g-car-btn {
  position: absolute; top: calc(50% - 0.375rem); transform: translateY(-50%); z-index: 6;
  width: 2.5rem; height: 2.5rem; border-radius: 9999px; display: grid; place-items: center;
  cursor: pointer; font-size: 1.5rem; line-height: 1; padding: 0 0 0.15rem;
  color: var(--f2g-ink); background: var(--color-background, #fff);
  border: 1px solid var(--f2g-line); box-shadow: var(--f2g-shadow);
  transition: background-color .15s ease, opacity .15s ease;
}
.f2g-car-prev { left: 0.4rem; }
.f2g-car-next { right: 0.4rem; }
.f2g-car-btn:hover { background: var(--color-muted, oklch(0.97 0 0)); }
.f2g-car-btn:focus-visible { outline: 2px solid var(--f2g-sky); outline-offset: 2px; }
.f2g-car-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; box-shadow: none; }
.f2g-carousel-wrap.f2g-noscroll .f2g-car-btn { display: none; } /* nothing to scroll */

/* ============ CSS-ONLY LIGHTBOX (:target) ============ */
/* Lightbox is created by audit-ui.js only while open, then removed from the DOM. */
.f2g-lightbox {
  position: fixed; inset: 0; z-index: 90; display: flex;
  align-items: center; justify-content: center; padding: 1.5rem;
  background: oklch(0.15 0.02 240 / 0.88); backdrop-filter: blur(2px);
  animation: f2g-lb-fade .15s ease;
}
@keyframes f2g-lb-fade { from { opacity: 0; } to { opacity: 1; } }
.f2g-lightbox .f2g-lb-img { max-width: min(1100px, 94vw); max-height: 88vh; border-radius: 0.5rem; box-shadow: 0 20px 60px rgb(0 0 0 / .5); }
.f2g-lightbox button { -webkit-appearance: none; appearance: none; font: inherit; cursor: pointer; }
.f2g-lb-close { position: absolute; inset: 0; border: 0; background: transparent; cursor: zoom-out; }
.f2g-lb-x {
  position: absolute; top: 1rem; right: 1.25rem; z-index: 2; color: #fff; border: 0;
  font-size: 1.75rem; line-height: 1; width: 2.5rem; height: 2.5rem;
  display: grid; place-items: center; border-radius: 9999px; background: rgb(0 0 0 / .4);
}
.f2g-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; color: #fff; border: 0;
  background: transparent; font-size: 2.5rem; line-height: 1; padding: 0.5rem 1rem; user-select: none; }
.f2g-lb-nav:hover { color: var(--color-muted, #ddd); }
.f2g-lb-prev { left: 0.5rem; } .f2g-lb-next { right: 0.5rem; }
@media (prefers-reduced-motion: reduce) { .f2g-lightbox { animation: none; } }

@media (prefers-reduced-motion: reduce) {
  .f2g-cell img, .f2g-writer .f2g-bio, .f2g-carousel { transition: none; scroll-behavior: auto; }
}
