:root {
  color-scheme: dark;
  --background: #0c1017;
  --surface: #111722;
  --surface-soft: #151c28;
  --surface-raised: #192230;
  --foreground: #f5f7fa;
  --muted: #8f9baa;
  --muted-strong: #b3bdc9;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #9cb9e7;
  --accent-strong: #d6e4fb;
  --accent-soft: rgba(134, 169, 222, 0.12);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  --heat-0: rgba(255, 255, 255, 0.045);
  --heat-1: rgba(214, 228, 251, 0.2);
  --heat-2: rgba(191, 215, 249, 0.4);
  --heat-3: rgba(164, 197, 243, 0.68);
  --heat-4: #d6e4fb;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f0f3f7;
  --surface-raised: #e8edf4;
  --foreground: #18202b;
  --muted: #657181;
  --muted-strong: #465363;
  --border: rgba(24, 32, 43, 0.11);
  --border-strong: rgba(24, 32, 43, 0.17);
  --accent: #31578e;
  --accent-strong: #203e68;
  --accent-soft: rgba(49, 87, 142, 0.09);
  --shadow: 0 24px 65px rgba(40, 52, 70, 0.12);
  --heat-0: rgba(24, 32, 43, 0.055);
  --heat-1: rgba(49, 87, 142, 0.2);
  --heat-2: rgba(49, 87, 142, 0.4);
  --heat-3: rgba(49, 87, 142, 0.68);
  --heat-4: #254a7c;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

.page-grid {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    radial-gradient(circle at 78% -10%, var(--accent-soft), transparent 36rem);
  background-size:
    64px 64px,
    64px 64px,
    auto;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent 50%);
  opacity: 0.34;
}

.site-header {
  display: flex;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--foreground);
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark,
.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.brand-mark svg,
.icon-button svg,
.eyebrow svg,
.method-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.icon-button {
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.icon-button:active {
  transform: translateY(1px);
}

[data-theme="dark"] .moon-icon,
[data-theme="light"] .sun-icon {
  display: none;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 68px 0 48px;
}

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 570;
}

.eyebrow svg {
  width: 17px;
}

.period-nav {
  display: flex;
  max-width: min(100%, 620px);
  padding: 4px;
  gap: 3px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
  scrollbar-width: none;
}

.period-nav::-webkit-scrollbar {
  display: none;
}

.period-nav button {
  min-height: 32px;
  padding: 0 13px;
  flex: none;
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  transition:
    color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.period-nav button:hover {
  color: var(--foreground);
}

.period-nav button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--foreground);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.14);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 72px;
  margin-top: 66px;
  padding-bottom: 62px;
  border-bottom: 1px solid var(--border);
  align-items: end;
}

.period-label,
.date-range,
.section-heading p,
.month-card small,
.site-footer span,
.method-card p {
  color: var(--muted);
}

.period-label {
  margin: 0 0 15px;
  font-size: 12px;
  font-weight: 570;
  letter-spacing: 0.01em;
}

h1 {
  margin: 0;
  font-size: clamp(54px, 7.5vw, 92px);
  line-height: 0.92;
  font-weight: 660;
  letter-spacing: -0.068em;
}

.date-range {
  margin: 22px 0 0;
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(94px, 1fr));
  min-width: 365px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.metrics div {
  padding: 22px 20px 20px;
}

.metrics div + div {
  border-left: 1px solid var(--border);
}

.metrics dt,
.month-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metrics dd {
  margin: 8px 0 0;
  font-size: 27px;
  font-weight: 630;
  letter-spacing: -0.04em;
}

.activity-panel,
.month-section {
  padding-top: 60px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.section-heading.compact {
  margin-bottom: 22px;
}

.section-kicker {
  margin: 0 0 7px;
  color: var(--accent) !important;
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 640;
  letter-spacing: -0.025em;
}

.section-heading p:not(.section-kicker) {
  margin: 5px 0 0;
  font-size: 12px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.legend i {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

[data-level="0"] {
  background: var(--heat-0);
}
[data-level="1"] {
  background: var(--heat-1);
}
[data-level="2"] {
  background: var(--heat-2);
}
[data-level="3"] {
  background: var(--heat-3);
}
[data-level="4"] {
  background: var(--heat-4);
}

.heatmap-scroll {
  padding: 25px 25px 22px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  scrollbar-color: var(--border-strong) transparent;
}

.heatmap {
  min-width: 820px;
}

.heatmap-head,
.heatmap-row {
  display: grid;
  grid-template-columns: 78px minmax(520px, 1fr) 62px 62px;
  gap: 16px;
  align-items: center;
}

.heatmap-head {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hour-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.heatmap-head > span:nth-last-child(-n + 2) {
  text-align: right;
}

#heatmap-days {
  display: grid;
  gap: 7px;
}

.heatmap-row {
  min-height: 29px;
}

.day-label,
.row-value {
  font-size: 11px;
}

.day-label {
  color: var(--muted-strong);
  font-weight: 560;
}

.row-value {
  color: var(--muted);
  text-align: right;
}

.row-value.emphasized {
  color: var(--foreground);
  font-weight: 620;
}

.hour-cells {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
}

.hour-cell {
  min-width: 8px;
  height: 27px;
  border-radius: 4px;
  outline: 1px solid transparent;
  transition:
    transform 120ms ease,
    outline-color 120ms ease;
}

.hour-cell:hover {
  z-index: 1;
  outline-color: var(--foreground);
  transform: scale(1.16);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.month-card {
  padding: 22px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.month-card:hover,
.month-card:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface);
  transform: translateY(-2px);
  outline: none;
}

.month-card-head,
.month-card dl {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.month-card-head span {
  display: block;
  font-size: 13px;
  font-weight: 610;
}

.month-card-head small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
}

.month-card-head strong {
  font-size: 25px;
  letter-spacing: -0.04em;
}

.month-bars {
  display: flex;
  height: 58px;
  margin: 25px 0 20px;
  gap: 3px;
  align-items: end;
}

.month-bars i {
  width: 100%;
  height: var(--bar);
  min-height: 3px;
  border-radius: 2px 2px 1px 1px;
  background: var(--accent);
  opacity: 0.72;
}

.month-card dl {
  margin: 0;
  padding-top: 17px;
  border-top: 1px solid var(--border);
}

.month-card dl div {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.month-card dd {
  margin: 0;
  font-size: 12px;
  font-weight: 620;
}

.method-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  max-width: 760px;
  margin-top: 58px;
  padding: 21px 23px;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--accent-soft);
}

.method-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
}

.method-icon svg {
  width: 17px;
}

.method-card h2 {
  font-size: 13px;
}

.method-card p {
  max-width: 660px;
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.65;
}

.site-footer {
  display: flex;
  margin-top: 66px;
  padding-top: 24px;
  gap: 28px;
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
}

.site-footer > div,
.footer-meta {
  display: flex;
  gap: 12px;
  align-items: center;
}

.site-footer strong {
  font-weight: 620;
}

.live-dot {
  color: var(--muted-strong) !important;
}

.live-dot i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #60c894;
  box-shadow: 0 0 0 4px rgba(96, 200, 148, 0.11);
}

.error-state {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  max-width: 360px;
  padding: 16px 18px;
  gap: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.error-state[hidden] {
  display: none;
}

.error-state span {
  color: var(--muted);
}

.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;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .shell {
    padding-top: 44px;
  }

  .intro,
  .hero {
    align-items: start;
  }

  .intro {
    flex-direction: column;
  }

  .period-nav {
    width: 100%;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 38px;
    margin-top: 48px;
  }

  .metrics {
    width: 100%;
    min-width: 0;
  }

  .month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    align-items: start;
  }

  .site-footer,
  .site-footer > div {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .site-header,
  .shell {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    padding: 18px 0;
  }

  .shell {
    padding-top: 32px;
  }

  .hero {
    margin-top: 40px;
    padding-bottom: 44px;
  }

  h1 {
    font-size: clamp(48px, 15vw, 66px);
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics div {
    display: flex;
    padding: 16px 18px;
    align-items: center;
    justify-content: space-between;
  }

  .metrics div + div {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .metrics dd {
    margin: 0;
    font-size: 21px;
  }

  .activity-panel,
  .month-section {
    padding-top: 46px;
  }

  .legend {
    display: none;
  }

  .heatmap-scroll {
    width: calc(100% + 14px);
    padding: 19px;
    border-radius: 15px 0 0 15px;
  }

  .month-grid {
    grid-template-columns: 1fr;
  }

  .method-card {
    margin-top: 44px;
  }

  .site-footer {
    margin-top: 48px;
    padding-bottom: 10px;
  }

  .footer-meta {
    flex-direction: column;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
