/* Veldonderzoek Recorder, Repetive house style. Mobile first. */

@font-face {
  font-family: "Gilroy";
  src: url("fonts/Gilroy-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Gilroy";
  src: url("fonts/Gilroy-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Graphik";
  src: url("fonts/Graphik-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Graphik";
  src: url("fonts/Graphik-Semibold.otf") format("opentype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --purple: #4C01B4;
  --purple-dark: #3A0190;
  --purple-tint: #E8E0F8;
  --amber: #F5A623;
  --rec: #E53935;
  --dark: #1C1C1C;
  --grey: #6B7280;
  --bg: #FAF9FE;
  --surface: #FFFFFF;
  --lilac: #F3F0FB;
  --lilac-2: #EDE8FA;
  --border: #E8E0F8;
  --ok: #1E7F4F;
  --ok-bg: #E3F4EA;
  --err: #B42318;
  --err-bg: #FDECEA;
  --warn-bg: #FFF6E5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 28, 28, 0.04), 0 4px 16px rgba(76, 1, 180, 0.06);
  --font-head: "Gilroy", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Graphik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
  --tap: 48px;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }

p { margin: 0 0 10px; }

.muted { color: var(--grey); }
.small { font-size: 14px; }
.req { color: var(--purple); }

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

/* Layout -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__logo { height: 26px; width: auto; display: block; }
.topbar__right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__user { font-size: 14px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

.netbar {
  background: var(--warn-bg);
  color: #7A4B00;
  font-size: 14px;
  padding: 8px var(--gutter);
  border-bottom: 1px solid #F5D9A3;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px var(--gutter) calc(32px + env(safe-area-inset-bottom));
}

.screen > * + * { margin-top: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.center-block { text-align: center; padding-top: 25vh; }
.hero-logo { width: 180px; height: auto; display: block; margin: 0 auto 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card__head h2 { margin: 0; }

/* Login --------------------------------------------------------------- */

.login { padding-top: 8vh; text-align: center; }
.login h1 { font-size: 30px; color: var(--purple); }
.login .form { text-align: left; margin-top: 20px; }

/* Forms --------------------------------------------------------------- */

.form > * + * { margin-top: 14px; }
.field { display: block; }
.field__label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field__hint { display: block; font-size: 13px; color: var(--grey); margin-top: 4px; }
.field__error, .form-error { display: block; color: var(--err); font-size: 14px; margin-top: 6px; }
.form-error { background: var(--err-bg); padding: 10px 12px; border-radius: 10px; }

input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* >= 16px prevents iOS zoom on focus */
  color: var(--dark);
  background: var(--surface);
  border: 1.5px solid var(--lilac-2);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-tint); }
input[aria-invalid="true"] { border-color: var(--err); }
input::placeholder, textarea::placeholder { color: #A3A3B5; }

input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 10px;
  border: 1.5px dashed var(--lilac-2);
  border-radius: 10px;
  background: var(--lilac);
}

.consent { background: var(--lilac); border-color: var(--lilac-2); box-shadow: none; }
.consent__text {
  margin: 8px 0 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--purple);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  font-size: 15px;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--tap);
  font-weight: 600;
  cursor: pointer;
}
.check input {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  accent-color: var(--purple);
}

.upload-alt summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--purple);
  min-height: 32px;
  display: flex;
  align-items: center;
}
.upload-alt[open] summary { margin-bottom: 10px; }
.upload-alt > * + * { margin-top: 12px; }

/* Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 20px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn--block { display: flex; width: 100%; }
.btn--xl { min-height: 60px; font-size: 18px; }
.btn--small { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn--primary { background: var(--purple); color: #fff; }
.btn--primary:hover { background: var(--purple-dark); }
.btn--secondary { background: var(--surface); color: var(--purple); border-color: var(--purple); }
.btn--ghost { background: var(--lilac); color: var(--purple); }
.btn__icon { font-size: 26px; line-height: 1; font-weight: 400; }
.btn .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }

.btn-link {
  background: none;
  border: none;
  padding: 8px 4px;
  min-height: 40px;
  color: var(--purple);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn-back {
  background: none;
  border: none;
  padding: 8px 0;
  min-height: 40px;
  color: var(--purple);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Lists --------------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--lilac-2);
}
.item:first-child { border-top: none; }
.item__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.item__title { font-weight: 600; overflow-wrap: anywhere; }
.item__sub { font-size: 13px; color: var(--grey); }
.item__status { font-size: 13px; color: var(--purple); margin-top: 2px; }
.item__status.is-error { color: var(--err); }
.item__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

.count {
  display: inline-block;
  min-width: 24px;
  padding: 1px 8px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-size: 14px;
  text-align: center;
  vertical-align: 2px;
}

.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip--processing { background: var(--lilac-2); color: var(--purple); }
.chip--done { background: var(--ok-bg); color: var(--ok); }
.chip--failed { background: var(--err-bg); color: var(--err); }

.notice {
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--lilac);
}
.notice p:last-child { margin-bottom: 0; }
.notice--warn { background: var(--warn-bg); border-color: #F5D9A3; }
.empty { text-align: center; padding: 12px 0; }

/* Record screen ------------------------------------------------------- */

.rec {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.rec__company { font-family: var(--font-head); font-weight: 600; font-size: 18px; color: var(--purple); margin: 0; overflow-wrap: anywhere; }
.rec__timer {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}
.rec__status { font-weight: 600; color: var(--grey); min-height: 22px; }
.rec__status.is-live { color: var(--rec); }
.rec__status.is-live::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rec);
  margin-right: 8px;
  vertical-align: 1px;
  animation: blink 1.2s infinite;
}
.rec__status.is-paused { color: #A86B00; }
.rec__hint { color: var(--grey); font-size: 15px; margin: 0; min-height: 22px; }

.meter {
  width: 100%;
  max-width: 320px;
  height: 12px;
  border-radius: 999px;
  background: var(--lilac-2);
  overflow: hidden;
}
.meter__bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--purple), #9B4DE0 60%, var(--amber));
  transition: transform 0.08s linear;
}

.recbtn {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 6px solid var(--purple-tint);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  touch-action: manipulation;
  margin: 6px 0;
}
.recbtn:disabled { opacity: 0.6; cursor: default; }
.recbtn__inner {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--rec);
  transition: border-radius 0.2s, width 0.2s, height 0.2s;
}
.recbtn[data-state="recording"], .recbtn[data-state="paused"] { border-color: #F8C9C8; }
.recbtn[data-state="recording"] { animation: pulse 2s infinite; }
.recbtn[data-state="recording"] .recbtn__inner,
.recbtn[data-state="paused"] .recbtn__inner,
.recbtn[data-state="stopping"] .recbtn__inner { width: 56px; height: 56px; border-radius: 10px; background: var(--dark); }
.recbtn.is-armed { border-color: var(--rec); }
.recbtn.is-armed .recbtn__inner { background: var(--rec); }

#btn-pause { max-width: 320px; }

.warn {
  width: 100%;
  text-align: left;
  background: var(--warn-bg);
  border: 1px solid #F5D9A3;
  border-left: 5px solid var(--amber);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.warn strong { display: block; font-family: var(--font-head); font-size: 16px; margin-bottom: 2px; }
.warn__wake { display: block; margin-top: 6px; color: #7A4B00; }
.warn__wake:empty { display: none; }

#rec-error { width: 100%; text-align: left; }

/* Review -------------------------------------------------------------- */

.summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.summary dt { color: var(--grey); font-size: 14px; }
.summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.audio { width: 100%; }

.progress {
  height: 12px;
  border-radius: 999px;
  background: var(--lilac-2);
  overflow: hidden;
  margin: 8px 0 14px;
}
.progress__bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--purple);
  transition: transform 0.2s ease-out;
}

/* Toast --------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--gutter));
  max-width: 480px;
  background: var(--dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 50;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.noscript { padding: 16px; }

@keyframes blink { 50% { opacity: 0.2; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.35); }
  70% { box-shadow: 0 0 0 18px rgba(229, 57, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); }
}

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

@media (max-width: 370px) {
  .rec__timer { font-size: 54px; }
  .recbtn { width: 132px; height: 132px; }
  .recbtn__inner { width: 84px; height: 84px; }
}
