/* Shared community "Looks" UI: 16:9 cards + detail modal. Used by /feed and the
   Studio Home strip. Relies on the brand tokens each page already defines
   (--bg, --bg-2, --text, --muted, --faint, --line, --coral, --display/--body/--mono). */

/* ---- card (16:9) -------------------------------------------------------- */
.look-card { display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line); }
.look-card .lc-media {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9;
  background: #0a0a0a; overflow: hidden; border: 0; padding: 0; cursor: pointer;
}
.look-card .lc-media img, .look-card .lc-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.look-card .lc-badge {
  position: absolute; top: 8px; left: 8px; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text);
  background: rgba(19,19,18,0.78); padding: 3px 7px; pointer-events: none;
}
.look-card .lc-body { padding: 11px 12px 12px; display: grid; gap: 9px; }
.look-card .lc-title { font-weight: 700; font-size: 13.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.look-card .lc-author { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.look-card .lc-actions { display: flex; align-items: center; gap: 6px; }
.lc-act {
  display: inline-flex; align-items: center; gap: 5px; background: transparent;
  border: 1px solid var(--line-2, rgba(247,244,237,0.18)); color: var(--muted);
  font-family: var(--mono); font-size: 11px; padding: 6px 9px; cursor: pointer; line-height: 1;
  text-decoration: none;
}
.lc-act:hover { color: var(--text); border-color: var(--muted); }
.lc-act.liked { color: var(--coral); border-color: var(--coral); }
.lc-act.lc-remix { margin-left: auto; background: var(--coral); border-color: var(--coral); color: #fff; font-family: var(--display); font-weight: 700; }
.lc-act.lc-remix:hover { filter: brightness(1.08); color: #fff; }
.lc-act.copied { color: var(--text); border-color: var(--text); }

/* ---- detail modal ------------------------------------------------------- */
.look-modal-backdrop {
  position: fixed; inset: 0; z-index: 100040; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
}
/* Lock the page behind the modal so only the sheet scrolls. */
body.look-modal-open { overflow: hidden; }
.look-modal {
  /* Fixed-size module: a definite height (not max-height) so the comments pane
     scrolls inside it instead of stretching the whole modal off-screen. */
  width: min(960px, 96vw); height: min(640px, 88vh); display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background: var(--bg-2); border: 1px solid var(--line); overflow: hidden;
}
.lm-left { display: flex; flex-direction: column; min-width: 0; background: var(--bg-2); }
.lm-media { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0a0a0a; display: grid; place-items: center; flex: none; }
.lm-media img, .lm-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.lm-meta { flex: 1; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--bg-2); }
.lm-title { font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.15; }
.lm-author { font-family: var(--mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 5px; }
.lm-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lm-feature.on { color: var(--coral); border-color: var(--coral); }
/* Destructive admin action: quiet by default, red only on hover. */
.lm-remove { color: var(--faint); }
.lm-remove:hover { color: var(--coral); border-color: var(--coral); }

.lm-right { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.lm-right-head {
  display: flex; align-items: center; justify-content: space-between; padding: 13px 15px;
  border-bottom: 1px dashed var(--line); font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.lm-close { width: 30px; height: 30px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 19px; line-height: 1; cursor: pointer; }
.lm-close:hover { color: var(--text); border-color: var(--muted); }
.lm-comments { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 15px; display: flex; flex-direction: column; gap: 12px; }
.lm-comment-empty { color: var(--faint); font-size: 12.5px; }
/* avatar square + a distinct bubble, so comments are easy to follow */
.lm-comment { display: flex; gap: 10px; align-items: flex-start; }
.lm-comment-avatar {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 12px; color: #fff;
  text-transform: uppercase; background: #444;
}
.lm-comment-bubble {
  flex: 1; min-width: 0; display: grid; gap: 4px; padding: 9px 11px;
  background: rgba(247,244,237,0.045); border: 1px solid var(--line);
}
.lm-comment-head { display: flex; align-items: baseline; gap: 8px; }
.lm-comment-author { font-family: var(--mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); }
.lm-comment-time { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.lm-comment-del { margin-left: auto; background: transparent; border: 0; color: var(--faint); font-size: 14px; cursor: pointer; line-height: 1; }
.lm-comment-del:hover { color: var(--coral); }
.lm-comment-body { font-size: 13.5px; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.lm-composer { border-top: 1px dashed var(--line); padding: 12px 15px; display: grid; gap: 9px; }
.lm-composer textarea {
  width: 100%; min-height: 52px; resize: vertical; padding: 9px 11px; background: var(--bg);
  border: 1px solid var(--line-2, rgba(247,244,237,0.18)); color: var(--text);
  font-family: var(--body); font-size: 13.5px; line-height: 1.4;
}
.lm-composer textarea:focus { outline: none; border-color: var(--muted); }
.lm-composer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lm-composer-hint { font-size: 11.5px; color: var(--faint); }
.lm-send { height: 34px; padding: 0 16px; background: var(--coral); border: 1px solid var(--coral); color: #fff; font-family: var(--display); font-weight: 700; font-size: 12px; cursor: pointer; }
.lm-send:disabled { opacity: 0.5; cursor: wait; }
.lm-signin { color: var(--muted); font-size: 13px; }
.lm-signin a { color: var(--coral); }

@media (max-width: 760px) {
  .look-modal { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: min(680px, 94vh); }
  .lm-left { max-height: 46vh; }
  .lm-right { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---- touch / phones: bigger tap targets, roomier cards, full-bleed modal ---
   Do not shrink the UI on small screens. Every button is a comfortable touch
   target (>=44px), text is readable, and the detail modal becomes a full-screen
   sheet with a prominent Remix action. */
@media (max-width: 600px) {
  /* Cards */
  .look-card .lc-body { padding: 14px 14px 15px; gap: 12px; }
  .look-card .lc-title { font-size: 15.5px; white-space: normal; }
  .look-card .lc-author { font-size: 11.5px; }
  .look-card .lc-actions { gap: 8px; flex-wrap: wrap; }
  .look-card .lc-act { min-height: 44px; padding: 0 14px; font-size: 13px; gap: 7px; }
  .look-card .lc-act .lc-lbl { font-size: 13px; }

  /* Detail modal: a single scrollable full-screen sheet. ONE column in normal
     document flow (not a fixed grid) so the whole sheet scrolls inside the
     backdrop. That way a focused comment box scrolls into view above the
     keyboard instead of zooming and breaking the layout, and the close button
     stays reachable at the top. */
  .look-modal-backdrop {
    padding: 0; align-items: flex-start; justify-content: center;
    overflow: hidden; /* the SHEET scrolls, not the backdrop, so nothing jumps */
  }
  .look-modal {
    display: block; width: 100vw; max-height: none; border: 0;
    /* JS sizes height to the VisualViewport; 100dvh is the no-JS fallback. */
    height: 100dvh;
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding-top: env(safe-area-inset-top); /* clear the notch / status bar */
  }
  .lm-left, .lm-right { display: block; min-height: 0; max-height: none; border: 0; }
  .lm-left { background: var(--bg-2); }
  .lm-media { aspect-ratio: 16 / 10; }
  .lm-meta { padding: 16px; }
  .lm-title { font-size: 21px; padding-right: 52px; } /* clear the fixed close */
  .lm-author { font-size: 12px; }

  /* Action buttons: full-size, Remix is the prominent full-width primary */
  .lm-actions { gap: 10px; margin-top: 16px; }
  .lm-actions .lc-act {
    min-height: 48px; padding: 0 16px; font-size: 14.5px;
    flex: 1 1 auto; justify-content: center;
  }
  .lm-actions .lc-act.lc-remix { flex-basis: 100%; order: -1; margin-left: 0; }

  /* Close: pinned top-right of the viewport, above everything, always reachable
     while the sheet scrolls and clear of the notch. */
  .lm-close {
    position: fixed; z-index: 100060;
    top: calc(10px + env(safe-area-inset-top)); right: 12px;
    width: 44px; height: 44px; font-size: 24px;
    background: rgba(19, 19, 18, 0.82); border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--text);
  }

  /* Comments flow in the page scroll (no inner scrollbox on phones). */
  .lm-right-head { padding: 15px 16px; font-size: 12px; border-top: 1px solid var(--line); }
  .lm-comments { overflow: visible; padding: 15px 16px; gap: 14px; }
  .lm-comment-body { font-size: 14.5px; }
  .lm-comment-avatar { width: 34px; height: 34px; font-size: 13px; }
  .lm-composer { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
  .lm-composer textarea { min-height: 64px; font-size: 16px; } /* >=16px: no iOS zoom */
  .lm-send { height: 48px; padding: 0 22px; font-size: 14px; }
}
