/* Habit Duo — risograph duotone. One ink per person; overlaps overprint. */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500&display=swap');

:root {
  --paper: #e8e8e2;
  --surface: #fbfbf7;
  --ink: #16181c;
  --muted: #85867e;
  --line: #d2d2c8;

  --p1: #0f5fd8;
  --p2: #e0417a;

  --display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --gap: 1rem;
  --radius: 3px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  /* faint paper tooth */
  background-image: radial-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px);
  background-size: 4px 4px;
}

.wrap {
  width: min(680px, 100% - 2rem);
  margin-inline: auto;
  padding-block: 1.25rem 5rem;
}

/* ---------------------------------------------------------------- header */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  padding-bottom: 0.75rem;
  border-bottom: 1.5px solid var(--ink);
  margin-bottom: 1.5rem;
}

.mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 0;
}

.mark span { font-weight: 500; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.nav a { color: var(--ink); text-decoration: none; border-bottom: 1.5px solid var(--ink); }
.nav a:hover { color: var(--p1); border-color: var(--p1); }

.nav button {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.nav button:hover { color: var(--ink); }

.whoami {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  color: var(--surface);
}
.whoami.p1 { background: var(--p1); }
.whoami.p2 { background: var(--p2); }

/* ------------------------------------------------------------ add habit */

.composer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

input[type='text'],
input[type='password'] {
  flex: 1 1 12rem;
  min-width: 0;
  font: inherit;
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
}

input::placeholder { color: var(--muted); }

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2.5px solid var(--p1);
  outline-offset: 2px;
}

.scope {
  display: flex;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.scope button {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 0.75rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.scope button[aria-pressed='true'] { background: var(--ink); color: var(--surface); }

.btn {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.7rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
}
.btn:hover { background: var(--p1); border-color: var(--p1); }

/* ---------------------------------------------------------- habit cards */

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }

.habit {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}

.habit-text { flex: 1; min-width: 0; }

.habit-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.habit-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remove {
  font: inherit;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.remove:hover { color: var(--p2); }

/* the signature: two stamps that overprint where they overlap */

.lanes { display: flex; flex-shrink: 0; }
.lanes .stamp + .stamp { margin-left: -9px; }

.stamp {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.stamp.p1 { color: var(--p1); }
.stamp.p2 { color: var(--p2); }

.stamp[aria-pressed='true'] {
  background: currentColor;
  transform: rotate(-4deg);
  mix-blend-mode: multiply;
}

.stamp[aria-pressed='true'] .glyph { color: var(--surface); }
.stamp .glyph { color: currentColor; }

.stamp[disabled] { cursor: default; opacity: 0.65; }
.stamp:not([disabled]):hover { transform: scale(1.06); }

/* ------------------------------------------------------------- streaks */

.streak-card {
  padding: 1rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
}

.streak-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: 0.85rem;
}

.tallies { display: flex; gap: 1.25rem; }

.tally { text-align: right; }

.tally .num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.tally.p1 .num { color: var(--p1); }
.tally.p2 .num { color: var(--p2); }

.tally .label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* the ribbon: one column per day, split top/bottom between the two people */

.ribbon {
  display: grid;
  grid-template-columns: repeat(28, 1fr);
  gap: 2px;
  height: 34px;
}

.day {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  border-radius: 1px;
}

.half { background: rgba(0, 0, 0, 0.055); border-radius: 1px; }
.half.on { mix-blend-mode: multiply; }
.half.on.p1 { background: var(--p1); }
.half.on.p2 { background: var(--p2); }
.half.solo { grid-row: span 2; }

.ribbon-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.4rem;
}

.legend {
  display: flex;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.legend b { font-weight: 500; }
.legend .swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 1px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.legend .swatch.p1 { background: var(--p1); }
.legend .swatch.p2 { background: var(--p2); }

/* --------------------------------------------------------------- states */

.empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.notice {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--p2);
  min-height: 1.2rem;
  margin-bottom: 0.75rem;
}

/* ---------------------------------------------------------------- login */

.gate { max-width: 22rem; margin: 12vh auto 0; }
.gate h1 { font-family: var(--display); font-size: 2.1rem; letter-spacing: -0.03em; margin: 0 0 0.25rem; }
.gate p { color: var(--muted); margin: 0 0 1.5rem; }
.gate form { display: grid; gap: 0.6rem; }
.gate .btn { width: 100%; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- phone */

@media (max-width: 480px) {
  .habit { padding: 0.75rem 0.8rem; gap: 0.6rem; }
  .stamp { width: 44px; height: 44px; }
  .composer input[type='text'] { flex-basis: 100%; }
  .scope { flex: 1; }
  .scope button { flex: 1; padding: 0.7rem 0.5rem; }
  .tallies { gap: 0.9rem; }
  .tally .num { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .stamp[aria-pressed='true'] { transform: none; }
}
