/* A yellow legal pad and a ballpoint pen: the thing you grab to jot an idea down. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #ffe14d;
  --paper-deep: #f6d42a;
  --ink: #1c2470;
  --ink-soft: rgba(28, 36, 112, 0.72);
  --rule: rgba(28, 36, 112, 0.24);
  --red: #c4122f;
  --on-ink: #ffe14d;

  /* The pad's margin: status marks sit left of the red line, writing sits right of it. */
  --margin: 34px;
  --gutter: 14px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12173f;
    --paper-deep: #0c102e;
    --ink: #ffe14d;
    --ink-soft: rgba(255, 225, 77, 0.74);
    --rule: rgba(255, 225, 77, 0.22);
    --red: #ff6a6a;
    --on-ink: #12173f;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Bricolage", ui-rounded, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

/* ---- The page ---- */

.pad {
  position: relative;
  max-width: 35rem;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 56px) calc(var(--margin) + var(--gutter));
}

/* The double red margin line of a legal pad. */
.pad::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--margin);
  width: 4px;
  border-left: 1px solid var(--red);
  border-right: 1px solid var(--red);
  opacity: 0.55;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
}

.top h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.net {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-align: right;
}

.net button {
  margin-left: 6px;
}

/* ---- Capturing ---- */

.adding {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--paper-deep);
  font-size: 0.9375rem;
}

.typed {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.typed textarea {
  width: 100%;
  min-height: 3.2em;
  max-height: 40svh;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1.4;
  resize: none;
  field-sizing: content;
}

.typed textarea::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.typed textarea:focus-visible {
  outline: 0;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 5px;
}

.solid {
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 700;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a {
  color: inherit;
  font-weight: 600;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 0 26px;
  /* Centre on the paper, not on the space right of the margin line. */
  margin-left: calc(-1 * (var(--margin) + var(--gutter)));
  margin-right: -18px;
}

/* The one loud thing on the page. */
.key {
  --level: 0;
  position: relative;
  width: 136px;
  height: 136px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.key-mark {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--red);
  transition: border-radius 0.16s ease, width 0.16s ease, height 0.16s ease, background-color 0.16s ease;
}

.key:active {
  transform: scale(0.97);
}

.key[aria-pressed="true"] {
  background: var(--red);
  /* The ring swells with the voice, so it is plain the phone is hearing you. */
  box-shadow: 0 0 0 calc(4px + var(--level) * 22px) color-mix(in srgb, var(--red) 28%, transparent);
}

.key[aria-pressed="true"] .key-mark {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--paper);
}

.timer {
  margin: 14px 0 0;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.caption {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

.timer:not([hidden]) + .caption {
  margin-top: 2px;
}

.recorder .link {
  margin-top: 8px;
  padding: 6px 4px;
}

.notice {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  background: var(--paper-deep);
  font-size: 0.9375rem;
}

/* ---- The ideas, one per ruled line ---- */

.ideas {
  margin: 0;
  padding: 0;
  list-style: none;
}

.idea {
  position: relative;
  border-top: 1px solid var(--rule);
}

.idea:last-child {
  border-bottom: 1px solid var(--rule);
}

/* The mark in the margin: a ring while it is being worked on, filled once it is saved. */
.idea::before {
  content: "";
  position: absolute;
  top: 21px;
  left: calc(-1 * (var(--gutter) + var(--margin) / 2) - 6px);
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.idea[data-mark="done"]::before {
  background: var(--ink);
}

.idea[data-mark="waiting"]::before {
  border-style: dashed;
}

.idea[data-mark="problem"]::before {
  border-color: var(--red);
  background: var(--red);
}

.idea-head {
  display: block;
  width: 100%;
  padding: 13px 0 12px;
  border: 0;
  background: none;
  text-align: left;
}

.idea-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.idea-line {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.idea-status {
  display: block;
  margin-top: 5px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.idea[data-mark="problem"] .idea-status {
  color: var(--red);
}

.idea-body {
  padding: 0 0 16px;
}

.idea-body h3 {
  margin: 14px 0 4px;
  font-size: 0.9375rem;
  font-weight: 700;
}

.idea-body h3:first-child {
  margin-top: 2px;
}

.idea-body ul,
.idea-body ol {
  margin: 0;
  padding-left: 1.15em;
}

.idea-body ul {
  list-style: disc;
}

.idea-body li {
  margin: 3px 0;
}

.idea-body p {
  margin: 6px 0;
}

.said {
  margin: 0;
  padding: 0;
  list-style: none;
}

.said li {
  margin: 0 0 8px;
  padding-left: 10px;
  border-left: 2px solid var(--rule);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.said small {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 14px;
}

.research {
  margin-top: 14px;
  padding-top: 4px;
  border-top: 1px dashed var(--rule);
  overflow-wrap: anywhere;
}

.research h3 {
  font-size: 1rem;
}

.research code {
  font-family: inherit;
  background: var(--paper-deep);
  padding: 0 3px;
}

.empty {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
}

/* ---- Unfolded, or on a desk: capture on the left, the list beside it ---- */

@media (min-width: 760px) {
  .pad {
    max-width: 62rem;
    display: grid;
    grid-template-columns: 19rem minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 3.5rem;
    align-items: start;
  }

  .top {
    grid-column: 1 / -1;
  }

  .capture {
    position: sticky;
    top: 14px;
  }

  .recorder {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .key-mark {
    transition: none;
  }

  .key:active {
    transform: none;
  }
}
