/* The Portal's ground: the front page's tokens and faces, and the primitives every Portal idea is made of.
   Rules carried over from the site and the docs: two grounds (night and paper), square corners, hairlines of 1px, no shadow, no badge, no status dot,
   a pillar's colour is a small square or a line (data), never a text colour or a state. Mono labels, uppercase, wide. */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('fonts/inter-latin.woff2') format('woff2'); }
@font-face { font-family: 'Mozilla Text'; font-style: normal; font-weight: 200 700; font-display: swap; src: url('fonts/mozilla-text-latin.woff2') format('woff2'); }
@font-face { font-family: 'Tinos'; font-style: italic; font-weight: 700; font-display: block; src: url('fonts/tinos-italic-700-latin.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --th-bg: #0b1224; --th-bg-rgb: 11 18 36;
  --th-fg: #ffffff; --th-fg-rgb: 255 255 255;
  --th-fg-2: rgb(255 255 255 / .74); --th-fg-3: rgb(255 255 255 / .46);
  --th-hair: rgb(255 255 255 / .2); --th-hair-2: rgb(255 255 255 / .1);
  --th-surface: #0f1830; --th-surface-2: #16213d;
  --th-canvas: #10b981;
  /* THE ZONES, five tones of the ink. A surface is lighter the nearer it stands to the person (Material and Atlassian, for a dark theme: "the higher the
     elevation, the lighter the surface looks"), by a white overlay that rises with elevation (Material: about 5% at 1dp, 9% at 4dp, 12.5% at 8dp). The page
     the work is done on is the darkest tone, a well, and what stands around and above it is lighter, as in GitHub's and VS Code's dark themes: the frame
     (navigation sits above content in Atlassian's stack), then what you pick, then what floats. Each step is about 3 to 5 of CIE lightness, which is what
     tells one zone from the next on a dark ground, where the contrast ratio of two near-black tones is always close to 1. Only the ink's lightness changes. */
  --z-ground: var(--th-bg);                                 /* the page the work is on */
  --z-chrome: color-mix(in srgb, #fff 4%, var(--th-bg));    /* the frame: top bar, header, sidebar */
  --z-raised: color-mix(in srgb, #fff 7%, var(--th-bg));    /* what you pick from and what you open: cards, the open item */
  --z-hover: color-mix(in srgb, #fff 11%, var(--th-bg));    /* hovered and chosen rows */
  --z-overlay: color-mix(in srgb, #fff 14.5%, var(--th-bg)); /* what floats above: the switcher, the palette, a dialog */
  --z-well: var(--z-ground);                                /* what is sunk into a raised thing: its figures, its log */
  --th-cost-prov: #f87171; --th-cost-drift: #34d399;
  --th-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%23ffffff' stroke-width='1.2'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5'/%3E%3C/svg%3E");
  --scrim: rgb(0 0 0 / .66);
}
:root[data-theme="light"] {
  color-scheme: light;
  --th-bg: #ffffff; --th-bg-rgb: 255 255 255;
  --th-fg: #1b2844; --th-fg-rgb: 27 40 68;
  --th-fg-2: #46536f; --th-fg-3: #66718a;
  --th-hair: rgb(27 40 68 / .24); --th-hair-2: rgb(27 40 68 / .12);
  --th-surface: #f3f4f8; --th-surface-2: #e7e9f0;
  --th-canvas: #08976a;
  /* PAPER. The dark theme's ladder (nearer is lighter) has no room on paper, since nothing is lighter than white: mirrored, it made the page off-white, the
     frame grey and a chosen card greyer, three whites that read as dimmed rather than as places. So on paper there are two tones and the ink. Everything
     that is read on is the one white: the frame, the page, the cards, what floats. One tint of the ink is for what is sunk (a figure, a log, a field) and
     for the row under the pointer. The structure is drawn in ink, as on a printed page: hairlines between regions, and an ink outline on what is chosen. */
  --z-chrome: #ffffff;
  --z-ground: #ffffff;
  --z-raised: #ffffff;
  --z-overlay: #ffffff;
  --z-well: color-mix(in srgb, var(--th-fg) 4%, #fff);
  --z-hover: var(--z-well);
  --th-cost-prov: #b91c1c; --th-cost-drift: #047857;
  --th-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%231b2844' stroke-width='1.2'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5'/%3E%3C/svg%3E");
  --scrim: rgb(11 18 36 / .52);
}
:root {
  /* The five layers, in the order the site names them: A B C D E. A pillar's colour is data. */
  --pa: #f1a006; --pb: #8269eb; --pc: var(--th-canvas); --pd: var(--th-fg); --pe: var(--th-bg);
  --brand-1: #f1a006; --brand-2: #8269eb; --brand-3: #10b981;
  --body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Mozilla Text", "Inter", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wm: 2.6rem; --bar-h: calc(var(--wm) * 1.594);
  --padding: max(5vw, calc((100vw - 1600px) / 2));
  --ease: cubic-bezier(.22, .8, .24, 1);
}
:root[data-theme="light"] { --pe: #ffffff; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 16px); }
body { margin: 0; background: var(--th-bg); color: var(--th-fg); font: 400 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
svg { flex: none; }
:focus-visible { outline: 1px solid var(--th-fg); outline-offset: 3px; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:root[data-theme-switching] *, :root[data-theme-switching] *::before, :root[data-theme-switching] *::after { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

/* ── the type ─────────────────────────────────────────────────────────── */
.lbl { font: 500 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--th-fg-3); }
.mono { font-family: var(--mono); }
.fg2 { color: var(--th-fg-2); } .fg3 { color: var(--th-fg-3); }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 500; letter-spacing: -.035em; line-height: 1.04; }
h1 { font-size: clamp(34px, 4.4vw, 60px); }
h2 { font-size: clamp(26px, 2.8vw, 38px); }
h3 { font-size: 22px; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* a pillar's colour as the square the whole site uses for it */
.sq { display: inline-block; width: 10px; height: 10px; border: 1.5px solid var(--th-fg); flex: none; vertical-align: -1px; }
.sq-a { background: var(--pa); } .sq-b { background: var(--pb); } .sq-c { background: var(--pc); } .sq-d { background: var(--pd); } .sq-e { background: var(--pe); }

/* ── links and buttons: text with a hairline, like the hero's two links ── */
.ln { text-decoration: underline; text-decoration-color: var(--th-hair); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: text-decoration-color .15s ease, color .15s ease; cursor: pointer; }
.ln:hover, .ln:focus-visible { text-decoration-color: currentColor; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 0 3px; font: 500 15px/1.2 var(--display); color: var(--th-fg); border-bottom: 1px solid var(--th-hair); transition: border-color .15s ease, opacity .15s ease; cursor: pointer; }
.btn:hover, .btn:focus-visible { border-bottom-color: var(--th-fg); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.go { border-bottom-color: var(--brand-1); border-bottom-width: 2px; }
.btn.go:hover { border-bottom-color: var(--th-fg); }
.btn.danger { color: var(--th-cost-prov); border-bottom-color: color-mix(in srgb, var(--th-cost-prov) 45%, transparent); }
.btn.danger:hover { border-bottom-color: var(--th-cost-prov); }
.btn.sm { font-size: 13px; }

/* ── fields: a line, not a box ─────────────────────────────────────────── */
.fld { display: block; }
.fld > .lbl { display: block; margin-bottom: 6px; }
.in { width: 100%; padding: 8px 0; background: none; border: 0; border-bottom: 1px solid var(--th-hair); border-radius: 0; font: 400 16px/1.3 var(--body); color: var(--th-fg); transition: border-color .15s ease; }
.in:hover, .in:focus { border-bottom-color: var(--th-fg); outline: none; }
.in::placeholder { color: var(--th-fg-3); }
select.in { appearance: none; -webkit-appearance: none; background: var(--th-chev) no-repeat right 2px center / 10px; padding-right: 22px; cursor: pointer; }
select.in option { background: var(--th-bg); color: var(--th-fg); }
input[type=range] { width: 100%; accent-color: var(--th-fg); height: 18px; background: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.chips button { padding: 3px 0; font: 400 15px/1.2 var(--display); color: var(--th-fg); opacity: .55; border-bottom: 1px solid transparent; transition: opacity .15s ease, border-color .15s ease; }
.chips button:hover { opacity: 1; }
.chips button[aria-pressed="true"] { opacity: 1; border-bottom-color: currentColor; }

/* ── the hairline table ────────────────────────────────────────────────── */
table.t { width: 100%; border-collapse: collapse; font: 400 15px/1.45 var(--body); }
table.t th { padding: 0 18px 10px 0; text-align: left; font: 500 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--th-fg-3); border-bottom: 1px solid var(--th-fg); white-space: nowrap; }
table.t td { padding: 11px 18px 11px 0; vertical-align: middle; color: var(--th-fg-2); border-bottom: 1px solid var(--th-hair-2); }
table.t td:first-child { color: var(--th-fg); font-weight: 500; }
table.t tr.row { cursor: pointer; transition: background-color .15s ease; }
table.t tr.row:hover td { background: rgb(var(--th-fg-rgb) / .035); }
table.t .r { text-align: right; padding-right: 0; }
table.t th.r { padding-right: 0; }

/* a thin bar: the shape's hairline gauge (booked and measured) */
.gauge { position: relative; height: 5px; background: var(--th-hair-2); }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--th-fg); transition: width .7s var(--ease); }
.gauge i.ghost { background: transparent; border-right: 1px solid var(--th-fg-3); }

.spark { display: block; overflow: visible; }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.spark path.area { fill: currentColor; stroke: none; opacity: .08; }
.spark .draw { stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); animation: sparkdraw 1.1s var(--ease) forwards; }
@keyframes sparkdraw { to { stroke-dashoffset: 0; } }

/* ── motion ────────────────────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@media (prefers-reduced-motion: reduce) { .rise, .spark .draw { animation: none; stroke-dashoffset: 0; } * { transition-duration: .01s !important; } }

/* ── the strip ─────────────────────────────────────────────────────────── */
/* Every screen, the sign-in screen's too, ends with a decorator 4px tall at the foot of the window: the four colours of the layers in equal parts,
   Atomic's orange, Backbone's purple, Canvas's green and Deed's ink. */
.deco { position: fixed; bottom: 0; left: 0; right: 0; height: 4px; display: flex; z-index: 400; }
.deco i { flex: 1 1 0; display: block; }
.deco i:nth-child(1) { background: var(--pa); } .deco i:nth-child(2) { background: var(--pb); } .deco i:nth-child(3) { background: var(--pc); } .deco i:nth-child(4) { background: var(--pd); }

/* ── toast and modal ───────────────────────────────────────────────────── */
.toasts { position: fixed; right: var(--padding); bottom: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
/* a toast floats over every screen, the sign-in screen's too, so all of its rules are here */
.toast { max-width: 560px; padding: 12px 16px; background: var(--z-overlay); border: 1px solid var(--th-hair); font: 400 14px/1.45 var(--body); animation: rise .35s var(--ease) both; pointer-events: auto; }
.toast .tmsg { display: flex; gap: 18px; align-items: baseline; justify-content: space-between; }
.toast code { display: block; margin-top: 6px; font: 500 12px/1.4 var(--mono); color: var(--th-fg-2); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .3s ease; }

/* what could not be read or drawn, said in its place with Try again (PortalUI.failed) */
.failed { max-width: 640px; margin: 20px 0; padding: 18px 20px; border: 1px solid var(--th-hair); background: var(--z-raised); }
.failed p { margin: 0 0 14px; font: 400 14px/1.5 var(--body); }
.failed .why { color: var(--th-fg-2); }
/* the API out of reach, said over every screen until it answers again (shared/login.js) */
.unreachable { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 350; display: flex; align-items: baseline; gap: 18px; max-width: min(640px, 92vw); padding: 12px 16px; background: var(--z-overlay); border: 1px solid var(--th-fg); font: 400 14px/1.45 var(--body); }
.unreachable .when { flex: none; color: var(--th-fg-3); }
.unreachable .btn { flex: none; }
.modal-back { position: fixed; inset: 0; z-index: 250; display: grid; place-items: start center; padding-top: 12vh; background: var(--scrim); animation: fade .2s ease both; }
.modal { width: min(560px, 92vw); max-height: 78vh; overflow: auto; padding: 28px 30px 26px; background: var(--th-bg); border: 1px solid var(--th-hair); animation: rise .35s var(--ease) both; }
.modal h3 { margin-bottom: 6px; }
.modal .acts { display: flex; gap: 26px; margin-top: 24px; align-items: center; }
.modal .acts .grow { flex: 1; }
