/* Ocarina Tracker — community tips, replies and votes (redesign Phase 4, js/tips.js).
   Linked after styles.css; every colour is a sky token from there
   (html[data-sky="day|dusk|night"]), so all three skies are covered.
   Design: docs/ui-redesign/design/TipsThread.dc.html, WalkthroughTips,
   HeartsTips, TipsMobile. */

/* ------------------------------------------------ summary in a slot */
.tips-slot { margin-top: 8px; }
.step .tips-slot { margin-top: 2px; }
.step--done .tips-slot { opacity: .9; }
.card .tips-slot { margin-top: 0; }
.tips-sum {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  font-family: var(--px); font-size: 8px; line-height: 1.4; text-transform: uppercase;
  padding: 8px 12px; min-height: 36px; background: var(--current); color: var(--text);
  border: 2px solid var(--accent); box-shadow: 2px 2px 0 var(--outer); cursor: pointer; text-align: left;
}
.tips-sum:hover { border-color: var(--accent-text); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--outer); }
.tips-sum[aria-expanded="true"] { border-style: solid; border-color: var(--accent); background: var(--current); }
.tips-sum__k { color: var(--text); white-space: nowrap; }
.tips-sum__n { color: var(--accent-text); }
.tips-sum--has .tips-sum__n::before { content: "▣ "; }
.tips-sum__v { color: var(--text); border-left: 2px solid var(--dash); padding-left: 8px; white-space: nowrap; }
.tips-sum__v--ok { color: var(--green); }
.tips-sum__v--none { color: var(--accent-text); }
.tips-sum::after { content: "▸"; color: var(--accent-text); padding-left: 2px; }

/* ---------------------------------------------------- thread shell */
.tips-thread { display: flex; flex-direction: column; gap: 18px; color: var(--text); font-family: var(--body); }
.tips-thread--inline {
  margin-top: 12px; padding: 16px 18px;
  background: var(--current); border: 2px solid var(--accent);
  box-shadow: inset 0 0 0 2px var(--panel), inset 0 0 0 4px var(--current-edge);
}
.tips-thread--drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 66;
  width: min(600px, 100vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 24px 32px; background: var(--panel);
  border-left: 4px solid var(--border); box-shadow: -4px 0 0 var(--outer), -12px 0 0 var(--drop);
}
.tips-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .45); }
.tips-thread__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tips-thread__titles { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tips-thread__kicker { font-size: 9px; color: var(--accent-text); text-transform: uppercase; }
.tips-thread__name { font-size: 16px; line-height: 1.4; font-weight: 400; margin: 0; }
.tips-thread__name:focus { outline: none; }
.tips-thread__name:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.tips-thread__close {
  flex: none; width: 44px; height: 44px; font-family: var(--px); font-size: 12px;
  background: var(--outer); color: var(--on-outer); border: 3px solid var(--border); cursor: pointer;
}
.tips-status { margin: 0; padding: 10px 12px; font-size: 14px; color: var(--warn-text); border: 2px solid var(--warn); background: var(--warn-bg); }
.tips-loading { font-size: 15px; }

/* -------------------------------------------------- remake vote box */
.tips-verify {
  display: flex; flex-direction: column; gap: 12px; padding: 16px 18px;
  background: var(--outer); color: var(--on-outer); border: 3px solid var(--border);
}
.tips-verify__h { font-size: 10px; line-height: 1.6; color: var(--on-outer-accent); text-transform: uppercase; margin: 0; }
.tips-votes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tips-vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 10px 6px; cursor: pointer;
  background: var(--panel); color: var(--text); border: 3px solid var(--dash);
}
.tips-vote .px { font-size: 9px; }
.tips-vote__n { font-size: 13px; opacity: .85; }
.tips-vote:hover { border-color: var(--accent); }
.tips-vote[aria-pressed="true"] { background: var(--accent-fill); color: var(--accent-ink); border-color: var(--accent-fill); }
.tips-vote[aria-pressed="true"] .tips-vote__n { opacity: 1; }
.tips-meter { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--on-outer-dim); }
.tips-meter .meter { flex: 1; background: var(--seg-off); }
.tips-meter .meter.tone-accent { color: var(--on-outer-accent); }
.tips-meter .meter.tone-green { color: var(--on-outer-green); }
.tips-meter__t { flex: none; max-width: 60%; }
.tips-meter__t--ok { color: var(--on-outer-green); }
.tips-verify__you { margin: 0; color: var(--on-outer-dim); }
.tips-verify__you b { color: var(--on-outer); }

/* ------------------------------------------------------ tips list */
.tips-list { display: flex; flex-direction: column; gap: 12px; }
.tips-list__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tips-list__h { font-size: 10px; color: var(--accent-text); text-transform: uppercase; margin: 0; }
.tips-list .pill { font-size: 7px; padding: 8px; text-transform: uppercase; }
.tips-empty { font-size: 15px; margin: 0; }
.tips-hidden { margin: 0; padding: 10px 14px; border: 2px dashed var(--dash); }
.tip { display: flex; gap: 12px; padding: 12px 14px; background: var(--panel); border: 2px solid var(--dash); }
.tips-thread--inline .tip { background: var(--panel); }
.tip--pinned { background: var(--current); border-color: var(--accent); }
.tip__av {
  display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
  width: 40px; height: 40px; background: var(--current); border: 2px solid var(--dash);
}
.tip__av svg { width: 100%; height: 100%; display: block; }
.tip__av--admin { border-color: var(--heart); }
.tip__av--mod { border-color: var(--green); }
.tip__av-ph { font-size: 12px; color: var(--dim); }
.tip__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tip__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tip__name { font-size: 9px; overflow-wrap: anywhere; }
.tip__role { font-size: 7px; line-height: 1; padding: 4px 5px; border: 2px solid currentColor; white-space: nowrap; }
.tip__role--admin { color: var(--heart); }
.tip__role--mod { color: var(--green); }
.tip__role--you { color: var(--blue); }
.tip__pinned { font-size: 7px; color: var(--accent-text); text-transform: uppercase; }
.tip__when { font-size: 12px; color: var(--dim); }
.tip__body { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.tip__body:focus { outline: none; }
.tip__body:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tip__spoiler-mark { font-size: 7px; color: var(--warn-text); border: 2px solid currentColor; padding: 3px 4px; vertical-align: middle; }
.tip__spoiler {
  align-self: flex-start; text-align: left; font-size: 8px; line-height: 1.6; padding: 10px 12px; min-height: 44px; cursor: pointer;
  background: var(--outer); color: var(--on-outer-warn); border: 2px dashed var(--warn);
}
.tip__spoiler:hover { border-style: solid; }
.tip__acts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.tip__act { background: transparent; border: 0; padding: 6px 0; color: var(--dim); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: transparent; }
.tip__act:hover { text-decoration-color: currentColor; }
.tip__act:disabled { cursor: default; }
.tip__act--right { margin-left: auto; }
.tip__reply { color: var(--text); }
.tip__reply[aria-expanded="true"] { color: var(--accent-text); text-decoration-color: currentColor; }
.tip__reply .tip__n { opacity: .85; }
[data-tips-report][aria-pressed="true"] { color: var(--warn-text); }

/* ▲ score ▼ */
.tip__vote { display: inline-flex; align-items: center; border: 2px solid var(--dash); background: var(--panel); }
.tip__vbtn {
  width: 36px; height: 32px; padding: 0; background: transparent; border: 0; cursor: pointer;
  color: var(--dim); font-size: 13px; line-height: 1;
}
.tip__vbtn:hover:not(:disabled) { color: var(--text); background: var(--current); }
.tip__vbtn--up[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-fill); }
.tip__vbtn--down[aria-pressed="true"] { color: var(--warn-text); background: var(--warn-bg); }
.tip__vbtn:disabled { cursor: default; opacity: .6; }
.tip__vote--own .tip__vbtn:disabled { opacity: .35; }
.tip__vbtn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.tip__score { min-width: 30px; padding: 0 2px; text-align: center; font-size: 9px; color: var(--text); }
.tip__score--pos { color: var(--green); }
.tip__score--neg { color: var(--warn-text); }

/* replies: one level, indented under the tip, oldest first */
.tip-thread { display: flex; flex-direction: column; gap: 6px; }
.tip__replies { display: flex; flex-direction: column; gap: 6px; margin-left: 26px; padding-left: 12px; border-left: 3px solid var(--dash); }
.tip--reply { padding: 10px 12px; }
.tip--reply .tip__av { width: 32px; height: 32px; }
.tip--reply .tip__body { font-size: 14px; }
.tip--deleted { border-style: dashed; }
.tip--deleted .tip__body { font-size: 14px; }
.tip__av--none { background: transparent; border-style: dashed; }
.tip--low { border-style: dashed; padding: 4px 14px; }
.tip__low { background: transparent; border: 0; padding: 8px 0; min-height: 36px; text-align: left; color: var(--dim); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.tip__low:hover { color: var(--text); }
.tips-list__r { color: var(--dim); }
.tip__report { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; border: 2px dashed var(--warn); }
.tip__report .pill { font-size: 7px; }
.tip__report-cancel { font-size: 13px; padding: 6px; }

/* ------------------------------------------------------- post form */
.tips-form { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--panel); border: 3px solid var(--border); }
.tips-thread--drawer .tips-form { background: var(--current); }
.tips-form__label { font-size: 13px; color: var(--dim); }
.tips-form__ta {
  font-family: var(--body); font-size: 16px; line-height: 1.5; color: var(--on-outer); background: var(--outer);
  border: 2px solid var(--border); padding: 10px; width: 100%; resize: vertical; min-height: 84px; border-radius: 0;
}
.tips-form__ta::placeholder { color: var(--on-outer-dim); opacity: 1; }
.tips-form__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tips-form__count { margin-right: auto; }
.tips-form__spoiler { font-size: 14px; }
.tips-form__post { font-size: 9px; padding: 12px 16px; }
.tips-form__status { margin: 0; color: var(--warn-text); min-height: 1em; }
.tips-form__status:empty { display: none; }
.tips-form__cancel { font-size: 14px; padding: 8px 6px; }
.tips-form--reply { padding: 12px 14px; border-width: 2px; border-color: var(--dash); }
.tips-thread--drawer .tips-form--reply { background: var(--panel); }
.tips-form--reply .tips-form__ta { min-height: 64px; }
.tips-signin {
  display: block; padding: 16px; text-align: center; font-size: 15px; text-decoration: none;
  background: var(--current); border: 3px solid var(--accent); color: var(--text);
}
.tips-signin b { color: var(--accent-text); }
.tips-signin:hover b { text-decoration: underline; }

/* ----------------------------------------------- phones: bottom sheet */
@media (max-width: 767px) {
  .tips-sum { min-height: 44px; padding: 10px 12px; }
  .tips-thread--drawer {
    top: auto; left: 0; right: 0; width: auto; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px);
    padding: 10px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    border-left: 0; border-top: 4px solid var(--border); box-shadow: 0 -4px 0 var(--outer);
  }
  .tips-thread--drawer::before { content: ""; display: block; align-self: center; width: 56px; height: 6px; background: var(--dim); margin-bottom: -6px; }
  body.tips-open { overflow: hidden; }
  .tips-votes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tips-meter { flex-wrap: wrap; }
  .tips-meter__t { max-width: none; }
  .tip { padding: 12px; }
  .tip__act { min-height: 44px; padding: 10px 0; }
  .tip__vbtn { width: 44px; height: 44px; font-size: 15px; }
  .tip__low { min-height: 44px; }
  .tip__replies { margin-left: 10px; padding-left: 8px; }
  .tip--reply { padding: 10px; }
  .tip__report .pill { min-height: 44px; }
  .tips-form__post, .tips-form__cancel { min-height: 44px; }
  .tips-form { padding: 14px; }
  .tips-form--reply { padding: 12px; }
}
@media (max-width: 1099px) and (min-width: 768px) {
  .tips-votes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tips-thread--inline .tips-votes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  .tips-thread--drawer { animation: tips-in .18s ease-out; }
  @keyframes tips-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 767px) {
  @keyframes tips-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
}
html.calm .tips-thread--drawer { animation: none; }
