/* Death clock widget, styled with the wilarndt.com design system (tokens and fonts in ds.css).
   Space Mono: numbers, labels, axis labels. DM Sans: sentences and small print.
   Background is transparent by default so the widget sits on the Notion page; bg= overrides it. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--page-bg, transparent);
  color: var(--c-text);
  font-family: var(--f-sans);
  font-size: var(--t-sm);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4);
  text-align: center;
}

.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.label { color: var(--c-text-muted); }

.line { font-size: var(--t-sm); color: var(--c-text-muted); }
.line .num, .line strong { color: var(--c-text); font-weight: 400; }
.line strong { font-weight: 500; }

.fine { font-size: 0.6875rem; color: var(--c-text-muted); }
.fine a { color: inherit; }

/* countdown */
.units { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(var(--sp-3), 3.5vw, var(--sp-8)); }
.unit { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); min-width: 2.5ch; }
.unit .n { font-family: var(--f-mono); font-size: clamp(var(--t-2xl), 8vw, var(--t-4xl)); line-height: 1; letter-spacing: -0.03em; }
.unit .u { color: var(--c-text-muted); }

/* figures row: "% lived" on the left, "years left" on the right */
.figures { display: flex; justify-content: space-between; gap: var(--sp-4); white-space: nowrap; color: var(--c-text); }
.figures.meta { font-size: var(--t-sm); }

/* thin lifespan bar (bar and combo views): orange fill, border-coloured track, marks below */
.lifebar { width: 100%; }
.lifebar .track { position: relative; height: 7px; border-radius: 4px; background: var(--c-border); overflow: hidden; }
.lifebar .fill { position: absolute; inset: 0 auto 0 0; background: var(--c-brand); }
.lifebar .marks { position: relative; height: 6px; margin-top: 3px; }
.lifebar .tick { position: absolute; top: 0; width: 1px; height: 3px; margin-left: -0.5px; background: var(--c-text-faint); }
.lifebar .tick.decade { height: 6px; background: var(--c-text-muted); }
.lifebar .axis { position: relative; height: 1.3em; margin-top: 2px; }
.lifebar .axis span { position: absolute; transform: translateX(-50%); color: var(--c-text-muted); }

/* bar */
#app.bar .lifebar, #app.bar .figures { width: min(100%, 600px); }

/* weeks */
#app.weeks { justify-content: flex-start; }
.weeks-wrap { width: 100%; max-width: 760px; }
.weeks-wrap canvas { display: block; margin: 0 auto; }

/* compact */
#app.compact { padding: var(--sp-2) var(--sp-3); gap: 2px; }
.compact-line { font-family: var(--f-mono); font-size: clamp(var(--t-sm), 4vw, var(--t-lg)); white-space: nowrap; }
@media (max-height: 70px) { #app.compact .fine { display: none; } }

/* combo */
#app.combo { align-items: stretch; text-align: left; gap: var(--sp-2); max-width: 760px; margin: 0 auto; }
.combo-head { font-size: var(--t-base); }
.combo-head .num { font-weight: 700; }
#app.combo .lifebar { margin-top: 2px; }
#app.combo .fine { margin-top: var(--sp-1); }

/* Narrow embeds: drop the axis labels, then the yearly ticks. */
@media (max-width: 420px) {
  .lifebar .axis { display: none; }
  .figures.meta { font-size: var(--t-xs); }
  .combo-head { font-size: var(--t-sm); }
}
@media (max-width: 300px) { .lifebar .tick:not(.decade) { display: none; } }

/* breakdown */
.breakdown { border-collapse: collapse; font-size: var(--t-xs); color: var(--c-text-muted); margin-top: var(--sp-2); }
.breakdown td { padding: 3px var(--sp-3); border-top: 1px solid var(--c-border); text-align: left; }
.breakdown td.num { text-align: right; color: var(--c-text); white-space: nowrap; }
.breakdown tr.total td { color: var(--c-text); font-weight: 500; }
.breakdown tr.total td.num { font-weight: 700; }

/* error */
.error { max-width: 34rem; text-align: left; font-size: var(--t-sm); }
.error h1 { font-family: var(--f-mono); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--sp-2); }
.error ul { margin: var(--sp-1) 0 var(--sp-3) 1.2rem; }
.error li { margin: 2px 0; }
.error code { font-family: var(--f-mono); font-size: var(--t-xs); }
.error .problems { color: var(--c-brand); }
.error a { color: var(--c-text); font-weight: 500; }
