/* Show Works brand: black, red accent, Montserrat, bold uppercase headings.
   Fonts are self-hosted (static/brand/) so the app makes no third-party requests —
   it gets used on site, sometimes on a poor connection. */

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('brand/montserrat-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('brand/montserrat-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('brand/montserrat-700.woff2') format('woff2');
}

:root {
  --brand-red: #e00000;
  --brand-red-hover: #b80000;

  --bg: #f4f4f5;
  --card-bg: #ffffff;
  --text: #111111;
  --muted: #6b6b70;
  --border: #dededf;
  --accent: var(--brand-red);
  --accent-text: #ffffff;
  --error: #b91c1c;

  --header-bg: #111111;
  --header-text: #ffffff;

  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 4px;   /* the brand is square-edged, not rounded */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0e;
    --card-bg: #18181a;
    --text: #f2f2f3;
    --muted: #9a9aa1;
    --border: #2a2a2e;
    --header-bg: #000000;
  }
}

* { box-sizing: border-box; }

/* The browser's own [hidden] rule is display:none, but any author `display` rule beats
   it — so .lightbox{display:flex} etc. would render while still marked hidden. This
   keeps the attribute authoritative. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

/* ---- header ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--header-bg);
  border-bottom: 3px solid var(--brand-red);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  height: 30px;
  width: auto;
  display: block;
  flex: none;
}

.brand-app {
  color: var(--header-text);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-left: 0.7rem;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  white-space: nowrap;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}

.whoami {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.topbar .link-button { color: rgba(255, 255, 255, 0.72); }
.topbar .link-button:hover { color: #fff; }

@media (max-width: 460px) {
  .brand-app { display: none; }
  .whoami { display: none; }
}

/* ---- layout ---------------------------------------------------------- */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.1rem 1rem 3rem;
}

h1, h2, h3 {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

h1 {
  font-size: 1.35rem;
  margin: 0.5rem 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--brand-red);
}

h2 { font-size: 1rem; margin: 1.4rem 0 0.6rem; }

a { color: var(--brand-red); font-weight: 600; }

.muted { color: var(--muted); margin: 0.2rem 0; }
.meta { color: var(--muted); font-size: 0.82rem; margin: 0.2rem 0; }
.truncate {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.back-link {
  display: inline-block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

/* ---- cards ----------------------------------------------------------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: block;
  text-decoration: none;
  color: var(--text);
}

a.card { transition: border-color 0.12s ease; }
a.card:hover { border-color: var(--brand-red); }

.new-form summary {
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--brand-red);
}
.new-form form { margin-top: 0.9rem; }

/* ---- forms ----------------------------------------------------------- */

form label {
  display: block;
  margin-bottom: 0.7rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"], input[type="date"], input[type="password"], textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.62rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(224, 0, 0, 0.15);
}

button, .button-like {
  display: inline-block;
  background: var(--brand-red);
  color: #fff;
  border: 1px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 0.62rem 1.1rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  text-align: center;
}

button:hover, .button-like:hover {
  background: var(--brand-red-hover);
  border-color: var(--brand-red-hover);
}

.button-like-secondary {
  background: transparent;
  color: var(--brand-red);
}
.button-like-secondary:hover {
  background: var(--brand-red);
  color: #fff;
}

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  padding: 0.2rem 0;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.link-button:hover { background: none; color: var(--brand-red); }

.error {
  color: var(--error);
  font-weight: 600;
  border-left: 3px solid var(--error);
  padding-left: 0.6rem;
}

.login-card { max-width: 380px; margin: 3rem auto; }
.login-card h1 { border-bottom-color: var(--brand-red); }

/* ---- grids and media ------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
}

.project-card h2, .visit-card h2 { margin-top: 0; }

.thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 0.5rem;
  background: var(--bg);
}

.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px dashed var(--border);
}

video.thumb { object-fit: contain; background: #000; }

.thumb-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: auto;
  min-height: 110px;
  padding: 0.9rem 0.6rem;
  border: 1px dashed var(--border);
}
.audio-icon { font-size: 1.7rem; line-height: 1; }
.thumb-audio audio { width: 100%; }

/* ---- upload + recorder ----------------------------------------------- */

/* Two-up on a phone: these get tapped one-handed while standing on site, so they want
   to be large targets without pushing the gallery off the bottom of the screen. */
.upload-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}
.upload-buttons .button-like {
  padding: 0.85rem 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.button-like {
  position: relative;
  overflow: hidden;
}
.button-like input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.recorder {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.rec-button {
  background: transparent;
  color: var(--brand-red);
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.rec-button.recording {
  background: var(--brand-red);
  color: #fff;
  animation: pulse 1.4s ease-in-out infinite;
}
.rec-button:disabled { opacity: 0.55; cursor: default; animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}
@media (prefers-reduced-motion: reduce) {
  .rec-button.recording { animation: none; }
}

/* ---- per-item notes -------------------------------------------------- */

.photo-grid .photo-card { padding: 0.6rem; }
.photo-card form { margin-top: 0.3rem; }

.photo-note-form textarea {
  display: block;
  width: 100%;
  margin: 0.4rem 0 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  resize: vertical;
}

.photo-note-form .save-note {
  margin-top: 0.4rem;
  padding: 0.36rem 0.75rem;
  font-size: 0.72rem;
}

.archive-form { margin-top: 1.2rem; }

.flash {
  background: var(--card-bg);
  border-left: 3px solid var(--brand-red);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

/* ---- nav ------------------------------------------------------------- */

.topnav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: none;
}
.topnav a {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.topnav a:hover { color: #fff; }

@media (max-width: 460px) {
  .topnav { gap: 0.6rem; }
  .topnav a { font-size: 0.7rem; }
}

/* ---- job reference --------------------------------------------------- */

.job-ref {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-red);
  border: 1px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 0.12rem 0.4rem;
  margin: 0.35rem 0 0;
}

.job-ref-card { padding: 0.85rem 1rem; }
.job-ref-link {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.inline-edit summary {
  cursor: pointer;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 0.4rem;
}
.inline-edit form { margin-top: 0.7rem; }

/* ---- permissions & admin --------------------------------------------- */

.perms {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.9rem;
}
.perms legend {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
  padding: 0 0.35rem;
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.6rem;
}
label.check:last-child { margin-bottom: 0; }
label.check input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--brand-red);
  flex: none;
}

.perm-note {
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.user-card h2 { margin-top: 0; }
.reset-block summary {
  cursor: pointer;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 0.8rem;
}
.reset-block form { margin-top: 0.7rem; }

/* ---- destructive confirmations --------------------------------------- */

.danger-card { border-left: 3px solid var(--brand-red); }
.danger-text { color: var(--error); font-weight: 600; }
.button-danger { background: #b91c1c; border-color: #b91c1c; }
.button-danger:hover { background: #991b1b; border-color: #991b1b; }
.danger-link { color: var(--error); }

.button-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.button-row form { margin: 0; }

.project-actions { margin-top: 1.4rem; }
.archived-link { margin-top: 1.6rem; font-size: 0.85rem; }

.archived-banner {
  background: var(--card-bg);
  border-left: 3px solid var(--muted);
  padding: 0.5rem 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- capture-date flagging ------------------------------------------- */

.date-warning {
  background: var(--card-bg);
  border: 1px solid #d97706;
  border-left: 4px solid #d97706;
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.photo-card-flagged { border-color: #d97706; }

.date-flag {
  color: #b45309;
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0.25rem 0 0;
}

@media (prefers-color-scheme: dark) {
  .date-flag { color: #fbbf24; }
}

.download-all { margin: 0 0 1rem; }

/* ---- transcripts & search -------------------------------------------- */

.transcript-block summary {
  cursor: pointer;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-red);
  font-weight: 700;
  margin-top: 0.35rem;
}

.transcript-text {
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0.4rem 0 0;
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  border-left: 3px solid var(--brand-red);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
}

.transcript-pending { color: var(--muted); }
.retry-form { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.3rem; }

.quick-search {
  display: flex;
  gap: 0.5rem;
  margin: 0.4rem 0 1rem;
}
.quick-search input[type="search"] {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.95rem;
}
.quick-search button { padding: 0.55rem 1rem; }

.search-form input[type="search"] {
  display: block;
  width: 100%;
  margin: 0.3rem 0 0.8rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.search-hit { display: block; }
.search-hit .snippet {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.search-hit mark {
  background: var(--brand-red);
  color: #fff;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  font-weight: 700;
}

/* ---- per-item actions ------------------------------------------------ */

.item-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.item-actions form { margin: 0; }
.item-actions .link-button, .item-actions a.link-button { font-weight: 400; }

/* ---- lightbox -------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}
body.lightbox-open { overflow: hidden; }

.lightbox-inner {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-inner img,
.lightbox-inner video {
  max-width: 100%;
  max-height: 88vh;
  display: block;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}
.lightbox-close:hover { background: none; color: var(--brand-red); }

.site-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}
