/* Tokens, typography, layout. "Audio journal": warm paper, ink, one red recording-light accent. */

:root {
  --paper: #f3eee4;
  --surface: #fbf8f2;
  --surface-2: #ece5d7;
  --ink: #1d1b17;
  --ink-2: #57514a;
  --ink-3: #8f877a;
  --rule: #ddd4c3;
  --accent: #e2401a;
  --accent-ink: #fffaf5;
  --accent-soft: rgba(226, 64, 26, 0.12);
  --mark: #ffd9a8;
  --ok: #2f8f5b;
  --shadow: 0 1px 0 rgba(29, 27, 23, 0.04), 0 8px 24px -12px rgba(29, 27, 23, 0.18);
  --radius: 14px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Onest", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --topbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13110f;
    --surface: #1c1916;
    --surface-2: #26221d;
    --ink: #efe8dc;
    --ink-2: #b6ad9e;
    --ink-3: #7c7468;
    --rule: #332e28;
    --accent: #ff5b2e;
    --accent-soft: rgba(255, 91, 46, 0.14);
    --mark: #6b3a12;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13110f;
  --surface: #1c1916;
  --surface-2: #26221d;
  --ink: #efe8dc;
  --ink-2: #b6ad9e;
  --ink-3: #7c7468;
  --rule: #332e28;
  --accent: #ff5b2e;
  --accent-soft: rgba(255, 91, 46, 0.14);
  --mark: #6b3a12;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme="dark"] body::before {
  mix-blend-mode: screen;
  opacity: 0.18;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    mix-blend-mode: screen;
    opacity: 0.18;
  }
}

a {
  color: inherit;
  text-decoration: none;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
mark {
  background: var(--mark);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}
.mono {
  font-family: var(--mono);
  font-size: 0.82em;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* App frame */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
}
.pane {
  min-width: 0;
}
.layout[data-focus="left"] .pane--right,
.layout[data-focus="right"] .pane--left {
  display: none;
}
.pane--left {
  padding: 8px 16px 48px;
}

@media (min-width: 1024px) {
  .app {
    height: 100dvh;
  }
  .layout {
    grid-template-columns: minmax(360px, 420px) 1fr;
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
  }
  .layout[data-focus] .pane {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .pane--left {
    border-right: 1px solid var(--rule);
    padding: 8px 20px 48px;
  }
  .back {
    display: none !important;
  }
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 400 28px/1 var(--serif);
  letter-spacing: -0.01em;
}
.brand--big {
  font-size: 56px;
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-3);
  display: inline-block;
  flex: none;
}
.rec-dot--live {
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: rec 1.6s ease-in-out infinite;
}
@keyframes rec {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-soft);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 7px transparent;
    opacity: 0.55;
  }
}

.search {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within,
.search.is-open {
  border-color: var(--ink-3);
  box-shadow: var(--shadow);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
}
.search input::-webkit-search-cancel-button {
  display: none;
}
.search__close {
  display: inline-flex;
  color: var(--ink-3);
}
.topbar__nav {
  display: flex;
  gap: 2px;
}
@media (max-width: 560px) {
  .topbar {
    gap: 8px;
    padding: 0 10px 0 14px;
  }
  .brand {
    font-size: 24px;
  }
  .topbar__nav .icon-btn {
    min-width: 36px;
  }
  .search input::placeholder {
    color: transparent;
  }
  .search {
    max-width: none;
  }
}

.banner {
  display: block;
  padding: 10px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  font-size: 14px;
  border-bottom: 1px solid var(--rule);
}

.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}
.boot .rec-dot {
  width: 14px;
  height: 14px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
