/* HAMtube web app. Amber on warm near-black; light mode follows the system unless the page says otherwise. */

:root {
  --bg: #15120e;
  --surface: #1e1914;
  --raised: #29231b;
  --ink: #f3ebdd;
  --muted: #a39682;
  --line: #3b3228;
  --amber: #f2b33d;
  --on-amber: #1c1407;
  --danger: #ec7b63;
  --ok: #a8cf86;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6efe2;
    --surface: #fffbf3;
    --raised: #efe5d2;
    --ink: #2a2016;
    --muted: #6f6252;
    --line: #dccfb8;
    --amber: #f2b33d;
    --on-amber: #1c1407;
    --danger: #b8462e;
    --ok: #3f6b22;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f6efe2;
  --surface: #fffbf3;
  --raised: #efe5d2;
  --ink: #2a2016;
  --muted: #6f6252;
  --line: #dccfb8;
  --danger: #b8462e;
  --ok: #3f6b22;
  color-scheme: light;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

h1, h2, h3, .wordmark, .code, .avatar { font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: clamp(28px, 4vw, 36px); line-height: 1.1; margin: 0 0 6px; }
h3 { font-size: 20px; margin: 28px 0 8px; }
p { margin: 0; }
.note { color: var(--muted); font-size: 0.93rem; }
.hint { color: var(--muted); font-size: 0.85rem; }

/* --- sign-in -------------------------------------------------------------------- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

.intro {
  /* Pinned to the screen, so a taller form (Create account) doesn't push the logo down the page. */
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: clamp(32px, 7vw, 96px);
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 18% 22%, color-mix(in srgb, var(--amber) 22%, transparent), transparent 70%),
    var(--bg);
}

.pig {
  width: clamp(110px, 18vw, 200px);
  height: auto;
  display: block;
  animation: rise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.wordmark {
  margin: 0;
  font-size: clamp(56px, 9vw, 120px);
  line-height: 0.9;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 28ch;
  font-size: clamp(18px, 2vw, 22px);
  color: var(--muted);
}

.panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 80px);
  border-left: 1px solid var(--line);
}

.panel form { max-width: 380px; width: 100%; min-width: 0; }

.tabs { display: flex; gap: 24px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none;
  border: 0;
  padding: 0 0 12px;
  margin-bottom: -1px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--amber); }

.legal { padding: 0 clamp(16px, 4vw, 40px) 28px; color: var(--muted); font-size: 0.9rem; }
.shell-legal { margin: 0; padding: 0 clamp(16px, 4vw, 40px) 40px; }
.legal:empty { display: none; }

/* --- forms and buttons ----------------------------------------------------------- */

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 16px; }
.field .label { font-weight: 600; font-size: 0.92rem; }
.field.inline { margin: 0; }

input, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }

.check { display: flex; gap: 10px; align-items: center; margin: 4px 0 18px; }
.check input { width: auto; }

button {
  font: inherit;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  border: 1px solid var(--line);
  background: none;
  color: var(--ink);
}
button:disabled { opacity: 0.6; cursor: progress; }
button.primary { background: var(--amber); color: var(--on-amber); border-color: var(--amber); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.06); }
button.quiet { border-color: transparent; padding-left: 0.4rem; padding-right: 0.4rem; color: var(--muted); }
button.quiet:hover { color: var(--ink); }
button.danger { color: var(--danger); }
button.wide { width: 100%; margin-top: 6px; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.stack > * + * { margin-top: 0; }

.status { min-height: 1.5em; margin-top: 12px; color: var(--muted); font-size: 0.93rem; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

/* --- app shell ------------------------------------------------------------------------ */

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 36px; height: auto; display: block; }
.brand span { font-weight: 600; font-size: 24px; letter-spacing: -0.02em; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.93rem; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sections {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  padding: 0 clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.sections a {
  padding: 14px 0 12px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.sections a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--amber); }

.content { margin: 0; padding: 32px clamp(16px, 4vw, 40px) 56px; }
/* The intro note sits under each heading, and whatever follows it starts 24px below, as on Profiles. */
.content > section > .note + * { margin-top: 24px; }
.content > section { animation: fade 240ms ease-out both; }
#flash { margin-top: 0; }
#flash:empty { display: none; }

/* profiles */
.profiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 16px;
  margin: 24px 0 0;
}
.profile {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 6px solid var(--tint, var(--line));
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
}
.profile h3 { margin: 6px 0 0; }
.profile .note { margin-bottom: 4px; }
.profile .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint, var(--raised));
  color: var(--on-amber);
  font-size: 26px;
}
.profile.add {
  border-style: dashed;
  border-top-style: dashed;
  border-top-width: 1px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  min-height: 176px;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.profile.add:hover { color: var(--ink); }

.editor {
  margin-top: 24px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  max-width: 520px;
}
.editor h3 { margin-top: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--tint);
  border: 2px solid transparent;
}
.swatch.none { background: var(--raised); border: 1px dashed var(--muted); }
.swatch[aria-checked="true"] { outline: 2px solid var(--ink); outline-offset: 3px; }

/* lists, codes, tables */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list li.empty { color: var(--muted); justify-content: flex-start; }
.list strong.small { font-size: 1rem; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

.code {
  font-size: clamp(48px, 10vw, 76px);
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  margin: 18px 0 6px;
}

.scroll { overflow-x: auto; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }

/* --- narrow screens ------------------------------------------------------------------- */

/* Settings: the TV's pages in two columns, stacked on a phone. Colours and buttons are the site's own. */
.settings-layout { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-root { display: grid; gap: 8px; }
.settings-root button { width: 100%; text-align: left; }
.settings-page { min-width: 0; }
.settings-page > * { margin-right: 16px; }
.settings-page h3 { margin: 0 0 16px; }
.settings-page h4 { margin: 24px 0 8px; }
.settings-page > div { margin-bottom: 12px; }
.settings-page button.wide { width: 100%; text-align: left; margin-bottom: 8px; }
@media (max-width: 720px) {
  .settings-layout { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .wordmark { font-size: clamp(44px, 15vw, 72px); }
  .intro { position: relative; height: auto; padding: 36px 24px 12px; }
  .pig { width: 96px; }
  .panel { border-left: 0; padding: 24px; }
  .who span { display: none; }
}

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