/* Codex Resets
   Visual thesis: an ink-on-paper ledger for a terminal-native audience.
   Newspaper-masthead double rule, hairline-ruled sections instead of cards,
   serif prose set against monospace data readouts, an ink-density signal:
   reset days darken toward pure black. Light only, system font stacks only. */

:root {
  color-scheme: light;

  --paper: #f7f7f5;
  --ink: #141414;
  --ink-2: #4b4b49;
  --ink-3: #616160;
  --rule: rgba(20, 20, 20, 0.16);
  --rule-soft: rgba(20, 20, 20, 0.09);

  --accent: #141414;
  --accent-deep: #141414;

  /* Binary marks: a day either had a reset or it didn't. */
  --cg-empty: #e9e9e6;
  --cg-fill: #1c1c1a;

  --font-serif: "Charter", "Iowan Old Style", "Palatino", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --cell-size: 22px;
  --measure: 58ch;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: rgba(20, 20, 20, 0.3);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

a:hover,
a:focus-visible {
  text-decoration-color: currentColor;
}

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

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

/* ---------------------------------------------------------------------- */
/* Masthead: newspaper-style title row over a double rule                  */
/* ---------------------------------------------------------------------- */
.masthead {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 36px 0 14px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}

.masthead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  border-bottom: 1px solid var(--ink);
}

.masthead-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(26px, 4.5vw, 34px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1;
}

.masthead-side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
}

.live-flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.cursor-block {
  width: 7px;
  height: 12px;
  background: var(--accent);
  animation: cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes cursor-blink {
  to { visibility: hidden; }
}

.demo-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  border: 1px solid var(--accent-deep);
  padding: 2px 7px;
  border-radius: 2px;
}

/* ---------------------------------------------------------------------- */
/* Hero: explainer, big readout, stat ledger                               */
/* ---------------------------------------------------------------------- */
.hero {
  padding: 34px 0 0;
}

.hero-explainer {
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 17px;
  margin: 0 0 44px;
}

.hero-headline {
  padding: 0;
  border: none;
}

.hero-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.hero-figure {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(42px, 8vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  /* Monospace gives the space glyph a full character cell, which reads as a
     canyon between words at display size. Pull it back toward a normal word gap. */
  word-spacing: -0.3em;
  color: var(--ink);
  cursor: default;
}

.hero-figure--muted {
  color: var(--ink-2);
  font-size: clamp(26px, 5vw, 40px);
}

.hero-sub {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
  cursor: default;
}

/* Stat ledger: one ruled strip, hairline column separators, no cards */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 40px 0 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.stat-tile {
  padding: 16px 22px 18px;
  border-left: 1px solid var(--rule-soft);
}

.stat-tile:first-child {
  padding-left: 0;
  border-left: none;
}

.stat-tile dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
}

.stat-label-short {
  display: none;
}

.stat-tile dd {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------- */
/* Section headings, shared                                                */
/* ---------------------------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.section-sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.graph-section {
  padding: 48px 0 40px;
}

.log-section {
  padding: 40px 0 8px;
  border-top: 1px solid var(--rule);
}

/* ---------------------------------------------------------------------- */
/* Contribution graph                                                      */
/* ---------------------------------------------------------------------- */
.cg-container {
  display: flex;
  gap: 8px;
  max-width: 100%;
  position: relative;
}

.cg-weekdays {
  flex: none;
  display: grid;
  row-gap: 4px;
  column-gap: 4px;
}

.cg-weekday {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
}

.cg-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  max-width: 100%;
  scrollbar-width: thin;
}

.cg-grid {
  display: grid;
  row-gap: 4px;
  column-gap: 4px;
  position: relative;
}

.cg-month {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  align-self: start;
}

.cg-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 2px;
  background: var(--cg-empty);
  border: none;
  padding: 0;
  cursor: pointer;
}

.cg-cell:hover,
.cg-cell:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 1px var(--ink),
    inset 0 0 0 3px var(--paper);
}

.cg-cell--future {
  background: transparent;
  cursor: default;
}

.cg-cell--future:hover {
  outline: none;
  box-shadow: none;
}

.cg-cell[data-level="0"] { background: var(--cg-empty); }
.cg-cell[data-level="1"] { background: var(--cg-fill); }




.cg-tooltip {
  position: absolute;
  /* Absolutely positioned boxes shrink to the space between `left` and the
     container's right edge; near the right edge that collapses the tooltip
     to one word per line. Size to content instead. */
  width: max-content;
  transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 3px;
  max-width: 260px;
  pointer-events: none;
  z-index: 10;
  white-space: normal;
}

.cg-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}

.cg-tooltip-snippet {
  font-family: var(--font-serif);
  opacity: 0.8;
}

/* ---------------------------------------------------------------------- */
/* Event log: ledger rows, mono timestamp column, serif entry text         */
/* ---------------------------------------------------------------------- */
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log-item {
  display: grid;
  grid-template-columns: 36px 148px 1fr;
  grid-template-areas:
    "avatar meta text"
    "avatar meta link";
  column-gap: 16px;
  row-gap: 6px;
  padding: 20px 0;
  border-top: 1px solid var(--rule-soft);
}

.log-avatar {
  grid-area: avatar;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  display: block;
}

.log-item:first-child {
  border-top: none;
  padding-top: 4px;
}

.log-item-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-item-time {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.log-item-abs {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.log-item-text {
  grid-area: text;
  margin: 0;
  font-size: 16.5px;
  color: var(--ink);
  max-width: var(--measure);
}

.log-item-link {
  grid-area: link;
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 12px;
}

.log-empty {
  color: var(--ink-3);
  font-size: 16.5px;
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                  */
/* ---------------------------------------------------------------------- */
.site-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.site-footer p {
  margin: 0 0 6px;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root {
    --cell-size: 15px;
  }

  .page {
    padding: 0 16px 56px;
  }

  .masthead {
    padding-top: 26px;
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .masthead-side {
    margin-left: auto;
  }

  .hero-explainer {
    margin-bottom: 34px;
  }

  .section-head {
    flex-direction: column;
    gap: 4px;
  }

  .stat-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-tile {
    padding: 12px 8px 14px;
    border-left: 1px solid var(--rule-soft);
    border-top: none;
  }

  .stat-tile:first-child {
    padding-left: 0;
    border-left: none;
  }

  .stat-tile dt {
    font-size: 9px;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .stat-label-full {
    display: none;
  }

  .stat-label-short {
    display: inline;
  }

  .stat-tile dd {
    font-size: 20px;
  }

  .log-item {
    grid-template-columns: 36px 1fr;
    grid-template-areas:
      "avatar meta"
      "text text"
      "link link";
    align-items: center;
    row-gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-block {
    animation: none;
  }
}
