/* AntTube: an ant-themed video site. Colours: soil browns, amber and leaf green. */
:root {
  --bg: #fbf7f0;
  --panel: #fff;
  --ink: #2b1d12;
  --muted: #7a6656;
  --line: #e9dfd2;
  --hover: #f2eadf;
  --amber: #d98c1f;
  --leaf: #3f8a3a;
  --soil: #5a3a22;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17110c;
    --panel: #211912;
    --ink: #f3e9dc;
    --muted: #b39d89;
    --line: #3a2c20;
    --hover: #2c2117;
    --soil: #c9a27e;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  height: 56px; padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.menu-btn { border: 0; background: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 20px; }
.menu-btn:hover { background: var(--hover); }
.brand { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; font-weight: 800; font-size: 20px; letter-spacing: -0.5px; }
.brand svg { width: 34px; height: 34px; }
.brand .tube {
  padding: 1px 9px 2px;
  border: 2.5px solid var(--soil);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  color: var(--soil);
}
.brand .ant { color: var(--amber); }
.search { display: flex; max-width: 560px; width: 100%; justify-self: center; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-right: 0; border-radius: 20px 0 0 20px;
  background: var(--panel); color: var(--ink); font: inherit;
}
.search input:focus { outline: 2px solid var(--amber); outline-offset: -2px; }
.search button {
  width: 64px; height: 40px; border: 1px solid var(--line); border-radius: 0 20px 20px 0;
  background: var(--hover); cursor: pointer;
}
.top-right { display: flex; gap: 8px; align-items: center; }
.pill-btn {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-weight: 700; white-space: nowrap;
}
.pill-btn:hover { background: var(--hover); }
.pill-btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill-btn.primary.joined { background: var(--hover); color: var(--ink); border-color: var(--line); }

/* Layout */
.layout { display: grid; grid-template-columns: 220px 1fr; }
.side { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 12px; }
.side a {
  display: flex; align-items: center; gap: 18px; height: 40px; padding: 0 12px; border-radius: 10px;
}
.side a:hover { background: var(--hover); }
.side a.on { background: var(--hover); font-weight: 700; }
.side .ico { width: 24px; text-align: center; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.side small { display: block; padding: 0 12px; color: var(--muted); }
body.side-closed .layout { grid-template-columns: 1fr; }
body.side-closed .side { display: none; }
main { padding: 24px; min-width: 0; }

/* Category chips */
.chips { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 8px; background: var(--hover); font-weight: 600; }
.chip.on { background: var(--ink); color: var(--bg); }

/* Video grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 40px 16px; }
.card .thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: #4a3020 url("ant-pattern.svg") center / 80px;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb::after {
  /* "Marching ants" border on hover */
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
  background:
    linear-gradient(90deg, var(--amber) 50%, transparent 0) repeat-x top / 12px 3px,
    linear-gradient(90deg, var(--amber) 50%, transparent 0) repeat-x bottom / 12px 3px,
    linear-gradient(0deg, var(--amber) 50%, transparent 0) repeat-y left / 3px 12px,
    linear-gradient(0deg, var(--amber) 50%, transparent 0) repeat-y right / 3px 12px;
  opacity: 0; transition: opacity .15s;
}
.card:hover .thumb::after { opacity: 1; animation: march .6s linear infinite; }
@keyframes march {
  to { background-position: 12px 0, -12px 100%, 0 -12px, 100% 12px; }
}
.dur {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 700;
}
.badge {
  position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 4px;
  background: rgba(0,0,0,.75); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.meta { display: grid; grid-template-columns: 36px 1fr; gap: 12px; margin-top: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--amber); display: grid; place-items: center; }
.avatar svg { width: 26px; height: 26px; }
.meta h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.3; }
.meta p { margin: 0; color: var(--muted); }
.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 16px; }

/* Watch page */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; max-width: 1750px; margin: 0 auto; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.locked {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff;
  background: #000 center / cover;
}
.locked::before { content: ""; position: absolute; inset: 0; background: rgba(20,12,6,.72); }
.locked form { position: relative; display: grid; gap: 12px; justify-items: center; padding: 20px; }
.locked h2 { margin: 0; }
.locked input { width: 260px; height: 40px; padding: 0 14px; border-radius: 20px; border: 0; font: inherit; }
.locked .err { color: #ffb36b; min-height: 1.4em; margin: 0; }
.w-title { margin: 14px 0 10px; font-size: 20px; line-height: 1.3; }
.w-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.w-row .chan { display: flex; align-items: center; gap: 12px; margin-right: 12px; }
.w-row .chan b { display: block; }
.w-row .chan small { color: var(--muted); }
.w-row .spacer { flex: 1; }
.desc { margin-top: 14px; padding: 12px; border-radius: var(--radius); background: var(--hover); white-space: pre-wrap; }
.desc b { display: block; margin-bottom: 4px; }
.next { display: grid; gap: 10px; align-content: start; }
.next h4 { margin: 0 0 4px; }
.next a { display: grid; grid-template-columns: 168px 1fr; gap: 8px; }
.next .thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #4a3020 url("ant-pattern.svg") center / 50px; }
.next .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.next b { display: block; font-size: 14px; line-height: 1.3; }
.next small { color: var(--muted); }
.trail { height: 14px; margin-top: 8px; background: url("ant-trail.svg") repeat-x 0 0 / 28px 14px; animation: trail 3s linear infinite; opacity: .55; }
@keyframes trail { to { background-position: 280px 0; } }

/* Admin and notices */
.notice { max-width: 420px; margin: 60px auto; text-align: center; }
.notice form { display: grid; gap: 12px; margin-top: 18px; }
.notice input { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.toast {
  position: fixed; left: 24px; bottom: 24px; padding: 12px 18px; border-radius: 8px;
  background: var(--ink); color: var(--bg); opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1000px) {
  .watch { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  body.side-open .side { display: block; position: fixed; left: 0; top: 56px; width: 240px; background: var(--bg); z-index: 9; border-right: 1px solid var(--line); }
  .top { grid-template-columns: auto 1fr; }
  .top-right { display: none; }
  .brand .word { display: none; }
  main { padding: 16px; }
  .next a { grid-template-columns: 140px 1fr; }
}

/* Keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.card:focus-visible { outline-offset: 4px; border-radius: var(--radius); }
.vis-note { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 13px; }
