/* ---------------------------------------------------------------- audio */

.recorder {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface-2);
}

/* Red only while sound is being captured. It is the one place in this app that
   uses the colour, which is what makes it mean something. */
.recorder.is-live {
  border-color: var(--recording);
}

.btn-record {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .btn-record:hover:not(:disabled) { border-color: var(--recording); }
}

.btn-record:disabled { opacity: 0.5; cursor: not-allowed; }

.record-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--recording);
}

.record-dot.pulsing { animation: record-pulse 1.6s var(--ease-out) infinite; }

@keyframes record-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

.recorder-live {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.recorder-time {
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.recorder-actions {
  display: flex;
  gap: var(--space-2);
  margin-inline-start: auto;
}

.recorder-note {
  font-size: var(--text-2xs);
  color: var(--ink-muted);
}

.recorder-warn { color: var(--warning); }

.recorder-status {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* A level meter, not a waveform: it says "the microphone is hearing you", which
   is the only question anyone has while recording. */
.meter-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
}

.meter-bar {
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--surface-3);
  transition: background-color 80ms linear;
}

.meter-bar.lit { background: var(--recording); }

.audio-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.audio-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

.audio-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--ink-muted);
}

.audio-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audio-player {
  width: 100%;
  height: 34px;
}

.audio-meta {
  font-size: var(--text-2xs);
  color: var(--ink-faint);
}

.audio-dot { margin: 0 4px; }

.audio-error {
  font-size: var(--text-xs);
  color: var(--danger);
}

@media (prefers-reduced-motion: reduce) {
  .record-dot.pulsing { animation: none; }
}

/* ---------------------------------------------------------------- pictures */

.image-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

/* Capped rather than full width: a photograph on a note is a reference, and the
   text read out of it is the part being used. */
.image-preview {
  width: 132px;
  height: 92px;
  flex: none;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.image-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.attach-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.attach-row .btn { cursor: pointer; }

.attach-row .btn.is-busy { opacity: 0.6; pointer-events: none; }

.attach-hint {
  font-size: var(--text-2xs);
  color: var(--ink-faint);
}

@media (max-width: 600px) {
  .image-preview { width: 88px; height: 66px; }
}

/* ---------------------------------------------------------------- due dates */

.due-row {
  align-items: center;
}

.due-label {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.due-input {
  min-height: var(--control-h);
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
}

.due-input:focus {
  border-color: var(--border-strong);
}

/* Semantic, not decorative: it only appears when the date has passed. */
.due-flag {
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
}

/* The language beside the transcribe button. Quiet until somebody looks for it:
   the default is right for most people, and the ones it is wrong for are the
   ones who will go looking. */
.transcribe-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.language-select {
  min-height: var(--control-h);
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-2xs);
}

@media (hover: hover) {
  .language-select:hover,
  .language-select:focus {
    color: var(--ink);
    border-color: var(--border-strong);
  }
}

/* The only heading on the dashboard that is not neutral, because it is the only
   one reporting something that needs doing. */
.dash-heading-due {
  color: var(--danger);
}

/* ---------------------------------------------------------------- adding

   Four labelled buttons became one. The row under the writing also carries a
   due date and a tag picker, so it was seven controls wide before this. */
.tool-add {
  color: var(--ink);
  border-color: var(--border);
}

@media (hover: hover) {
  .tool-add:hover {
    background: var(--surface-hover);
  }
}

/* A dialog, for the reason AppearanceMenu gives: a popover in the scrolling
   column would be clipped by it. Sized and placed like a menu rather than
   centred like a sheet, so it reads as what it is. */
.addmenu {
  width: min(280px, calc(100vw - 32px));
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.addmenu::backdrop {
  background: rgb(0 0 0 / 0.28);
}

.addmenu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-sm);
  text-align: start;
  cursor: pointer;
}

@media (hover: hover) {
  .addmenu-item:hover {
    background: var(--surface-hover);
  }
}

.addmenu-item svg {
  color: var(--ink-muted);
  flex: 0 0 auto;
}


/* The four-ways-in diagram, on the dashboard of an account that is still new.

   It is a landing-page figure by origin, and the landing page gives it a wide
   measure and a lot of air. Inside the app it has to sit in the same column as
   everything else and stop being the loudest thing on the screen, so it gets a
   heading like every other section here and the space above it that a section
   gets, and nothing else. */
.dash-explain {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.dash-explain .hiw {
  margin-top: 0;
}


/* ---------------------------------------------------------------- the lock

   A note behind the account PIN. Everything here is deliberately quiet: a
   locked note should read as a note you have not opened, not as an alarm. */

.row-locked {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--ink-faint);
  font-style: italic;
}

.locked-note {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-6) 0;
  max-width: 42ch;
}

.locked-note-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-medium);
}

.locked-note-note {
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.locked-note-form {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.pin-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pin-label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* Wide enough for six digits and no wider: a PIN box the width of a text field
   invites a password, which is not what this takes. */
.pin-input {
  width: 9ch;
  letter-spacing: 0.35em;
}

.pin-hint {
  font-size: var(--text-2xs);
  color: var(--ink-faint);
}

.pin-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-start;
  padding-top: var(--space-2);
}

.pin-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}


/* ---------------------------------------------------------------- the pad

   Graph's surfaces are translucent so the ruling runs under them (see
   tokens.css). Fields are the exception: they are painted with --bg, which has
   to stay opaque because it is the page itself. Here they give up their fill
   and keep their edge, so a search box on the pad is a box drawn on the pad
   rather than a patch of blank paper laid over it.

   The list is what an audit of every route turned up, not a guess:
   tools/_opaque.mjs walks the app and reports anything still painting over the
   grid. Add to this when it reports something new. */
:root[data-theme="graph"] :is(
  .capture-input,
  .searchbar,
  .select-trigger,
  .cal-days,
  .cal-day,
  .hiw-source,
  .hiw-find
) {
  background: transparent;
}

/* Anything that floats over the page stays opaque. Graph's surfaces are
   see-through so the ruling runs under a panel that is part of the page; a menu
   or a toast is not part of the page, and content readable through it is a
   thing nobody can read. */
:root[data-theme="graph"] .appearance-panel {
  background: oklch(0.941 0.010 240);
}

:root[data-theme="graph"] .undo-toast {
  background: oklch(0.916 0.013 238);
}

/* A shadow is a panel floating above the paper it is printed on. */
:root[data-theme="graph"] .shell-main :is(.btn, .panel, .card, .row, .chip, .tool) {
  box-shadow: none;
}

/* ---- transcribing again ----

   The way back from a transcript in the wrong language. Folded away, because
   the ordinary case is a transcript that is fine and does not need a control
   arguing with it underneath. */
.transcribe-again {
  margin-block-start: var(--space-3);
}

.transcribe-again > summary {
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

@media (hover: hover) {
  .transcribe-again > summary:hover {
    color: var(--ink);
  }
}

.transcribe-again .transcribe-row {
  margin-block-start: var(--space-3);
}
