/* Chrono catalog pages: one black ground, the chrono-os-demo hub language
   (Montserrat fallback for Gotham, flat brand colour, square corners, yellow
   action) with Lucius tokens (focus accent, easing) from
   /static/vendor/lucius.css. Surfaces step up in tone, never by shadow or
   gradient; the content previews are the pictures. */
:root {
  --black: #000000;
  --white: #ffffff;
  --blue: #195faa;
  --yellow: #f0c11a;
  --red: #de2e34;
  --muted: #b9b9b9;
  --line: #2a2a2a;
  /* Resting field border and placeholder: 4.6:1 on black (WCAG 1.4.11). */
  --dim: #7a7a7a;
  --danger-bg: #1a0607;
  /* Tone steps for surfaces on the black ground. */
  --panel: #101010;
  --panel-hi: #1a1a1a;
  --f:
    "Gotham", "Proxima Nova", "Montserrat", system-ui, -apple-system,
    "Segoe UI", Roboto, Arial, sans-serif;
  --focus: rgb(var(--co-accent, 21 138 255));
  --ease: var(--co-ease, cubic-bezier(0.2, 0.8, 0.2, 1));
  --gap: clamp(16px, 2.2vw, 28px);
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--black);
}

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font: 400 16px/1.5 var(--f);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 0
    max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 6vw, 72px);
  min-height: 100vh;
  min-height: 100dvh;
}
@media (min-width: 640px) {
  .wrap {
    padding-inline: max(32px, env(safe-area-inset-left, 0px));
  }
}

main {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 48px);
  flex: 1;
  min-width: 0;
}

/* ------------------------------------------------------------ header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.top a {
  display: flex;
}
.top img {
  height: 32px;
  width: auto;
  display: block;
}
.who {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.who-email {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
  min-width: 0;
}

/* ------------------------------------------------------------ type */
.hero {
  display: grid;
  gap: 18px;
  padding-top: clamp(8px, 3vw, 40px);
}
h1 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-size: clamp(40px, 6vw, 80px);
  margin: 0;
  max-width: 16ch;
}
.lead {
  font-size: clamp(17px, 1.6vw, 21px);
  max-width: 58ch;
  margin: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.wrap-any {
  overflow-wrap: anywhere;
  min-width: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
p {
  margin: 0;
}

/* The library hero: the title set large, copy left, a brand symbol cluster
   right (decoration one side, text the other; never behind the text). */
.hero-library {
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  padding-top: clamp(8px, 2vw, 24px);
}
.hero-library .hero-copy {
  display: grid;
  gap: clamp(18px, 2vw, 28px);
  min-width: 0;
}
.hero-library h1 {
  font-size: clamp(48px, 10vw, 148px);
  letter-spacing: -0.045em;
  line-height: 0.92;
  max-width: 9ch;
}
.hero-library .lead {
  font-size: clamp(18px, 1.9vw, 24px);
  max-width: 34ch;
}
.hero-symbols {
  display: none;
}
@media (min-width: 760px) {
  .hero-library {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--gap);
  }
  .hero-symbols {
    display: block;
    width: clamp(160px, 22vw, 300px);
    height: auto;
  }
}

/* ------------------------------------------------------------ controls */
a {
  color: var(--white);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.notice[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  background: var(--yellow);
  color: var(--black);
  border: 0;
  font-weight: 700;
  text-decoration: none;
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.cta:hover {
  background: var(--white);
}
.cta:disabled {
  opacity: 0.6;
  cursor: progress;
}
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--white);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease),
    color 160ms var(--ease);
}
.btn:hover {
  background: var(--yellow);
  border-color: var(--yellow);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn-quiet {
  background: transparent;
  color: var(--white);
}
.btn-quiet:hover {
  background: var(--white);
  border-color: var(--white);
  color: var(--black);
}
.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}
.btn-danger:hover {
  background: var(--white);
  border-color: var(--white);
  color: var(--black);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field label {
  font-size: 14px;
  font-weight: 700;
}
input[type="text"],
input[type="email"],
input[type="date"],
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--black);
  border: 2px solid var(--dim);
  border-radius: 0;
  font-size: 16px; /* 16px keeps iOS from zooming the page on focus */
}
input[type="text"]:hover,
input[type="email"]:hover,
input[type="date"]:hover,
select:hover {
  border-color: var(--muted);
}
input::placeholder {
  color: var(--dim);
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--red);
}

/* A checkbox and its label on one row; the error text sits under the label. */
.field.check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 12px;
}
.field.check label {
  font-size: 16px;
  padding-top: 1px;
  cursor: pointer;
}
.field.check .field-error {
  grid-column: 2;
}
/* Drawn checkbox: the native one is a dark grey box (under 3:1 on black). */
input[type="checkbox"] {
  appearance: none;
  display: grid;
  place-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  background: var(--black);
  border: 2px solid var(--dim);
  border-radius: 0;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease),
    border-color 160ms var(--ease);
}
input[type="checkbox"]:hover {
  border-color: var(--muted);
}
input[type="checkbox"]::before {
  content: "";
  width: 6px;
  height: 12px;
  margin-top: -3px;
  border: solid var(--black);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 120ms var(--ease);
}
input[type="checkbox"]:checked {
  background: var(--yellow);
  border-color: var(--yellow);
}
input[type="checkbox"]:checked::before {
  transform: rotate(45deg) scale(1);
}
@media (forced-colors: active) {
  input[type="checkbox"] {
    appearance: auto;
  }
}
input[type="checkbox"][aria-invalid="true"] {
  border-color: var(--red);
}
.field-error,
.row-error {
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  border-left: 4px solid var(--red);
  padding-left: 8px;
  overflow-wrap: anywhere;
}
.row-error:empty {
  display: none;
}
.hint {
  display: block;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--muted);
}

.notice {
  color: var(--white);
  border-left: 4px solid var(--red);
  padding: 8px 12px;
  max-width: 58ch;
}
#notice {
  border-left: 4px solid var(--red);
  padding: 12px 16px;
  background: var(--danger-bg);
  overflow-wrap: anywhere;
}
.status:empty {
  display: none;
}
.status {
  border-left: 4px solid var(--yellow);
  padding: 8px 12px;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ cards */
/* A card is a surface one tone step above the ground. */
.card {
  display: grid;
  gap: 14px;
  align-content: start;
  background: var(--panel);
  padding: clamp(20px, 2.4vw, 28px);
  min-width: 0;
}
.card h2 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.card p {
  color: var(--muted);
  max-width: 52ch;
}
.muted-card h2 {
  color: var(--muted);
}

.empty {
  display: grid;
  gap: 16px;
  justify-items: start;
  background: var(--panel);
  padding: clamp(24px, 4vw, 48px);
  color: var(--muted);
  font-size: 18px;
}

/* ------------------------------------------------------------ media */
/* The 16:9 frame of a preview, a thumbnail or the branded placeholder. */
.media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--panel-hi);
  min-width: 0;
}
.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}
.ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.ph-blue {
  background: var(--blue);
  color: var(--white);
}
.ph-red {
  background: var(--red);
  color: var(--white);
}
.ph-yellow {
  background: var(--yellow);
  color: var(--black);
}
.ph-mark {
  width: 18%;
  aspect-ratio: 743 / 810;
  background: currentColor;
  -webkit-mask: url("/static/hourglass-yellow.svg") center / contain no-repeat;
  mask: url("/static/hourglass-yellow.svg") center / contain no-repeat;
}
/* The kind of a library item, beside its Open affordance. */
.chip {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

/* ------------------------------------------------------------ library */
.gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
}
@media (min-width: 640px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gallery > :first-child {
    grid-column: 1 / -1;
  }
}
@media (min-width: 1000px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* One card, one link: the title link is stretched over the whole card, and
   the card draws the focus ring. */
.tile {
  position: relative;
  padding: 0;
  gap: 0;
  grid-template-rows: auto 1fr;
  transition: background-color 300ms var(--ease);
  animation: rise 700ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
.tile-body {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: clamp(20px, 2.2vw, 28px);
}
.tile-link {
  color: var(--white);
  text-decoration: none;
}
.tile-link::after {
  content: "";
  position: absolute;
  inset: 0;
}
/* The ring follows the stretched link over the whole card, so focus shows
   without :has(); with :has() the card draws the same ring on itself. */
.tile-link:focus-visible::after {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
.tile:has(.tile-link:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
.tile-summary {
  font-size: 16px;
}
/* The preview sits inset on the card like a print on a mat, so a dark
   screenshot never melts into the black ground. */
.tile > .media {
  margin: 10px 10px 0;
}
.tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
.tile-go {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-weight: 700;
  color: var(--yellow);
}
.tile-arrow {
  display: inline-block;
  transition: transform 300ms var(--ease);
}
.tile .media img {
  transition: transform 900ms var(--ease);
}
.tile:hover,
.tile:has(.tile-link:focus-visible) {
  background: var(--panel-hi);
}
.tile:hover .media img,
.tile:has(.tile-link:focus-visible) .media img {
  transform: scale(1.035);
}
.tile:hover .tile-arrow,
.tile:has(.tile-link:focus-visible) .tile-arrow {
  transform: translateX(6px);
}

/* The featured card: the picture large, the title beside it from 1000px. */
.card-feature h2 {
  font-size: clamp(28px, 3.6vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.card-feature .tile-summary {
  font-size: clamp(16px, 1.4vw, 19px);
}
@media (min-width: 1000px) {
  .card-feature {
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .card-feature > .media {
    margin: 10px 0 10px 10px;
  }
  .card-feature .tile-body {
    align-content: end;
    padding: clamp(28px, 3vw, 48px);
  }
}

/* Loading: the same grid, quiet blocks that breathe. */
.skeleton {
  background: var(--panel);
  display: grid;
}
.sk-media {
  aspect-ratio: 16 / 9;
  background: var(--panel-hi);
}
.sk-body {
  display: grid;
  gap: 12px;
  padding: clamp(20px, 2.2vw, 28px);
}
.sk-line {
  height: 22px;
  width: 70%;
  background: var(--panel-hi);
}
.sk-short {
  height: 14px;
  width: 45%;
}
.sk-media,
.sk-line {
  animation: breathe 1.6s ease-in-out infinite alternate;
}
@media (min-width: 1000px) {
  .skeleton-feature {
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    align-items: end;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}
@keyframes breathe {
  to {
    opacity: 0.45;
  }
}

/* ------------------------------------------------------------ dashboard */
.toolbar {
  display: grid;
  gap: 20px;
  background: var(--panel);
  padding: clamp(16px, 2vw, 24px);
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 16px;
}
.toolbar-end {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.toggle {
  display: flex;
  border: 2px solid var(--white);
  max-width: 100%;
}
.toggle button {
  background: transparent;
  border: 0;
  font: 700 14px/1 var(--f);
  padding: 12px 14px;
  min-height: 44px;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease),
    color 160ms var(--ease);
}
.toggle button[aria-pressed="true"] {
  background: var(--white);
  color: var(--black);
}

/* Totals of the items shown: the numbers set large. */
.overview {
  display: grid;
  gap: 12px;
}
.totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
}
@media (min-width: 760px) {
  .totals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.total {
  display: grid;
  gap: 6px;
  align-content: start;
  background: var(--panel);
  padding: clamp(16px, 2vw, 24px);
  min-width: 0;
}
.total dt {
  font-size: 14px;
  color: var(--muted);
}
.total dd {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.total:nth-child(2) dd {
  color: var(--yellow);
}

/* One item per row: its preview left, its numbers and links right. */
.item-list {
  display: grid;
  gap: var(--gap);
}
.item {
  gap: 20px;
}
.item-body {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}
@media (min-width: 768px) {
  .item {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}
@media (min-width: 1100px) {
  .item {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}
.muted-card .media {
  opacity: 0.45;
  filter: grayscale(1);
}

.meta,
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 14px;
  min-width: 0;
}
/* Every meta item carries its own dot in a 20px left gutter; the list is
   shifted 20px left and clipped there, so the dot of an item that starts a
   line is cut off and no separator ever dangles at a line start. */
.meta {
  gap: 4px 0;
  margin-left: -20px;
  clip-path: inset(0 0 0 20px);
}
.meta li {
  position: relative;
  padding-left: 20px;
  min-width: 0;
}
.meta li::before {
  content: "\00B7";
  position: absolute;
  left: 0;
  width: 20px;
  text-align: center;
  color: var(--muted);
}
.tags {
  gap: 8px;
}
.tags li {
  background: var(--panel-hi);
  padding: 2px 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  white-space: nowrap;
}
.badge-warn {
  background: var(--yellow);
  color: var(--black);
}
.badge-off {
  background: var(--line);
  color: var(--white);
}
.badge-live {
  background: var(--blue);
  color: var(--white);
}
.badge-alert {
  background: var(--yellow);
  color: var(--black);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 16px;
  margin: 0;
}
.stat {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}
.stat dt,
.mini-stats dt {
  font-size: 13px;
  color: var(--muted);
}
.stat dd {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat dd.none {
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}
.stat dd .hint {
  margin-top: 4px;
}
.bar {
  display: block;
  height: 4px;
  margin-top: 6px;
  background: var(--line);
}
.bar-fill {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: var(--yellow);
}
.open-link {
  font-size: 14px;
  color: var(--muted);
}
.open-link:hover {
  color: var(--white);
}

/* ------------------------------------------------------------ share links */
.links {
  border-top: 2px solid var(--line);
  padding-top: 12px;
  min-width: 0;
}
.links summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.links[open] summary {
  margin-bottom: 12px;
}
.links > * + * {
  margin-top: 20px;
}
.link-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 12px;
  /* start, not end: a field error under one input must not shift the others. */
  align-items: start;
}
.link-form .field.check {
  grid-column: 1 / -1;
}
.link-form .field.check label {
  font-size: 15px;
  font-weight: 400;
}
.link-list {
  list-style: none;
  margin: 20px 0 0; /* same gap as .links > * + * (this rule would reset it) */
  padding: 0;
  display: grid;
  gap: 16px;
}
.link-row {
  display: grid;
  gap: 10px;
  border-left: 2px solid var(--white);
  padding-left: 12px;
  min-width: 0;
}
.link-row.revoked,
.link-row.expired {
  border-left-color: var(--line);
}
.link-row.revoked strong,
.link-row.expired strong {
  color: var(--muted);
}
.link-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}
.link-head .badges {
  flex-shrink: 0;
  justify-content: flex-end;
}
.link-row p {
  color: var(--white);
}
.link-row p.muted {
  color: var(--muted);
}
.url-field {
  font-size: 14px !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px 12px;
  margin: 0;
}
.mini-stats dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.confirm {
  flex-basis: 100%;
}

/* Named viewers of a link (gate consents). */
.viewers {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.viewers h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.viewer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.viewer-list > li {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  min-width: 0;
}
.viewer-email {
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ gate */
.gate {
  max-width: 600px;
  gap: 20px;
}
.gate .actions {
  padding-top: 4px;
}
.gate .consent-notice {
  color: var(--muted);
  max-width: 58ch;
}
#gate-errors {
  background: var(--danger-bg);
  display: grid;
  gap: 4px;
  padding: 12px 16px;
}

/* ------------------------------------------------------------ footer */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 28px 40px;
  border-top: 2px solid var(--line);
  color: var(--muted);
}
.foot img {
  height: 24px;
  width: auto;
  display: block;
}

/* Reduced motion: no travel, no zoom, no breathing; content stays. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  .tile:hover .media img,
  .tile:has(.tile-link:focus-visible) .media img,
  .tile:hover .tile-arrow,
  .tile:has(.tile-link:focus-visible) .tile-arrow {
    transform: none;
  }
}
