/* Field notebook — cream paper, ink, thin lines. Not a clinic desk. */
:root {
  --paper: #f3ead8;
  --paper-deep: #ebe1c8;
  --ink: #161412;
  --ink-soft: #3c3832;
  --ink-mute: #7a7368;
  --dot: #cbbfa4;
  --rule: rgba(22, 20, 18, 0.18);
  --wash-1: #e4d9be;
  --wash-2: #c4b48a;
  --wash-3: #7d6e48;
  --wash-4: #2c2618;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 0.7px, transparent 0.8px);
  background-size: 16px 16px;
  background-attachment: fixed;
}

#app {
  max-width: 42rem;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 1.1rem 1.15rem 4rem;
  padding-left: max(1.15rem, env(safe-area-inset-left));
  padding-right: max(1.15rem, env(safe-area-inset-right));
  padding-bottom: max(4rem, env(safe-area-inset-bottom));
  touch-action: pan-y;
}

.mast {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}

#date-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.35rem, 5.2vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-align: center;
  flex: 1;
  font-optical-sizing: auto;
}

.nav-btn {
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.65rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  opacity: 0.55;
  flex-shrink: 0;
}
.nav-btn:hover,
.nav-btn:focus-visible { opacity: 1; outline: none; }

.jump-today {
  appearance: none;
  display: block;
  margin: 0 auto 0.55rem;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0 0 0.05rem;
  opacity: 0.7;
}

.heat-wrap {
  margin: 0.55rem 0 1.15rem;
}

.heat-label {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.35rem;
}

.heat-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 3px;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  text-align: center;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.heat-cell {
  aspect-ratio: 1;
  border: 1px solid var(--rule);
  background: transparent;
  cursor: pointer;
  padding: 0;
  min-height: 0;
}
.heat-cell.empty {
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}
.heat-cell.l1 { background: var(--wash-1); }
.heat-cell.l2 { background: var(--wash-2); }
.heat-cell.l3 { background: var(--wash-3); }
.heat-cell.l4 { background: var(--wash-4); border-color: var(--ink); }
.heat-cell.today {
  outline: 1px solid var(--ink);
  outline-offset: 0;
}
.heat-cell.selected {
  box-shadow: inset 0 0 0 1px var(--ink);
}
.heat-cell:focus-visible { outline: 1px solid var(--ink); outline-offset: 1px; }

.page {
  min-height: 50dvh;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.list {
  list-style: none;
}

.item {
  display: grid;
  grid-template-columns: 1.6rem 1fr 1.4rem;
  align-items: start;
  gap: 0.15rem 0.35rem;
  border-bottom: 1px solid var(--rule);
  min-height: 2.05rem;
  padding: 0.22rem 0 0.28rem;
}

.glyph {
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.5;
  width: 1.6rem;
  height: 1.6rem;
  cursor: pointer;
  text-align: center;
  padding: 0;
}
.glyph:focus-visible { outline: 1px solid var(--ink); }

.item[data-type="task"] .glyph { font-size: 1.12rem; }
.item[data-type="event"] .glyph { font-size: 0.82rem; letter-spacing: 0; }
.item[data-type="note"] .glyph { font-size: 1.2rem; }

.text {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  min-height: 1.5em;
  outline: none;
  word-break: break-word;
  padding: 0.12rem 0 0;
  color: var(--ink);
}
.text:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-mute);
  font-weight: 300;
  pointer-events: none;
}
.item.is-done .text {
  color: var(--ink-mute);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.del {
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink-mute);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.5;
  width: 1.4rem;
  height: 1.6rem;
  cursor: pointer;
  opacity: 0;
  padding: 0;
}
.item:hover .del,
.item:focus-within .del { opacity: 0.7; }
.del:hover,
.del:focus-visible { opacity: 1; color: var(--ink); outline: none; }

.item.composer .del { visibility: hidden; }

.swiping .page {
  transition: none;
}

@media (min-width: 640px) {
  #app { padding-top: 2rem; }
  .heatmap { gap: 4px; }
  .heat-weekdays { gap: 4px; }
}
