/* base.css: reset, type, and the app's components at page scale. Layout belongs to each direction. */
@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  background: var(--ground); color: var(--ink);
  font: 450 var(--text)/1.6 var(--sans);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent-select); }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; color: var(--ink); }
h1, .h1 { font-size: var(--h1); line-height: 1.02; font-weight: 720; letter-spacing: -0.038em; }
h2, .h2 { font-size: var(--h2); line-height: 1.06; letter-spacing: -0.034em; }
h3, .h3 { font-size: var(--h3); line-height: 1.27; font-weight: 650; letter-spacing: -0.02em; }
p { text-wrap: pretty; }
.lede { font-size: var(--lede); line-height: 1.5; color: var(--body); font-weight: 450; }
.prose { color: var(--body); }
.small { font-size: var(--small); line-height: 1.45; }
.meta { font-size: var(--meta); line-height: 1.4; color: var(--gray); }
.gray { color: var(--gray); } .faint { color: var(--faint); } .ink { color: var(--ink); } .accent { color: var(--accent); }
.mono { font-family: var(--mono); font-feature-settings: "tnum" 0; letter-spacing: 0; }
.label { font: 600 var(--meta)/16px var(--sans); color: var(--gray); letter-spacing: 0; }   /* the app's group label: 13/600 gray, never all-caps */
strong, b { font-weight: 650; }

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

/* ---------- pills (COMPONENTS.md: compact 36, regular 44, large 50; nothing else) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; user-select: none;
  height: 44px; padding: 0 20px; border-radius: var(--r-pill); font: 650 15.5px/1 var(--sans); letter-spacing: -0.005em;
  background: var(--pill); color: var(--ink); cursor: pointer;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), color var(--dur-1) var(--ease); }
.btn:hover { background: var(--pill-hover); }
.btn:active { transform: scale(.975); }
.btn.sm { height: 36px; padding: 0 15px; font: 600 15px/1 var(--sans); }
.btn.lg { height: 50px; padding: 0 24px; font: 650 16.5px/1 var(--sans); }
.btn.ink { background: var(--ink-pill); color: var(--ink-pill-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 6px 14px -8px rgba(0, 0, 0, .35); }
.btn.ink:hover { background: color-mix(in srgb, var(--ink-pill) 88%, var(--gray)); }
.btn.quiet { background: transparent; color: var(--accent); padding-inline: 10px; font-weight: 600; }
.btn.quiet:hover { background: var(--accent-wash); }
.btn.line { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }
.btn.line:hover { background: var(--pill); }
.btn .i, .btn svg { flex: none; }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border-radius: var(--r-panel); box-shadow: inset 0 0 0 .5px var(--line), var(--shadow); }
.panel.flat { box-shadow: inset 0 0 0 .5px var(--line); }
.well { background: var(--ground); border-radius: var(--r-well); }
.callout { border-radius: var(--r-callout); padding: 12px 14px; background: var(--accent-wash); }

/* ---------- rows inside panels ---------- */
.rows > * { position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 16px; font: 500 16px/21px var(--sans); }
.rows > * + *::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--hair); }
.rows.tiled > * + *::before { left: 58px; }
.rows .sub { display: block; font: 450 13.5px/18px var(--sans); color: var(--gray); }
.rows .two { min-height: 64px; padding-block: 12px; }
.rows .end { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--gray); font: 500 15px/20px var(--sans); }

/* ---------- controls ---------- */
.tile { width: 30px; height: 30px; border-radius: var(--r-tile); display: grid; place-items: center; flex: none; color: #fff; background: var(--v-inbox); }
.tile.n { background: var(--pill); color: var(--gray); }
.tile.lg { width: 44px; height: 44px; border-radius: 12px; }
.tile svg { width: 17px; height: 17px; }
.tile.lg svg { width: 24px; height: 24px; }
.t-inbox { background: var(--v-inbox); } .t-reading { background: var(--v-reading); } .t-records { background: var(--v-records); }
.t-requests { background: var(--v-requests); } .t-later { background: var(--v-later); } .t-coral { background: var(--v-coral); } .t-sky { background: var(--v-sky); }
.t-ink { background: var(--ink-pill); color: var(--ink-pill-text); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--v-inbox); flex: none; display: inline-block; }

.toggle { position: relative; width: 51px; height: 31px; border-radius: 16px; background: color-mix(in srgb, var(--gray) 26%, var(--pill)); flex: none; cursor: pointer;
  transition: background var(--dur-2) var(--ease); }
.toggle::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 3px 8px -2px rgba(0, 0, 0, .22); transition: transform var(--dur-3) var(--ease); }
.toggle[aria-checked="true"], .toggle.on { background: var(--accent); }
.toggle[aria-checked="true"]::after, .toggle.on::after { transform: translateX(20px); }
.toggle.desk { width: 46px; height: 26px; border-radius: 13px; }
.toggle.desk::after { width: 22px; height: 22px; }

/* Segmented: a pill track with pill segments (main 8175c0c8, "Segmented controls are pills, as every button") */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--pill); gap: 0; }
.seg > * { height: 30px; padding: 0 14px; border-radius: var(--r-pill); font: 600 14px/30px var(--sans); color: var(--gray); white-space: nowrap; cursor: pointer;
  transition: color var(--dur-1) var(--ease), background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.seg > *:hover { color: var(--ink); }
.seg > [aria-selected="true"], .seg > .on { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 .5px var(--line), 0 1px 2px rgba(0, 0, 0, .08), 0 4px 10px -6px rgba(0, 0, 0, .25); }
:root[data-theme="dark"] .seg > [aria-selected="true"], :root[data-theme="dark"] .seg > .on { background: #2A303C; }

/* view pill (the app's top bar) */
.vp { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 11px; border-radius: 16px; font: 500 14px/18px var(--sans); color: var(--gray); }
.vp.on { background: var(--pill); color: var(--ink); }
.vp b { font-weight: 500; color: var(--faint); }

/* chips and tags */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 8px; font: 600 12.5px/16px var(--sans); background: var(--pill); color: var(--ink); }
.chip.later { background: var(--later-wash); color: var(--later-ink); }
.chip.money { background: var(--money-wash); color: var(--money-ink); }
.chip.blue { background: var(--accent-select); color: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font: 500 12.5px/1 var(--sans); background: var(--pill); color: var(--gray); }

/* key cap */
kbd, .kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; font: 600 12px/1 var(--sans);
  color: var(--gray); background: var(--panel); box-shadow: inset 0 0 0 .5px var(--rule), 0 1px 0 var(--rule); }

/* avatars: the app's flat-ish faces */
.av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font: 650 14px/1 var(--sans); letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 0 0 .5px rgba(0, 0, 0, .06); }
.av.sm { width: 34px; height: 34px; font-size: 12px; } .av.xs { width: 24px; height: 24px; font-size: 9.5px; } .av.lg { width: 56px; height: 56px; font-size: 18px; }
.av.dim { filter: saturate(.18) brightness(1.04); opacity: .75; }
.g-coral { background: linear-gradient(160deg, #FF8A70, #EE5F44); } .g-green { background: linear-gradient(160deg, #3CCB9C, #16A57C); }
.g-blue { background: linear-gradient(160deg, #6FA3FF, #3A78F0); } .g-amber { background: linear-gradient(160deg, #FFBD5C, #EC9425); }
.g-sky { background: linear-gradient(160deg, #5CC6E3, #2A9FC2); } .g-navy { background: linear-gradient(160deg, #2C3E66, #18243F); }
.g-forest { background: linear-gradient(160deg, #4E8F5A, #2F6B3C); } .g-ink { background: var(--ink-pill); color: var(--ink-pill-text); }

/* the mark */
.mark { width: 28px; height: 28px; border-radius: 7.5px; flex: none; }
:root[data-theme="dark"] .mark { box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }
.wordmark { font: 750 21px/1 var(--sans); letter-spacing: -0.045em; color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 9px; }

/* ---------- entrance: one rise, played once ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] { opacity: 0; transform: translateY(var(--rise)); transition: opacity var(--dur-rise) var(--ease), transform var(--dur-rise) var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
  .js [data-rise].in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}

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