/* Noticed — prototype
   Design intent: a field notebook, not an app. The chrome should be nearly
   absent so the noticing is the only thing with weight on the page.
   No webfonts: offline-first and opens-fast are product decisions, and a font
   download fights both. Apple's native serifs carry the character instead. */

:root {
  --paper:        #f4f1ea;
  --paper-sunk:   #ebe7dd;
  --rule:         #ddd7c9;
  --ink:          #22242a;
  --ink-soft:     #5d6068;
  --ink-faint:    #8b8d94;
  --accent:       #55694a;  /* lichen */
  --accent-soft:  #e6ebe1;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --gap: 1.5rem;
  --radius: 3px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #14161a;
    --paper-sunk:  #1b1e23;
    --rule:        #2b2f36;
    --ink:         #e8e6e1;
    --ink-soft:    #a3a7ae;
    --ink-faint:   #71757c;
    --accent:      #9db98c;
    --accent-soft: #222a1f;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Home Screen web apps run under the notch; respect the safe area. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  max-width: 34rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

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

:where(button, textarea, label, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ---------- Prompt ---------- */

.prompt-label {
  font-size: .6875rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 .5rem;
}

.prompt {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  line-height: 1.28;
  letter-spacing: -.01em;
  margin: 0 0 2rem;
  text-wrap: balance;
  animation: settle .5s var(--ease) both;
}

/* ---------- Mode switch ---------- */

.modes {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
}

.mode {
  flex: 1;
  font: inherit;
  font-size: .8125rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .5rem .25rem;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease);
}

.mode[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Capture stage ---------- */

.stage { position: relative; }

.pane { animation: fade .28s var(--ease) both; }
.pane[hidden] { display: none; }

.capture-btn,
.photo-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  min-height: 9.5rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .16s var(--ease), background .16s var(--ease);
}

.capture-btn:active,
.photo-drop:active { transform: scale(.985); background: var(--accent-soft); }

.capture-btn-mark,
.photo-drop-mark {
  width: 1.75rem; height: 1.75rem;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  transition: background .16s var(--ease);
}

.capture-btn:active .capture-btn-mark { background: var(--accent); }

.capture-btn-label,
.photo-drop-label {
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink-soft);
}

/* saved state — a settle, not a celebration */
.capture-btn.saved { background: var(--accent-soft); }
.capture-btn.saved .capture-btn-mark { background: var(--accent); }

textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .875rem;
  resize: none;
}
textarea::placeholder { color: var(--ink-faint); }

.save {
  display: block;
  width: 100%;
  margin-top: .5rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--paper);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: .75rem;
  cursor: pointer;
}

.ack {
  min-height: 1.25rem;
  margin: .75rem 0 0;
  font-size: .8125rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.ack.show { opacity: 1; }

/* ---------- Walk wrap-up ----------
   The line rows are the preview: what he edits is literally what gets copied,
   so there is no second place for the description to disagree with itself. */

.walk-hint {
  margin: .5rem 0 .75rem;
  font-size: .75rem;
  color: var(--ink-faint);
}

.tally {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  animation: rise .34s var(--ease) both;
}

.tally-h {
  margin: 0 0 .75rem;
  font-size: .75rem;
  color: var(--ink-faint);
}

.tally-line {
  display: flex;
  flex-direction: column;
  gap: .125rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule);
}

/* The label and its controls, always one line. */
.tally-head {
  display: flex;
  align-items: baseline;
  gap: .375rem;
}

.tally-line :is(input, textarea) {
  font: inherit;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: .125rem 0;
  min-width: 0;
  resize: none;
}
.tally-line :is(input, textarea):focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.tally-label { flex: 0 1 auto; min-width: 4rem; }

.tally-colon { color: var(--ink-faint); margin-left: -.375rem; }

.tally-spacer { flex: 1; }

.tally-value {
  width: 100%;
  overflow: hidden;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

/* The parenthetical is his own aside, so it reads quieter than the tally. */
.tally-aside-wrap {
  flex: 1 1 100%;
  display: flex;
  align-items: baseline;
  gap: .0625rem;
  padding-left: .25rem;
  color: var(--ink-faint);
}
.tally-aside-wrap::before { content: '('; }
.tally-aside-wrap::after  { content: ')'; }
.tally-aside-wrap.empty::before,
.tally-aside-wrap.empty::after { opacity: .35; }

.tally-aside {
  flex: 0 1 auto;
  max-width: 100%;
  color: var(--ink-soft);
  font-size: .9375rem !important;
}
.tally-aside::placeholder { color: var(--ink-faint); font-style: italic; }

/* Unresolved: the parser kept his words rather than guessing. Marked so the
   correction is invited, not so the line looks like an error. */
.tally-line.unresolved .tally-label {
  border-bottom-style: dashed;
  border-bottom-color: var(--rule);
}

/* Offered, not urged: the default shape is usually right. */
.tally-shape {
  flex: none;
  font: inherit;
  font-size: .6875rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .1875rem .4375rem;
  cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.tally-shape:hover { color: var(--accent); border-color: var(--accent); }

.tally-drop {
  flex: none;
  font: inherit;
  font-size: .875rem;
  line-height: 1;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: .25rem .375rem;
  cursor: pointer;
  opacity: .5;
}
.tally-drop:hover { opacity: 1; color: var(--ink); }

.tally-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}
.tally-actions .save { margin-top: 0; flex: 1; }

/* ---------- Handoff ---------- */

.handoff {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.handoff-lede {
  margin: 0 0 .75rem;
  font-size: .875rem;
  color: var(--ink-soft);
}

.handoff-links { display: flex; flex-wrap: wrap; gap: .5rem; }

.handoff-links a {
  font-size: .875rem;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .4375rem .75rem;
}

/* ---------- Archive ---------- */

.archive { margin-top: 2.5rem; }

.section-h {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1rem;
}

.day-h {
  font-size: .75rem;
  color: var(--ink-faint);
  margin: 1.5rem 0 .5rem;
}
.day-h:first-child { margin-top: 0; }

.entry {
  display: flex;
  gap: .875rem;
  padding: .625rem 0;
  border-bottom: 1px solid var(--rule);
  animation: rise .34s var(--ease) both;
}

.entry-time {
  flex: none;
  width: 4rem;
  font-size: .75rem;
  color: var(--ink-faint);
  padding-top: .1875rem;
  font-variant-numeric: tabular-nums;
}

.entry-body { flex: 1; min-width: 0; }

.entry-text {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: break-word;
}
.entry-text.bare { color: var(--ink-faint); font-style: italic; }

.entry-prompt {
  margin: .25rem 0 0;
  font-size: .75rem;
  color: var(--ink-faint);
}

.entry img {
  display: block;
  width: 100%;
  max-width: 13rem;
  border-radius: var(--radius);
  margin-top: .375rem;
}

.entry-del {
  flex: none;
  font: inherit;
  font-size: .875rem;
  line-height: 1;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: .25rem .375rem;
  cursor: pointer;
  opacity: .5;
}
.entry-del:hover { opacity: 1; color: var(--ink); }

.archive-empty { font-size: .875rem; color: var(--ink-faint); margin: 0; }

/* ---------- Footer ---------- */

.foot {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: .8125rem;
  color: var(--ink-faint);
}

.link {
  font: inherit;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link:hover { color: var(--ink); }

.foot-sep { margin: 0 .5rem; }

/* ---------- Motion ---------- */

@keyframes settle { from { opacity: 0; transform: translateY(-4px); } }
@keyframes fade   { from { opacity: 0; } }
@keyframes rise   { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
