/* layout.css – application shell: top bar, three boxed columns, panels, preview header, footer, mobile drawers. */

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter) 0 calc(var(--gutter) + 2px); max-width: 1920px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); flex: none; border-radius: var(--radius); }
.brand-mark { color: var(--text); }
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.brand-tag { font-size: 9.5px; font-weight: 500; color: var(--text-3); letter-spacing: .17em; text-transform: uppercase; }
.top-extra { display: flex; align-items: center; gap: 18px; flex: 1; justify-content: flex-end; min-width: 0; }
.top-links { display: flex; gap: 2px; margin-right: auto; margin-left: 14px; }
.top-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: var(--radius); text-decoration: none;
  color: var(--text-2); font-weight: 500; font-size: 12.5px;
}
.top-link:hover { background: var(--surface-3); color: var(--text); }
.top-link::after { content: "↗"; font-size: 10.5px; opacity: .7; }
.top-controls { display: flex; align-items: center; gap: 10px; }
.top-export { flex: none; }

/* ---------- shell ---------- */
.shell {
  flex: 1; width: 100%; max-width: 1920px; margin: 0 auto; padding: var(--gutter);
  display: grid; grid-template-columns: 244px minmax(0, 1fr) 336px; column-gap: var(--gutter); align-items: start;
}
.panel {
  position: sticky; top: calc(var(--topbar-h) + var(--gutter)); height: calc(100vh - var(--topbar-h) - var(--gutter) * 2); height: calc(100dvh - var(--topbar-h) - var(--gutter) * 2);
  overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); box-shadow: var(--shadow-1); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.panel-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 20px 12px; background: var(--surface); }
.panel-title { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
:root[data-skin="modern"] .panel-title { font-size: 14px; letter-spacing: 0; text-transform: none; font-weight: 700; }
.panel-link {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 2px; border: 0; background: none; color: var(--text-3); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.panel-link:hover { color: var(--text); }
:root[data-skin="modern"] .panel-link { letter-spacing: 0; text-transform: none; font-size: 12px; }
.panel-body { padding: 0 20px 26px; }
.panel-extra { padding: 0 20px; }

.workspace { min-width: 0; padding: 14px clamp(0px, 1.6vw, 28px) 40px; display: flex; flex-direction: column; gap: 22px; }
.workspace > :not(.sr-only) { width: 100%; max-width: 1120px; margin-inline: auto; }      /* (the visually hidden h1 keeps its 1 px box – otherwise it would widen the page) */
.preview-block { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.preview-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.preview-bar .grow { flex: 1; }
.dock { min-width: 0; }

/* header of the live preview: eyebrow, big title, active font */
.pv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 28px; }
.pv-head-main { min-width: 0; }
.pv-eyebrow { display: flex; align-items: center; gap: 12px; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.pv-eyebrow .pv-rule { width: 30px; height: 1px; background: var(--text-3); }
.pv-eyebrow .pv-no { color: var(--text); font-variant-numeric: tabular-nums; }
.pv-title { margin-top: 10px; font-size: clamp(30px, 3.5vw, 46px); font-weight: 700; letter-spacing: -.04em; line-height: 1.04; overflow-wrap: anywhere; }
:root[data-skin="modern"] .pv-eyebrow { letter-spacing: .04em; text-transform: none; font-size: 12px; }
:root[data-skin="modern"] .pv-title { letter-spacing: -.03em; }
.pv-active { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; max-width: 100%; padding-bottom: 6px; }
.pv-active-label { font-size: 9.5px; font-weight: 600; letter-spacing: .17em; text-transform: uppercase; color: var(--text-3); }
.pv-active-name { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.pv-active-role { font-weight: 500; color: var(--text-3); }

/* the font block lives in the right panel on wide screens and under the title on narrow ones */
.picker-block { display: flex; flex-direction: column; gap: 14px; padding: 2px 0 22px; border-bottom: 1px solid var(--hairline); margin-bottom: 18px; }
.scope-bar { display: flex; flex-direction: column; gap: 8px; }
.pv-picker .picker-block { padding: 14px 16px; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); }

/* ---------- footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 24px; padding: 14px 24px;
  border-top: 1px solid var(--border); background: var(--surface); color: var(--text-3); font-size: 12px;
}
.footer-line { color: var(--text-2); font-weight: 500; }
.footer a { font-weight: 600; color: var(--text); }
.footer-note { max-width: 90ch; }

/* ---------- mobile bar + scrim ---------- */
.mobile-bar { display: none; }
.scrim { position: fixed; inset: 0; z-index: 54; background: rgba(10, 10, 10, .5); }

/* ---------- ≤ 1280: narrower side panels ---------- */
@media (max-width: 1280px) {
  .shell { grid-template-columns: 224px minmax(0, 1fr) 312px; }
  .workspace { padding-inline: 4px; }
}

/* ---------- ≤ 1180: panels become bottom sheets (below that the preview column would get narrower than ~580 px) ---------- */
@media (max-width: 1180px) {
  .shell { display: block; padding: 0; }
  .only-narrow { display: inline-flex !important; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 55; height: auto; max-height: 86vh; max-height: 86dvh;
    border: 0; border-top: 1px solid var(--border-strong); border-radius: var(--radius-l) var(--radius-l) 0 0;
    box-shadow: var(--shadow-2); transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.is-open { transform: none; visibility: visible; transition: transform .22s ease; }
  .panel-head { padding: 16px 16px 10px; }
  .panel-body, .panel-extra { padding-inline: 16px; }
  .workspace { padding: 18px 14px 96px; gap: 22px; }
  .pv-active { align-items: flex-start; text-align: left; padding-bottom: 0; }
  .mobile-bar {
    display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 6px;
  }
  .mobile-bar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-height: 48px; border: 0; background: none;
    color: var(--text-2); font-size: 11px; font-weight: 600; border-radius: var(--radius);
  }
  .mobile-bar button:hover { background: var(--surface-3); color: var(--text); }
  .footer { padding-bottom: 80px; }
}

/* ---------- ≤ 820: compact top bar with drop-down menu ---------- */
@media (max-width: 820px) {
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .brand-tag { display: none; }
  .brand { margin-right: auto; gap: 10px; }
  .top-extra {
    position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px 18px;
    background: var(--surface); border-bottom: 1px solid var(--border-strong); box-shadow: var(--shadow-2); display: none;
  }
  .top-extra.is-open { display: flex; }
  .top-links { margin: 0; flex-direction: column; }
  .top-link { padding: 10px 8px; font-size: 14px; }
  .top-controls { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .topbar-inner { gap: 8px; padding: 0 10px; }
  .brand { gap: 8px; min-width: 0; }
  .brand-name { font-size: 13px; white-space: normal; line-height: 1.1; max-width: 8.4em; }      /* two lines: "Typography / Playground" */
  .top-export span { display: none; }
  .topbar .top-export { padding-inline: 10px; min-width: var(--ctrl-h); }
}
