/* GridFlex overrides, loaded after the compiled Galerie styles. Hand-written: no build step. */

/* Logo: full wordmark, mark only below 375px. */
.gf-logo {
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.gf-logo svg {
  display: block;
  height: 2.5rem;
  width: auto;
}

.gf-logo .gf-logo__mark {
  display: none;
}

@media (max-width: 374.98px) {
  .gf-logo .gf-logo__full {
    display: none;
  }

  .gf-logo .gf-logo__mark {
    display: block;
  }
}

.g-load-transition__overlay .gf-logo__mark {
  height: 3rem;
  width: auto;
}

/* Palette: #F2F2EE / #111311 with restrained teal. Teal values are a proposal
   pending owner confirmation; all text pairs checked at >= 4.5:1. */
:root {
  --font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --foreground: #111311;
  --background: #F2F2EE;
  --header-background: rgba(242, 242, 238, .85);
  --gradient-card-background: rgba(242, 242, 238, 0);
  --light-background: #E4E4DE;
  --light-secondary-background: #F7F7F4;
  --dark-background: #111311;
  --color-on-dark: #F2F2EE;
  --accent-color: #1F6B66;
  --border: #D6D6CF;
  --border-on-dark: #2A2D2A;
  --light-text: #55574F;
  --gradient-first-color: #1F6B66;
  --gradient-second-color: #5FAFA7;
  --focus: #1F6B66;
  /* Galerie's hero photo opacity (.6 in Galerie). Lowered so light hero text keeps
     readable contrast over bright parts of photos (measured, decision 37). */
  --hero-image-transparency: .42;
}

[theme-mode="dark"] {
  --foreground: #F2F2EE;
  --background: #111311;
  --header-background: rgba(17, 19, 17, .85);
  --gradient-card-background: rgba(17, 19, 17, 0);
  --light-background: #1C1F1C;
  --light-secondary-background: #0B0C0B;
  --accent-color: #5FAFA7;
  --border: #2A2D2A;
  --light-text: #A9ABA3;
  --focus: #5FAFA7;
}

body {
  background-color: var(--background);
  color: var(--foreground);
}

/* Keyboard focus on Galerie buttons (its .focusable rule removes outlines). */
.focusable:focus-visible,
.g-header-button:focus-visible {
  outline: 3px solid var(--focus) !important;
  outline-offset: 2px;
}

/* Visible keyboard focus. */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Inter 4.1 (SIL Open Font License 1.1, see ../fonts/inter/LICENSE.txt), self-hosted variable fonts. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/InterVariable.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/InterVariable-Italic.woff2") format("woff2");
}

/* Skip link: hidden until focused. */
.gf-skip-link {
  position: absolute;
  left: .5rem;
  top: -100%;
  z-index: 1000;
  padding: .5rem 1rem;
  background: var(--background);
  color: var(--foreground);
  border: 2px solid var(--focus);
}

.gf-skip-link:focus {
  top: .5rem;
}

/* Focus on video controls: two-tone ring stays visible over any frame; Ghost removes slider outlines. */
.g-post-content .kg-video-card button:focus-visible,
.g-post-content .kg-video-card input[type=range]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}

/* Player bar text stays readable over any frame: darker gradient, full-white time display. */
.g-post-content .kg-video-card .kg-video-player-container {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .75) 100%);
}

.g-post-content .kg-video-card .kg-video-current-time,
.g-post-content .kg-video-card .kg-video-time,
.g-post-content .kg-video-card .kg-video-duration {
  color: #fff;
  opacity: 1;
}

/* Loop/autoplay is disabled by gridflex-media.js; native controls replace Ghost's hidden ones. */
.gf-video-autoplay-disabled .kg-video-overlay,
.gf-video-autoplay-disabled .kg-video-player-container {
  display: none;
}

/* Video failed to load: keep the poster and caption, remove play controls. */
.gf-video-failed .kg-video-overlay,
.gf-video-failed .kg-video-player-container {
  display: none;
}

/* Diagrams: conceptual HTML diagrams pasted into Ghost HTML cards (content/diagrams/).
   Real text and lists, so they reflow on small screens and follow light/dark. */
.g-post-content .gf-diagram {
  margin: var(--spacing-m) 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  background: var(--light-secondary-background);
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.5;
}

.g-post-content .gf-diagram figcaption {
  max-width: none;
  margin: 0 0 1rem;
  padding: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  color: var(--foreground);
  opacity: 1;
}

.gf-diagram__tag {
  display: inline-block;
  margin-right: .5rem;
  padding: .125rem .5rem;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  vertical-align: .125em;
}

.g-post-content .gf-diagram p,
.g-post-content .gf-diagram ul,
.g-post-content .gf-diagram ol,
.g-post-content .gf-diagram li,
.g-post-content .gf-diagram dl {
  margin: 0;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
}

.g-post-content .gf-diagram > p:first-of-type::first-letter {
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
}

.gf-diagram strong {
  font-weight: 600;
}

.gf-diagram__title {
  font-weight: 600;
}

.gf-diagram__band,
.gf-diagram__note {
  margin-top: 1rem !important;
  padding: .75rem 1rem !important;
  border-left: 3px solid var(--accent-color);
  background: var(--light-background);
}

.gf-diagram__band {
  margin: 0 0 1rem !important;
}

.gf-diagram__steps + .gf-diagram__band {
  margin: 1rem 0 0 !important;
}

/* Flow: numbered steps, vertical on phones, a row on wider screens. Arrows are drawn with borders (no text). */
.gf-diagram__steps {
  display: grid;
  gap: 1.5rem;
  list-style: none;
  counter-reset: gf-step;
}

.g-post-content .gf-diagram__steps > li {
  position: relative;
  padding: .875rem 1rem;
  border: 1px solid var(--border);
  background: var(--background);
  counter-increment: gf-step;
}

.gf-diagram__steps > li strong {
  display: block;
  margin-bottom: .25rem;
}

.gf-diagram__steps > li strong::before {
  content: counter(gf-step) ". ";
  content: counter(gf-step) ". " / "";
  color: var(--accent-color);
}

.gf-diagram__steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1.125rem;
  width: .625rem;
  height: .625rem;
  border-right: 2px solid var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
  transform: translateX(-50%) rotate(45deg);
}

@media (min-width: 48rem) {
  /* Short flows: one row per step, name beside its description. */
  .gf-diagram--flow:not(.gf-diagram--long) .gf-diagram__steps > li {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 1rem;
  }

  .gf-diagram--flow:not(.gf-diagram--long) .gf-diagram__steps > li strong {
    margin-bottom: 0;
  }

  /* Long flows: a numbered grid read row by row; numbers carry the order. */
  .gf-diagram--long .gf-diagram__steps {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .gf-diagram--long .gf-diagram__steps > li::after {
    display: none;
  }
}

/* Paths and options: separate boxes side by side on wider screens. */
.gf-diagram__paths,
.gf-diagram__options,
.gf-diagram__path ul {
  display: grid;
  gap: 1rem;
  list-style: none;
}

.gf-diagram__path ul {
  gap: .5rem;
}

.gf-diagram__path,
.g-post-content .gf-diagram__options > li {
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--background);
}

.gf-diagram__path .gf-diagram__title,
.gf-diagram__options .gf-diagram__title {
  margin-bottom: .5rem !important;
  padding-bottom: .5rem !important;
  border-bottom: 2px solid var(--accent-color);
}

.gf-diagram dt {
  margin-top: .5rem;
  color: var(--light-text);
  font-size: .8125rem;
  font-weight: 600;
}

.gf-diagram dd {
  margin: 0;
}

@media (min-width: 48rem) {
  .gf-diagram__paths,
  .gf-diagram__options {
    grid-template-columns: 1fr 1fr;
  }

  .g-post-content .gf-diagram__options > li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
