/* ============================================================
   Watch experiment — watch.emilialetizia.com
   Long-form surface: index grid, player page, emoji rating,
   comment thread. Vanilla CSS, dark, CSP-clean.
   ============================================================ */

:root {
  --bg: #0a0b0d;
  --surface: #14161a;
  --surface-2: #1b1e24;
  --line: rgba(255, 255, 255, .11);
  --line-soft: rgba(255, 255, 255, .07);
  --text: #e9ebef;
  --muted: #9aa1ad;
  --acc: #a78bfa;
  --danger: #ff6b6b;
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 10px 16px;
  background: var(--acc);
  color: #0a0b0d;
  border-radius: 0 0 10px 0;
  font-weight: 700;
}
.skip:focus { left: 0; }

/* ------------------------------------------------ shared: pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.pill:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); }
.pill svg { width: 15px; height: 15px; }
.pill--static { cursor: default; }
.pill--static:hover { background: rgba(255, 255, 255, .03); }

/* ------------------------------------------------ brandbar */

.brandbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(10, 11, 13, .86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.brandbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .2px;
  text-decoration: none;
}

.brandbar__mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--acc), #6d5cf0);
  box-shadow: 0 0 12px rgba(167, 139, 250, .5);
}

.brandbar__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brandbar__logout { display: inline-flex; margin: 0; }

.brandbar__locales {
  display: inline-flex;
  gap: 2px;
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid var(--line-soft);
}

.brandbar__loc {
  padding: 5px 7px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
  color: var(--muted);
  text-decoration: none;
}
.brandbar__loc:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.brandbar__loc.is-on { color: var(--acc); background: rgba(167, 139, 250, .12); }

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 22px 16px calc(48px + var(--safe-b));
}
.main:focus { outline: none; }

/* ------------------------------------------------ index */

.windex__head { margin: 4px 0 20px; }
.windex__title { margin: 0 0 6px; font-size: 24px; letter-spacing: .3px; }
.windex__intro { margin: 0; color: var(--muted); max-width: 60ch; }
.windex__empty { color: var(--muted); padding: 40px 0; text-align: center; }

.wgrid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.wcard__link {
  display: block;
  text-decoration: none;
  border-radius: var(--radius);
  transition: transform .15s ease;
}
.wcard__link:hover .wcard__title { color: var(--acc); }
.wcard__link:hover .wcard__thumb { transform: scale(1.03); }

.wcard__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.wcard__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

.wcard__duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.wcard__title {
  display: block;
  margin: 10px 2px 3px;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.35;
  transition: color .15s ease;
}

.wcard__sub {
  display: flex;
  gap: 8px;
  margin: 0 2px;
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  white-space: nowrap;
}
.wcard__channel { overflow: hidden; text-overflow: ellipsis; }

.windex__pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 26px;
}
.windex__pageno { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ watch page */

.wpage__stage {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line-soft);
}

.wvideo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.wvideo__fallback { margin: 0; padding: 20px; color: var(--muted); }

.wpage__meta { margin: 16px 2px 4px; }
.wpage__title { margin: 0 0 6px; font-size: 20px; line-height: 1.3; }
.wpage__sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}
.wpage__dot { opacity: .5; }
.wpage__archive {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.wpage__archive:hover { color: var(--acc); }
.wpage__archive svg { width: 14px; height: 14px; }

/* ------------------------------------------------ emoji rating */

.react {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.react__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.react__btn:hover { border-color: rgba(255, 255, 255, .3); transform: translateY(-1px); }
.react__btn.is-on {
  background: rgba(167, 139, 250, .16);
  border-color: var(--acc);
}
.react__e { font-size: 17px; line-height: 1; }
.react__n {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
}
.react__btn.is-on .react__n { color: var(--acc); }

.react__hint {
  flex-basis: 100%;
  margin: 2px 2px 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ------------------------------------------------ next teaser */

.wnext {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s ease;
}
.wnext:hover { border-color: var(--acc); }
.wnext__thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 9px;
  background: var(--surface-2);
}
.wnext__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wnext__label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.wnext__title { font-weight: 700; font-size: 14.5px; line-height: 1.35; }

/* ------------------------------------------------ comments */

.wct {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.wct__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 17px;
}
.wct__icon { width: 18px; height: 18px; color: var(--muted); }
.wct__total {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.wct__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.wct__empty { color: var(--muted); margin: 10px 2px; }
.wct__signin { margin: 8px 0; }
.wct__pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}
.wct__pageno { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.wcomposer {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.wcomposer__reply {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--acc);
  font-weight: 600;
}
.wcomposer__reply[hidden] { display: none; }
.wcomposer__reply-cancel {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.wcomposer__reply-cancel:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); }

.wcomposer__body {
  width: 100%;
  resize: vertical;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
.wcomposer__body:focus { outline: none; border-color: var(--acc); }
.wcomposer__body::placeholder { color: var(--muted); }

.wcomposer__foot { display: flex; justify-content: flex-end; }

.wcomposer__send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: var(--acc);
  color: #14101f;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s ease, transform .12s ease;
}
.wcomposer__send:hover { transform: translateY(-1px); }
.wcomposer__send:disabled { opacity: .55; cursor: default; transform: none; }
.wcomposer__send svg { width: 15px; height: 15px; }

/* ------------------------------------------------ comment rows */

.wthreads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cmt {
  display: flex;
  gap: 11px;
}
.cmt--reply {
  margin-left: 34px;
  padding-left: 12px;
  border-left: 2px solid var(--line-soft);
}

.cmt__avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 800;
  color: #0e0f13;
}
.cmt__avatar--0 { background: #94a3b8; }
.cmt__avatar--1 { background: #7dd3fc; }
.cmt__avatar--2 { background: #c4b5fd; }
.cmt__avatar--3 { background: #86efac; }
.cmt__avatar--4 { background: #fcd34d; }

.cmt__body { min-width: 0; flex: 1; }

.cmt__meta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 2px;
}
.cmt__name { font-weight: 700; font-size: 13.5px; }
.cmt__time { color: var(--muted); font-size: 12px; }

.cmt__text { margin: 0 0 4px; overflow-wrap: anywhere; white-space: pre-wrap; }

.cmt__actions { display: flex; gap: 6px; min-height: 20px; }
.no-js .cmt__actions { display: none; }

.cmt__act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.cmt__act:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.cmt__act svg { width: 13px; height: 13px; }
.cmt__act--danger:hover { color: var(--danger); background: rgba(255, 107, 107, .1); }

/* ------------------------------------------------ composer no-JS */

/* The composer and its actions are JSON endpoints — without JS they
   would only reload the page, so they stay out of the no-JS page. */
.no-js .wcomposer { display: none; }

/* ------------------------------------------------ toast */

.wtoast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translate(-50%, 16px);
  z-index: 70;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.wtoast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------ responsive */

@media (max-width: 640px) {
  .brandbar { flex-wrap: wrap; row-gap: 8px; }
  .brandbar__nav { width: 100%; justify-content: flex-start; }
  .main { padding-top: 16px; }
  .wgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 13px; }
  .wcard__title { font-size: 13.5px; }
  .wnext__thumb { width: 92px; }
  .cmt--reply { margin-left: 16px; }
  .wpage__archive { margin-left: 0; }
}

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