/* Celestial Time — paper studio. Tokens: DESIGN.md */

:root {
  --bg: #fafaf8;
  --bg-elevated: #ffffff;
  --ink: #14140f;
  --ink-muted: #5a5a56;
  --ink-soft: #8a8a84;
  --line: #ebebe6;
  --blush: #fccff6;
  --blush-deep: #e8a8de;
  --success: #1f6b4a;
  --danger: #a33b3b;
  --celestial-bg: var(--bg);
  --celestial-ink: var(--ink);
  --celestial-muted: var(--ink-muted);
  --celestial-accent: var(--ink);
  --celestial-font: "DM Sans", "Helvetica Neue", sans-serif;
  --celestial-font-display: "Outfit", "Helvetica Neue", sans-serif;
  --card: var(--bg-elevated);
  --inset: #f3f3ef;
  --radius: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-soft: 0 10px 30px rgba(20, 20, 15, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--celestial-ink);
  font-family: var(--celestial-font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  padding: 28px 24px 40px;
}

h1, p { text-wrap: balance; }
h2 { text-wrap: pretty; }

h1, h2 {
  font-family: var(--celestial-font-display);
  font-weight: 560;
  letter-spacing: -0.03em;
  margin: 0;
}

h1 { font-size: 20px; }
h2 { font-size: 22px; }

button, input, select { font: inherit; color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand, .top-tools { display: flex; align-items: center; gap: 10px; }
.top-tools { margin-left: auto; }

.orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 35% 30%, #fff 0 2px, #fccff6 30%, #7a3d78 72%, #140810 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 24px rgba(252, 207, 246, 0.28);
}

.orb-lg { width: 48px; height: 48px; }

.now {
  margin: 0;
  color: var(--celestial-muted);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who, .date-label, .hint, .score-note, .empty, .form-note, .breaks {
  margin: 0;
  color: var(--celestial-muted);
}

input[type="date"], .rules input, .rules select {
  height: 44px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
}

button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 0;
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition-property: transform, background-color;
  transition-duration: 250ms;
  transition-timing-function: var(--ease);
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.ghost {
  background: transparent;
  color: var(--celestial-ink);
  border: 1px solid var(--line);
}

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--blush-deep);
  outline-offset: 2px;
}

.gate {
  max-width: 420px;
  margin: 12vh auto 0;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.gate h2 { font-size: 28px; }

.board {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.score-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.score-card { grid-column: 1 / -1; }
.score-card, .panel { padding: 22px; }

.score-card {
  display: flex;
  align-items: flex-end;
  gap: 28px;
}

.score-copy { max-width: 360px; }

.eyebrow {
  margin: 0;
  color: var(--celestial-muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.focus {
  margin: 0;
  font-family: var(--celestial-font-display);
  font-size: 84px;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.score-note { font-size: 13px; margin-top: 8px; }

.work { margin-top: 16px; }
.work-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--celestial-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.work-head b { color: var(--celestial-ink); font-weight: 560; }
.work-track {
  margin-top: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--inset);
  border: 1px solid var(--line);
  overflow: hidden;
}
.work-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blush-deep);
  transition: width 250ms var(--ease);
}

.yt, .session p {
  margin: 8px 0 0;
  color: var(--celestial-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.session { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

.score-card, .panel {
  animation: rise 250ms var(--ease) both;
}
.board > :nth-child(2) { animation-delay: 80ms; }
.board > :nth-child(3) { animation-delay: 140ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.metrics {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
}

.metrics li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 16px;
  background: var(--inset);
  font-variant-numeric: tabular-nums;
}

.metrics li[data-kind="deep"] { border-left-color: var(--ink); }
.metrics li[data-kind="growth"] { border-left-color: var(--success); }
.metrics li[data-kind="meeting"] { border-left-color: var(--ink-muted); }
.metrics li[data-kind="distraction"] { border-left-color: var(--danger); }
.metrics li[data-kind="system"] { border-left-color: #3d5a73; }
.metrics li[data-kind="neutral"] { border-left-color: var(--ink-soft); }

.metrics b { font-weight: 560; }

.breaks { margin-top: 14px; font-variant-numeric: tabular-nums; }

.toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
  padding: 14px 8px 14px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  animation: toast-in 420ms var(--ease) both;
}

.toast.is-leaving { animation: toast-out 160ms ease-in both; }

.toast h2 {
  font-size: 16px;
  text-wrap: balance;
}

.toast p {
  margin: 2px 0 0;
  color: var(--celestial-muted);
  font-size: 13px;
  text-wrap: pretty;
}

button.toast-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--celestial-ink);
  font-size: 22px;
  line-height: 1;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-4px); }
}

.panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-head h2 { white-space: nowrap; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--celestial-muted);
  font-size: 12px;
}

.legend li { display: flex; align-items: center; gap: 6px; }

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  display: inline-block;
}

.swatch-code { background: var(--ink); }
.swatch-design { background: #8a7344; }
.swatch-meeting { background: var(--ink-muted); }
.swatch-message { background: var(--ink-soft); }
.swatch-growth { background: var(--success); }
.swatch-system { background: #3d5a73; }
.swatch-distraction { background: var(--danger); }

.axis-hours {
  display: flex;
  justify-content: space-between;
  color: var(--celestial-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.axis-track {
  position: relative;
  height: 28px;
  border-radius: 99px;
  background: var(--inset);
  border: 1px solid var(--line);
  overflow: hidden;
}

.seg {
  position: absolute;
  top: 0;
  bottom: 0;
}

.seg-code,
.seg-documents { background: var(--ink); }
.seg-growth { background: var(--success); }
.seg-design { background: #8a7344; }
.seg-video_conferencing { background: var(--ink-muted); }
.seg-system { background: #3d5a73; }
.seg-distraction { background: var(--danger); }
.seg-miscellaneous,
.seg-messaging,
.seg-music,
.seg-email { background: var(--ink-soft); }

.apps-title {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--celestial-muted);
  font-weight: 500;
  letter-spacing: 0;
}
.apps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.apps li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.table-wrap { overflow: auto; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th, td {
  text-align: left;
  padding: 11px 10px 11px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}

th {
  color: var(--celestial-muted);
  font-size: 12px;
  font-weight: 500;
}

td.title {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody td {
  transition-property: background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

tbody tr:hover td { background: #f7f4f2; }

button.project-chip {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--celestial-ink);
  border: 1px solid var(--line);
  font-weight: 500;
}

button.project-chip.is-empty { color: var(--celestial-muted); }

.project-input {
  height: 40px;
  min-width: 148px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--inset);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink);
}

.pill-code,
.pill-documents { color: var(--ink); }
.pill-system { color: #3d5a73; }
.pill-growth { color: var(--success); }
.pill-distraction { color: var(--danger); }

.rules { display: grid; gap: 6px; }
.rules .hint { margin-bottom: 8px; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.rules button { justify-self: start; margin-top: 8px; }

@media (max-width: 980px) {
  .board { grid-template-columns: 1fr; }
  .score-card { flex-direction: column; align-items: stretch; }
  .metrics { margin-left: 0; grid-template-columns: 1fr 1fr; }
  .score-card { align-items: stretch; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .top { flex-wrap: wrap; }
  .focus { font-size: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  button, .work-track i, tbody td { transition: none; }
  .score-card, .panel, .toast { animation: none; }
}
