/* ============================================================================
   viewer.css — the frame around a demo site.

   The page itself never scrolls: the bar is a fixed-height row and the iframe
   takes the rest of the viewport, so the course bar stays on screen while the
   demo inside scrolls on its own.
   ============================================================================ */

:root {
  --bar-ink: #16161A;
  --bar-bg: #E9E9E5;
  --bar-rule: #D2D2CC;
  --bar-grey: #55555C;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bar-bg);
  color: var(--bar-ink);
  font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* -- the bar ------------------------------------------------------------------ */
.bar {
  flex: none;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-rule);
}
.bar__inner {
  max-width: 1400px;
  margin-inline: auto;
  padding: 12px clamp(14px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 28px);
}

.bar__left { display: flex; align-items: center; gap: clamp(12px, 1.6vw, 20px); min-width: 0; }

/* Back to the gallery. Same window — a back step should not leave a tab behind, and this page
   is the top-level window, not the framed one, so a plain link is all it takes. */
.backbtn {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--bar-rule);
  border-radius: 6px;
  color: var(--bar-ink);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--bar-bg);
  transition: background-color .18s, border-color .18s;
}
.backbtn:hover { background: #DDDDD8; border-color: #C3C3BC; }
.backbtn:focus-visible { outline: 3px solid var(--bar-ink); outline-offset: 2px; }
.backbtn__icon {
  width: 18px; height: 18px; flex: none;
  background: currentColor;
  -webkit-mask: url('../icons/arrow-left.svg') center / contain no-repeat;
  mask: url('../icons/arrow-left.svg') center / contain no-repeat;
}

.bar__msg {
  margin: 0;
  font-size: clamp(.8125rem, 1.4vw, .9375rem);
  line-height: 1.55;
  color: var(--bar-grey);
}
.bar__msg b { color: var(--bar-ink); font-weight: 600; }

.bar__actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* The buttons themselves live in promo.css, shared with the gallery. What belongs here is only
   how the pair sits inside this bar. */

/* -- the framed site ----------------------------------------------------------- */
.frame {
  flex: 1;
  width: 100%;
  border: 0;
  display: block;
  min-height: 0;
}

/* -- narrow ---------------------------------------------------------------------
   Stacked, the bar would eat a third of a phone screen, so the message drops to one
   line of its two and the buttons share a row. */
@media (max-width: 900px) {
  .bar__inner { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 14px; }
  /* Back stays pinned left with the message centred in what is left — the shape of a phone app
     bar, and the one place a back control is always looked for. */
  .bar__left { gap: 10px; }
  .bar__msg { flex: 1; text-align: center; }
  .bar__actions { justify-content: center; }
}
@media (max-width: 480px) {
  .backbtn { padding: 9px; }
  .backbtn__label { display: none; }
}
/* "ติดต่อ พลากร สอนสร้างเว็บ" plus the course button is wider than a phone, and neither label
   is one that should be truncated to make them fit. They get a row each instead. */
@media (max-width: 480px) {
  .bar__msg { font-size: .75rem; }
  /* A row each, but each one only as wide as its own label — a button stretched to the full
     width of a phone stops reading as a button. */
  .bar__actions { flex-direction: column; align-items: center; gap: 8px; }
  .pbtn { padding: 10px 14px; font-size: .8125rem; }
}
