/* oxihome.org: base, header, buttons, footer. Tokens are in tokens.css. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  font-weight: var(--w-text);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: var(--w-display);
  line-height: 1.06;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

h1 { font-size: var(--t-h1); line-height: 0.98; letter-spacing: -0.042em; }
h2 { font-size: var(--t-h2); letter-spacing: -0.036em; }
h3 { font-size: var(--t-h3); line-height: 1.15; letter-spacing: -0.022em; }

p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
strong, b { font-weight: var(--w-strong); }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: rgb(var(--tint-accent) / 0.3); }

.wrap {
  width: 100%;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.lede {
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--text-2);
  max-width: var(--measure);
  text-wrap: pretty;
}

.quiet { color: var(--text-2); }
.fine { font-size: var(--t-caption); line-height: 1.5; color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */

.site-header { position: relative; z-index: 20; }
.js .site-header { position: sticky; top: 0; }

.site-header::before {            /* glass, in one place, and only once the page has scrolled */
  content: "";
  position: absolute;
  inset: 0;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: inset 0 -1px 0 var(--line);
  opacity: 0;
  transition: opacity var(--dur-fade) var(--ease-out);
}

.is-scrolled .site-header::before { opacity: 1; }

.site-header__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s6);
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  text-decoration: none;
  border-radius: 10px;
}

.brand__mark { width: 30px; height: 28px; color: var(--accent); }

.brand__word {                    /* the wordmark: Geologica 650, as in the logo files */
  font-family: var(--font);
  font-weight: 650;
  font-size: 1.365rem;            /* 0.78 of the mark's 28px */
  line-height: 1;
  letter-spacing: -0.045em;
  transform: translateY(-0.045em);
}

.nav { display: flex; align-items: center; gap: var(--s1); }

.nav a {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: var(--t-small);
  font-weight: var(--w-strong);
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--dur-fade-fast) var(--ease-out), background-color var(--dur-fade-fast) var(--ease-out);
}

.nav a:hover { color: var(--text); background: var(--line); }
.nav a[aria-current="page"] { color: var(--text); }

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-fade-fast) var(--ease-out), background-color var(--dur-fade-fast) var(--ease-out);
}

.icon-button:hover { color: var(--text); background: var(--line); }
.icon-button svg { width: 20px; height: 20px; }

.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.theme-toggle .icon--sun { display: none; }
[data-theme="light"] .theme-toggle .icon--sun { display: block; }
[data-theme="light"] .theme-toggle .icon--moon { display: none; }

.menu { display: none; position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: var(--s2);
  border-radius: var(--r-card);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-pop);
}

.menu__panel a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--r-control);
  font-weight: var(--w-strong);
  text-decoration: none;
}

.menu__panel a:hover { background: var(--line); }

@media (max-width: 759px) {
  .site-header__row { gap: var(--s2); }
  .nav { display: none; }
  .menu { display: block; }
}

/* ---------- Buttons ---------- */

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 16px;
  font-size: var(--t-body);
  font-weight: var(--w-strong);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-quick) var(--spring-quick), background-color var(--dur-fade-fast) var(--ease-out), box-shadow var(--dur-fade-fast) var(--ease-out);
}

.button:active { transform: scale(0.97); }

.button--primary { background: var(--inverse); color: var(--inverse-ink); }
.button--primary:hover { background: color-mix(in oklab, var(--inverse) 88%, var(--canvas)); }

.button--quiet { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.button--quiet:hover { background: var(--line); }

.link {
  font-weight: var(--w-strong);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color var(--dur-fade-fast) var(--ease-out);
}

.link:hover { text-decoration-color: currentColor; }

/* ---------- Sections ---------- */

.section { padding-block: clamp(72px, 11vw, 148px); }
.section + .section { padding-top: 0; }

.section__head { display: grid; gap: var(--s5); max-width: 46rem; margin-bottom: clamp(40px, 6vw, 72px); }

/* ---------- Footer ---------- */

.site-footer {
  padding-block: var(--s16) var(--s12);
  box-shadow: inset 0 1px 0 var(--line);
  font-size: var(--t-small);
  color: var(--text-2);
}

.site-footer__grid {
  display: grid;
  gap: var(--s10) var(--s8);
  grid-template-columns: minmax(0, 1fr);
}

.site-footer__brand { display: grid; gap: var(--s4); align-content: start; max-width: 26rem; }
.site-footer h2 { font-size: var(--t-small); font-weight: var(--w-strong); letter-spacing: 0; line-height: 1.6; color: var(--text); margin-bottom: var(--s2); }
.site-footer li + li { margin-top: 6px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer__legal { margin-top: var(--s12); max-width: 46rem; }

@media (min-width: 760px) {
  .site-footer__grid { grid-template-columns: minmax(0, 5fr) repeat(3, minmax(0, 2fr)); }
}

/* ---------- Theme switch: the new theme grows from where it was tapped ---------- */

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal var(--dur-gentle) var(--spring-gentle) both; }

@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--tap-x, 50%) var(--tap-y, 0%)); }
  to { clip-path: circle(var(--tap-r, 150vmax) at var(--tap-x, 50%) var(--tap-y, 0%)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-new(root) { animation: none; }
}

.wide-only { display: none; }
@media (min-width: 900px) { .wide-only { display: inline; } }

/* ---------- Code ---------- */

code, kbd, pre { font-family: var(--font-mono); font-size: 0.875em; font-variant-ligatures: none; }

:not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
}

.code {
  margin: 0;
  padding: clamp(16px, 2.4vw, 26px) clamp(16px, 2.6vw, 30px);
  overflow-x: auto;
  border-radius: var(--r-tile);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-tile);
  font-size: clamp(0.75rem, 0.66rem + 0.36vw, 0.875rem);
  line-height: 1.62;
  color: var(--text-2);
  tab-size: 4;
}

.code__line { display: block; min-height: 1.62em; white-space: pre; }
.code b { color: var(--text); font-weight: 600; }
.code .c-err { color: var(--danger); font-weight: 600; }       /* the error, and where it is */
.code .c-note { color: rgb(var(--tint-cool)); font-weight: 600; } /* the gutter, and what led to it */
.code .c-dim { color: var(--text-3); }
.code .c-live { color: var(--accent); }
[data-theme="light"] .code .c-note { color: #1f6fd0; }
