/* Defaults are the "Tonhalle 1955" design system; site.js swaps the
   colours for one of thirteen poster palettes on each visit.
   Mobile first: base rules are for phones; min-width queries add room. */
:root {
  --ground: #00449d;
  --ground-light: #004fb7;
  --ink: #ffffff;

  --font-sans: "Helvetica Neue", "Helvetica", sans-serif;

  --meta-gap: 2.5em;
  --shadow-bar: 0 1px 4px rgba(0, 0, 0, 0.2);

  --bar-hairline: 2px;
  --bar-thin: 8px;
  --bar-medium: 12px;
  --bar-heavy: 20px;
  --bar-block: 30px;

  --angle-rise: 30deg;
  --angle-fall: -60deg;

  /* A hairline bar broken by gaps, used wherever a divider is needed. */
  --rule: linear-gradient(90deg,
    var(--ink) 0 52%, transparent 52% 56%,
    var(--ink) 56% 84%, transparent 84% 88%,
    var(--ink) 88% 100%);

  /* Layout, stepped up at wider viewports below. */
  --gutter: 1rem;
  --tap: 2.75rem; /* 44px minimum touch target */
}

@media (min-width: 540px) {
  :root { --gutter: 1.5rem; }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-transform: lowercase;
  overflow-wrap: break-word;
}
@media (min-width: 540px) {
  body { font-size: 1.0625rem; }
}

::selection { background: var(--ink); color: var(--ground); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: var(--bar-hairline); }
a:focus-visible { outline: var(--bar-hairline) solid var(--ink); outline-offset: 3px; }

/* Home: one full-screen composition drawn by site.js, and the name.
   The whole screen is one link to the menu. */
.home {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(ellipse at center, var(--ground-light) 0%, var(--ground) 100%);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.home[data-name="top"] { flex-direction: column-reverse; }
.home:focus-visible { outline-offset: -6px; }
.home__art { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.home__name {
  margin: 0;
  padding: var(--gutter) max(var(--gutter), env(safe-area-inset-right)) max(var(--gutter), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  font-size: var(--name-size, 1.75rem);
  font-weight: 700;
  line-height: 1;
  text-align: var(--name-align, left);
  white-space: nowrap;
}

@keyframes slide { from { transform: translateX(var(--from)); } to { transform: translateX(var(--to)); } }
@keyframes slideY { from { transform: translateY(var(--from)); } to { transform: translateY(var(--to)); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes dash { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes cycle {
  0%, 100% { background-color: var(--c1); }
  25% { background-color: var(--c2); }
  50% { background-color: var(--c3); }
  75% { background-color: var(--c4); }
}
@keyframes cycle-border {
  0%, 100% { border-color: var(--c1); }
  25% { border-color: var(--c2); }
  50% { border-color: var(--c3); }
  75% { border-color: var(--c4); }
}

/* Menu: opened by touching the home page (index.html#menu), no script needed. */
.menu {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: var(--menu-justify, center);
  padding: calc(var(--gutter) + var(--tap)) max(var(--gutter), env(safe-area-inset-right)) var(--gutter) max(var(--gutter), env(safe-area-inset-left));
  background: var(--ground);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.455, 0.030, 0.515, 0.955), visibility 0s 0.3s;
}
.menu:target { visibility: visible; opacity: 1; transition-delay: 0s; }
.menu ul { list-style: none; text-align: var(--menu-align, left); width: 100%; max-width: 36rem; margin: 0 auto; padding: 0; }
.menu li a {
  display: block;
  padding: 0.3em 0;
  font-size: var(--menu-size, clamp(2.25rem, 11vw, 4rem));
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
.menu li a:hover { text-decoration: underline; text-decoration-thickness: var(--bar-thin); }
.menu__close {
  position: absolute;
  top: var(--gutter);
  right: max(var(--gutter), env(safe-area-inset-right));
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .home__art * { animation: none !important; }
  .menu { transition: none; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Page column */
.page {
  max-width: 36rem;
  margin: 0 auto;
  padding: 0.5rem max(var(--gutter), env(safe-area-inset-right)) 3rem max(var(--gutter), env(safe-area-inset-left));
}
@media (min-width: 540px) {
  .page { padding-top: 1.5rem; padding-bottom: 4rem; }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  column-gap: 1.5rem;
  margin-bottom: 2rem;
  font-weight: 700;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: var(--bar-hairline); }
.site-nav span { display: flex; gap: 1.5rem; }
@media (min-width: 540px) {
  .site-nav { margin-bottom: 4rem; }
}

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  background: var(--rule) top / 100% var(--bar-hairline) no-repeat;
}
@media (min-width: 540px) {
  .site-footer { margin-top: 5rem; }
}

/* Type */
h1, h2, h3 { font-weight: 700; line-height: 1.1; margin: 0; }
h1 { font-size: var(--head-size, 1.75em); margin-bottom: 0.75rem; }
h2 { font-size: 1.25em; margin: var(--meta-gap) 0 0.75rem; }
p { margin: 0 0 1.25rem; }

/* Small bold facts: dates, credits, labels. */
time, .meta, .site-footer, .menu__close {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

/* Lists of one-line facts, separated by meta-gap. */
.facts { list-style: none; margin: 0 0 var(--meta-gap); padding: 0; font-weight: 700; }
.facts a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* Post list: the whole row is the link. Stacked on phones, one line when wide. */
.posts { list-style: none; margin: 2rem 0 0; padding: 0; }
.posts li { background: var(--rule) top / 100% var(--bar-hairline) no-repeat; }
.posts li:last-child {
  background:
    var(--rule) top / 100% var(--bar-hairline) no-repeat,
    var(--rule) bottom / 100% var(--bar-hairline) no-repeat;
}
.posts a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: var(--tap);
  padding: 0.9rem 0;
  font-weight: 700;
  text-decoration: none;
}
.posts a:hover span { text-decoration: underline; text-decoration-thickness: var(--bar-hairline); }
@media (min-width: 540px) {
  .posts { margin-top: 3rem; }
  .posts a {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5rem;
  }
  .posts time { flex-shrink: 0; }
}

/* Blog: short dated notes, read in place. */
.notes { list-style: none; margin: 2rem 0 0; padding: 0; }
.notes li { padding: 1rem 0 0.25rem; background: var(--rule) top / 100% var(--bar-hairline) no-repeat; }
.notes time { display: block; margin-bottom: 0.35rem; }

/* Article */
article header { margin-bottom: var(--meta-gap); }
blockquote { margin: 1.5rem 0 1.5rem 1em; font-weight: 700; }
code, pre {
  font: 0.875em ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: none;
  background: var(--ink);
  color: var(--ground);
}
code { padding: 0.1em 0.3em; }
/* On phones code blocks run edge to edge, to give the lines more room. */
pre {
  margin: 1.5rem calc(-1 * var(--gutter));
  padding: 1rem var(--gutter);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-bar);
}
pre code { padding: 0; font-size: 1em; }
img, video { max-width: 100%; height: auto; }
hr {
  height: var(--bar-hairline);
  margin: var(--meta-gap) 0;
  border: 0;
  background: var(--rule);
}
.back {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-top: 1.5em;
  font-weight: 700;
}
@media (min-width: 540px) {
  blockquote { margin-left: 2em; }
  pre { margin-inline: 0; padding: 1rem; }
}
