/* void frame - base styles (design A2: D009, D010, D011). Dark is the base; light by device setting or by choice. */
:root {
  color-scheme: dark;
  --bg: #1c1c1c;
  --text: #f5f5f5;
  --text-secondary: #9a9a9a;
  --rule: rgba(255, 255, 255, 0.14);
  --red: #c9746c;
  --blue: #7f9dbf;
  --gutter: clamp(16px, 5vw, 48px);
  --space: clamp(72px, 12vw, 128px);
}

/* A low window (a phone on its side, a small square cover screen): less empty space above and below */
@media (max-height: 500px) {
  :root {
    --space: 56px;
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f7f7f7;
    --text: #111111;
    --text-secondary: #6a6a6a;
    --rule: rgba(0, 0, 0, 0.14);
    --red: #a94a42;
    --blue: #41648c;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f7;
  --text: #111111;
  --text-secondary: #6a6a6a;
  --rule: rgba(0, 0, 0, 0.14);
  --red: #a94a42;
  --blue: #41648c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  padding-bottom: 96px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-color: var(--text-secondary);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--red);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Headline family: only h1, section labels and the logo. Everything else is Inter. */
h1,
.section-label,
.logo {
  font-family: "Sofia Sans Extra Condensed", "Arial Narrow", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(3.25rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
}

h2,
h3 {
  font-weight: 600;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h2.section-label {
  margin-bottom: 40px;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* Header: always at the top */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px clamp(12px, 4vw, 32px);
  min-height: 72px;
}

.logo {
  flex: none;
  white-space: nowrap;
  font-size: 30px;
  line-height: 1;
  text-decoration: none;
}

#main-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0 28px;
}

/* Without JavaScript the wrapped links never cover the whole window */
:root:not(.menu-ready) .header-inner {
  max-height: 50vh;
  overflow-y: auto;
}

.menu-ready .header-inner {
  flex-wrap: nowrap;
}

.menu-ready #main-menu {
  flex: none;
  flex-wrap: nowrap;
}

#main-menu a {
  flex: 0 1 auto;
  min-width: 0;
  padding: 8px 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}

.menu-ready:not(.menu-folded) #main-menu a {
  flex: none;
  white-space: nowrap;
}

#main-menu a:hover,
#main-menu a[aria-current="page"] {
  color: var(--text);
}

#main-menu a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

.menu-toggle,
.theme-switch {
  min-height: 44px;
  white-space: nowrap;
  padding: 6px 18px;
  border: 1px solid var(--text-secondary);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.5 "Inter", system-ui, sans-serif;
  cursor: pointer;
}

.menu-toggle:hover,
.theme-switch:hover {
  border-color: var(--text);
}

.theme-switch {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
}

/* Folded menu: menu.js sets .menu-folded when the links do not fit on one line */
.menu-folded #main-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 0;
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  padding: 8px var(--gutter) 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.menu-folded #main-menu.open {
  display: flex;
}

.menu-folded #main-menu a {
  padding: 10px 0;
}

/* Page bodies */
main > section,
.page {
  padding-top: var(--space);
  padding-bottom: var(--space);
}

main > section {
  border-bottom: 1px solid var(--rule);
}

main > section:last-child {
  border-bottom: none;
}

.page > * + * {
  margin-top: 28px;
}

.page > h1 + * {
  margin-top: 56px;
}

.page > p,
.page > ul:not(.contact-links),
.reading-column {
  max-width: 660px;
}

.page > .video-grid {
  margin-top: 72px;
}

.page > h2 {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  max-width: 660px;
}

.page > h2 + p {
  margin-top: 10px;
  color: var(--text-secondary);
}

main > .hero {
  padding-top: calc(var(--space) * 1.125);
  padding-bottom: calc(var(--space) * 1.25);
}

.hero h1 {
  font-size: clamp(3.5rem, 12vw, 10.5rem);
  line-height: 0.9;
}

.hero-sub {
  margin-top: 32px;
  max-width: 560px;
  font-size: 19px;
  color: var(--text-secondary);
}

.cta {
  display: inline-block;
  margin-top: 36px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--red);
  font-weight: 500;
  text-decoration: none;
}

.cta:hover {
  color: var(--red);
}

.more {
  display: inline-block;
  margin-top: 32px;
  font-weight: 500;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
  padding: 0;
  list-style: none;
  font-weight: 500;
}

/* Videos: the first one wide, the others two per row */
.video-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px 32px;
}

/* In a low window (phone on its side, small fold-out) no video is taller than the room under the header.
   svh: the size does not jump when a phone's address bar hides. Elsewhere the first video stays full width. */
@media (max-height: 600px) {
  .video-card .yt {
    max-width: calc((100vh - 96px) * 16 / 9);
    max-width: calc((100svh - 96px) * 16 / 9);
  }
}

.video-card h2,
.video-card h3 {
  margin-top: 18px;
}

.video-card p {
  margin-top: 14px;
  max-width: 660px;
}

.video-card .video-date {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-secondary);
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0;
  font-size: 16px;
  color: var(--text-secondary);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}

/* From 600px - unfolded phones and tablets - two videos per row under the first one */
@media (min-width: 600px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-grid > .video-card:first-child {
    grid-column: 1 / -1;
  }
}
