/* drill's ink look (see mac/Sources/InkKit/Ink.swift): paper, one ink, lots
   of air, lowercase words. Light is "teto" with her crimson for progress
   only; dark is pure monochrome. */

:root {
  --paper: #F2F0ED;
  --ink: #2B2A2F;
  --accent: #CF3A4F;
  --faint: rgb(43 42 47 / .45);
  --ghost: rgb(43 42 47 / .12);
  --wash: rgb(43 42 47 / .055);
  --raised: rgb(43 42 47 / .045);
  --ok: #3B9B5E;
  --bad: #CF3A4F;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211;
    --ink: #F1F0EB;
    --accent: #F1F0EB;
    --faint: rgb(241 240 235 / .45);
    --ghost: rgb(241 240 235 / .12);
    --wash: rgb(241 240 235 / .055);
    --raised: rgb(241 240 235 / .05);
    --ok: #5FBF80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121211;
  --ink: #F1F0EB;
  --accent: #F1F0EB;
  --faint: rgb(241 240 235 / .45);
  --ghost: rgb(241 240 235 / .12);
  --wash: rgb(241 240 235 / .055);
  --raised: rgb(241 240 235 / .05);
  --ok: #5FBF80;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* One column, 780 wide at most. The stack (timer, then year) sits in the
   air below the header split 2 : 3, so the optical centre is a little
   high; the spacers are the column's own ::before and ::after, with the
   header ordered ahead of the first. When the stack doesn't fit, both
   drop to their minimums and the page scrolls. R is the ring's diameter;
   the readout is sized from it. */
:root { --gutter: 40px; --R: 270px; }
.app {
  max-width: calc(780px + 2 * var(--gutter));
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) var(--gutter) env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
}
.app::before { content: ""; order: -1; flex: 2 1 0; min-height: 24px; max-height: 160px; }
.app::after { content: ""; flex: 3 1 0; min-height: 24px; }

/* Header */

.top { order: -2; display: flex; align-items: center; gap: 20px; height: 24px; }
.spacer { flex: 1; }

/* Buttons: one ink capsule per screen; everything else is a faint word. */

.link {
  background: none; border: 0; padding: 2px 0; cursor: pointer;
  color: var(--faint); font-size: 15px;
  transition: color .12s ease-out, opacity .12s;
}
.link:hover, .link[aria-pressed="true"] { color: var(--ink); }
.link[aria-pressed="true"] { font-weight: 600; }
.link:active { opacity: .5; }

.capsule {
  min-width: 128px; height: 48px;
  padding: 0 42px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: var(--paper);
  font-size: 16px; font-weight: 600;
  transition: opacity .12s ease-out, transform .2s cubic-bezier(.3, .7, .4, 1);
}
.capsule:hover { opacity: .86; }
.capsule:active { transform: scale(.96); }
.capsule.small { min-width: 0; height: 40px; padding: 0 28px; font-size: 14px; }

/* Timer */

.timer { flex: none; display: flex; flex-direction: column; align-items: center; }
.face { position: relative; width: var(--R); height: var(--R); }
/* Drawn at 270 and scaled to R; the strokes and the dotted track keep their width. */
.ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ring .track { fill: none; stroke: var(--ghost); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 1.5 6; vector-effect: non-scaling-stroke; }
.ring .arc { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ring .tip { fill: var(--accent); }
.readout {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.status { color: var(--faint); font-size: calc(var(--R) * .055); line-height: 1.3; }
.clock {
  margin-top: calc(var(--R) * .03);
  font-size: calc(var(--R) * .22); font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
/* The slot under the digits keeps the dots' height in both modes, so the
   clock sits where it did; the interval mark overflows it downward. */
.under { margin-top: calc(var(--R) * .04); height: 6px; display: flex; flex-direction: column; align-items: center; }
.dots { display: flex; gap: 7px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--faint); transition: background .5s; }
.dots i.on { background: var(--ink); border-color: var(--ink); }
.dots[hidden], .mark[hidden] { display: none; }
.mark { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mark svg {
  width: calc(var(--R) * .08); height: calc(var(--R) * .08);
  overflow: visible; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.round { color: var(--faint); font-size: calc(var(--R) * .055); line-height: 1.3; font-variant-numeric: tabular-nums; }
.clock.switch-mode { cursor: pointer; }

.tag { margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Hidden in interval mode, keeping its room so the face and controls stay put. */
.tag[hidden] { display: flex; visibility: hidden; }
.tag-field { display: flex; align-items: baseline; gap: 8px; height: 32px; font-size: 15px; line-height: 28px; }
.tag-field span { color: var(--faint); }
.tag-field input {
  width: 150px; padding: 0 0 3px;
  background: none; border: 0; border-bottom: 1px solid var(--ghost); border-radius: 0;
  font-weight: 500; outline: none;
  transition: border-color .15s;
}
.tag-field input:focus { border-bottom-color: var(--faint); }
.tag-field input::placeholder { color: var(--ink); opacity: .28; font-weight: 400; }
.suggest { display: flex; gap: 16px; min-height: 18px; }
.suggest .link { padding: 0; font-size: 13px; }

.controls { margin-top: 32px; display: flex; align-items: center; gap: 32px; }
.controls .link { width: 40px; min-height: 44px; }
#reset { text-align: right; }
#skip { text-align: left; }
#reset[hidden] { display: block; visibility: hidden; }

/* Year: as wide as its grid (app.js sets that), which fills the column
   unless the whole year fits with room to spare. */

.year { margin-top: 56px; align-self: center; max-width: 100%; }
.year-head { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.filter { position: relative; display: flex; gap: 16px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.filter::-webkit-scrollbar { display: none; }
/* Too many tabs for the width: they scroll, and an edge with more tabs
   past it fades to say so. The chosen tab is marked by weight, as on the
   other platforms. */
.filter.more-right { mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.filter.more-left { mask-image: linear-gradient(270deg, #000 calc(100% - 24px), transparent); }
.filter.more-left.more-right {
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.filter .link { white-space: nowrap; }
.grid { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; }
.grid .month { fill: var(--faint); font-size: 12px; }
.grid .cell { fill: var(--wash); transition: fill .5s cubic-bezier(.3, .7, .2, 1); }
.grid .today { fill: none; stroke: var(--ink); stroke-width: 1.1; }
.grid .hover { fill: none; stroke: var(--faint); stroke-width: 1.1; }

.caption {
  display: flex; align-items: center; gap: 22px;
  margin-top: 16px; height: 24px;
  color: var(--faint); font-size: 15px; white-space: nowrap;
}
.caption b { color: var(--ink); font-weight: 600; margin-left: 5px; }
.caption .date { color: var(--ink); }
.legend { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 11px; }
.legend i { width: 9px; height: 9px; border-radius: 1.5px; background: var(--wash); }

/* Settings */

.settings {
  margin: auto; width: min(440px, calc(100vw - 32px));
  padding: 24px; border: 0; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 1px var(--ghost), 0 24px 60px rgb(0 0 0 / .22);
}
.settings::backdrop { background: rgb(0 0 0 / .28); }
.settings[open] { animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.group { background: var(--raised); border-radius: 10px; padding: 0 14px; margin-bottom: 24px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; font-size: 15px;
}
.row + .row { border-top: 1px solid var(--ghost); }
.row[hidden] { display: none; }
.row.note { color: var(--faint); font-size: 13px; min-height: 36px; }
.num { color: var(--faint); font-variant-numeric: tabular-nums; }
.num input {
  width: 44px; background: none; border: 0; text-align: right; outline: none;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.segmented { display: flex; background: var(--ghost); border-radius: 7px; padding: 2px; }
.segmented button {
  border: 0; background: none; padding: 3px 12px; border-radius: 5px;
  font-size: 13px; color: var(--faint); cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.switch {
  appearance: none; width: 34px; height: 20px; border-radius: 10px; cursor: pointer;
  background: var(--ghost); position: relative; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgb(0 0 0 / .2);
  transition: transform .15s;
}
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(14px); }
.done { display: flex; justify-content: flex-end; margin-top: 4px; }

/* Account */

.account h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 16px; }
/* Left-aligned fields with placeholders, as on windows: a ghost underline
   at rest, an ink one in focus (drawn inset, so nothing moves). */
.fields { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.fields input {
  height: 40px; padding: 0; background: none; border: 0; border-radius: 0; outline: none;
  color: var(--ink); font-size: 15px;
  box-shadow: inset 0 -1px var(--ghost);
  transition: box-shadow .15s;
}
.fields input:focus { box-shadow: inset 0 -2px var(--ink); }
.fields input::placeholder { color: var(--faint); }
.fields input[hidden] { display: none; }
/* Each field with its mark at the trailing edge: a muted arc while
   checking, a green check when good, a red cross when not. */
.field { position: relative; display: flex; }
.field input { flex: 1; padding-right: 22px; }
.field-mark {
  position: absolute; right: 2px; top: 13px; overflow: visible;
  fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.field-mark[hidden] { display: none; }
.field-mark.ok { stroke: var(--ok); }
.field-mark.taken { stroke: var(--bad); }
.field-mark.checking { animation: turn .8s linear infinite; transform-origin: center; }
@keyframes turn { to { transform: rotate(360deg); } }
.field[hidden] { display: none; }
/* Read aloud; the mark shows it. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.account .message { color: var(--faint); font-size: 13px; margin: 0 0 8px; }
.account .message[hidden] { display: none; }
.account-actions { display: flex; align-items: center; gap: 16px; }
.account-actions .link:disabled { opacity: .5; cursor: default; }
.account-actions .capsule { margin-left: -4px; }
.account-actions .capsule:disabled { opacity: .5; cursor: default; }
.account-actions .capsule:disabled:active { transform: none; }

.stay {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 36px; margin: -4px 0 8px; color: var(--faint); font-size: 14px;
}
.ask { font-size: 15px; margin: 4px 0 20px; }

/* Welcome: the account form on its own, before the timer. */

.welcoming .app { display: none; }
.welcome {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.welcome[hidden] { display: none; }
.welcome-body { width: min(360px, 100%); display: flex; flex-direction: column; }
.welcome h1 { text-align: center; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.tagline { text-align: center; color: var(--faint); margin: 6px 0 36px; }
.welcome #account-title, .welcome [data-close] { display: none; }

/* Inspo */

.inspo-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.inspo h2 { flex: 1; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.squares { display: grid; grid-template-columns: repeat(25, 1fr); gap: 3px; }
.squares a { aspect-ratio: 1; border-radius: 2px; background: var(--wash); }
.squares a.on { background: var(--accent); }
.watched { color: var(--faint); font-size: 13px; margin: 10px 0 18px; }
.inspo ul { list-style: none; padding: 0; margin-bottom: 12px; }
.inspo li + li { margin-top: 12px; }
.inspo li a { display: flex; gap: 12px; align-items: baseline; color: inherit; text-decoration: none; }
.inspo li i { font-style: normal; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.inspo b { display: block; font-size: 14px; font-weight: 500; }
.inspo b.on::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 6px;
  border-radius: 50%; background: var(--accent); vertical-align: middle;
}
.inspo li span { display: block; color: var(--faint); font-size: 13px; transition: color .12s ease-out; }
.inspo li a:hover span { color: var(--ink); }
#inspo[data-page="all"] ul { max-height: 360px; overflow-y: auto; scrollbar-width: none; }

/* Command palette: a field and up to eight rows, about a fifth of the way down. */

.palette {
  margin: 20vh auto auto; width: min(520px, calc(100vw - 32px));
  padding: 6px; border: 0; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 1px var(--ghost), 0 18px 48px rgb(0 0 0 / .18);
}
.palette::backdrop { background: rgb(0 0 0 / .06); }
.palette[open] { animation: drop .12s ease-out; }
.palette.closing { animation: fade .08s ease-in forwards; }
.palette.closing::backdrop { animation: fade .08s ease-in forwards; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fade { to { opacity: 0; } }
.palette input {
  display: block; width: 100%; height: 40px; padding: 0 12px;
  background: none; border: 0; outline: none; font-size: 16px;
}
.palette input::placeholder { color: var(--faint); }
.palette ul {
  list-style: none; padding: 0; max-height: calc(8 * 36px); overflow-y: auto; scrollbar-width: none;
}
.palette ul:not(:empty) { margin-top: 4px; }
.palette li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 36px; padding: 0 12px; border-radius: 8px;
  color: var(--faint); font-size: 14px; cursor: pointer;
  white-space: nowrap;
}
.palette li span { overflow: hidden; text-overflow: ellipsis; }
.palette li b { color: var(--ink); font-weight: inherit; }
.palette li[aria-selected="true"] { background: var(--wash); }
.palette li.empty { cursor: default; }
.palette kbd { font: inherit; font-size: 12px; color: var(--faint); }

/* Demo: the app on the download site (?demo), without an account. */

.demo #sync, .demo .sync-group { display: none; }
/* Framed on the download site: sized by its content, so the site can fit
   the frame to it. */
.framed .app { min-height: 0; }

/* Form factors: the gutter narrows under 600; the ring is 240 on phones,
   300 on wide screens; the legend needs a grid 600 wide. */

@media (max-width: 599px) {
  :root { --gutter: 16px; }
}
@media (max-width: 679px) {
  .legend { display: none; }
}
@media (max-width: 479px) {
  :root { --R: 240px; }
  .tag { margin-top: 32px; }
  .year { margin-top: 48px; }
  /* Three stats at 15 can run past a phone column; at 13 the longest fit. */
  .caption { gap: 14px; font-size: 13px; }
}
@media (min-width: 900px) {
  :root { --R: 300px; }
}

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