/* ============================================================
   style.css — all the visual styling for the page.
   CSS works by selecting HTML elements and setting properties.
   ============================================================ */

/* Custom properties ("CSS variables") defined on :root, the <html> element.
   Defining colors once here means we change them in one place, not everywhere. */
:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --border: #2f2f35;
  --text: #efeff1;
  --text-muted: #adadb8;
  --accent: #9147ff; /* Twitch purple */
}

/* The universal selector (*) applies to every element.
   border-box makes width include padding + border, which is far more intuitive. */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* A font "stack": the browser uses the first one available on the system. */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

/* Centers the content column and stops it stretching too wide on big screens.
   "margin: 0 auto" = no vertical margin, automatic (equal) horizontal margins. */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Stream player =====
   The classic responsive-video trick: the wrapper has no height of its own,
   but padding-top of 56.25% (9 ÷ 16) forces a 16:9 box that scales with width.
   The iframe is then absolutely positioned to fill that box exactly. */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 8px;
  overflow: hidden; /* clips the iframe corners to match the rounded box */
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0; /* iframes have an ugly default border */
}

/* ===== Comments ===== */
.comments {
  margin-top: 32px;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
}

/* Strip the default bullets and indentation from the <ul>. */
.comment-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  /* Long unbroken strings (like a pasted URL) wrap instead of overflowing. */
  overflow-wrap: anywhere;
}

/* The small timestamp line above each comment's text. */
.comment-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 12px;
}

/* Flexbox lays the input and button out in a row. */
.comment-form {
  display: flex;
  gap: 8px;
}

.comment-form input {
  /* flex: 1 tells the input to absorb all leftover horizontal space. */
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit; /* inputs don't inherit body font by default */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* :focus styles the input while the cursor is in it. */
.comment-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.comment-form button {
  padding: 10px 20px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer; /* show the hand cursor so it reads as clickable */
}

/* :hover applies while the mouse is over the button. */
.comment-form button:hover {
  background: #772ce8;
}

/* Hides text visually but keeps it readable by screen readers — used for the
   <label> on the input, which sighted users don't need (the placeholder covers it). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
