/* Base styles shared by every page: reset, type, focus, skip link, dock, footer, inset lists. */

@view-transition {
  navigation: auto;
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 17px/1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* The page edge is --page-inset (tokens.css). The home page sets its own full-bleed layout. */
main {
  display: block;
  padding: max(24px, env(safe-area-inset-top)) var(--page-inset) 48px;
}

.home main {
  padding: 0;
}

img,
picture,
svg,
canvas {
  display: block;
  max-width: 100%;
}

img,
picture img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(44px, 6.2vw, 96px);
}

h2 {
  font-size: clamp(32px, 4vw, 56px);
}

h3 {
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p {
  margin: 0;
  max-width: 68ch;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus {
  outline: none;
}

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

.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--page);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus-visible {
  top: 16px;
  outline-offset: 0;
}

/* A pill button or link. */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--text);
  color: var(--page);
  font-weight: 600;
  text-decoration: none;
}

.pill:hover {
  opacity: 0.9;
}

/* Inset grouped list, like a phone's Settings screen. */
.group {
  background: var(--page-2);
  border-radius: 20px;
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
}

.group-row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
}

.group-row.has-icon {
  min-height: 64px;
}

.group-row + .group-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.group-row:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

.group-row-title {
  font-weight: 600;
}

.group-row::after {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--text-2);
  border-right: 2px solid var(--text-2);
  transform: rotate(45deg);
  justify-self: end;
}

/* ---- Dock ---------------------------------------------------------------- */

.dock {
  --dock-tint: var(--page);
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin-inline: auto;
  padding: 6px;
  border-radius: var(--r-dock);
  background: color-mix(in srgb, var(--dock-tint) 72%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: var(--shadow-dock);
  color: var(--text);
  view-transition-name: dock;
  transition: transform 0.36s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.dock[data-surface="dark"] {
  --dock-tint: #07080D;
  --page: #07080D;
  --text: #F5F6F8;
  color: #F5F6F8;
}

.dock[data-surface="light"] {
  --dock-tint: #FFFFFF;
  --page: #FFFFFF;
  --text: #14161C;
  color: #14161C;
}

.dock.is-hidden {
  transform: translateY(calc(100% + 24px));
}

.dock-list {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  list-style: none;
}

.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 56px;
  min-height: 56px;
  padding: 4px 6px 8px;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
}

.dock-item:hover {
  background: color-mix(in srgb, currentColor 6%, transparent);
}

.dock-tile {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  overflow: hidden;
  transform-origin: 50% 100%;
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .dock-tile {
    transition: none;
  }
}

/* The Home item is the K mark itself: no mask, so all four corner tiles show in full. */
.dock-item[href="/"] .dock-tile {
  overflow: visible;
  border-radius: 0;
}

.dock-tile > svg,
.dock-tile > picture,
.dock-tile > picture > img {
  width: 100%;
  height: 100%;
}

.dock-tile .k-mark {
  border-radius: 0;
}

.dock-tile .doc-glyph {
  background: var(--page-2);
  border-radius: 11px;
}

/* On the dark surface the Legal tile is a light glyph on a translucent light tile. */
.dock[data-surface="dark"] .dock-tile .doc-glyph {
  background: rgba(255, 255, 255, 0.14);
  color: #F5F6F8;
}

.dock-label {
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

/* The current place: a 4px dot under the label, so colour is not the only cue. */
.dock-item[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}

/* The hub uses --hub. Set by the page, or by AK.dock({ hub }). */
.k-hub {
  fill: var(--hub, #FFB21E);
}

.k-slot {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}

/* The dock's blur and translucency are the only ones on the site. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .dock {
    background: var(--dock-tint);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dock {
    transition: none;
  }
}

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

.foot {
  border-top: 1px solid var(--line);
  padding: 48px 0 0;
  /* Room for the dock (about 76px tall plus its bottom offset), so it never covers the last links. */
  padding-bottom: max(128px, calc(120px + env(safe-area-inset-bottom)));
  color: var(--text-2);
  font-size: 15px;
}

.foot-inner {
  padding-inline: var(--page-inset);
  display: grid;
  gap: 20px;
}

.foot-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  width: max-content;
  color: var(--text);
  text-decoration: none;
}

.foot-mark {
  width: 28px;
  height: 28px;
}

.foot-word {
  width: auto;
  height: 22px;
}

.foot-tagline {
  color: var(--text);
  font-size: 17px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.foot-made {
  font-size: 13px;
}

/* ---- Surface tension type and links --------------------------------------- */

.display {
  font: 600 var(--fs-display) / 0.96 var(--font-display);
  letter-spacing: -0.04em;
}

.lede {
  font: 400 var(--fs-lede) / 1.4 var(--font-text);
  letter-spacing: -0.01em;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: currentColor;
  text-decoration: underline 1px;
  text-underline-offset: 4px;
}

.text-link:hover {
  text-decoration-thickness: 2px;
}

.pill.pill-light {
  background: var(--liquid-ink);
  color: var(--liquid-base);
}

/* ---- Motion preference: the page stays readable with no motion at all ---- */

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 0.01s;
  }
}
