/*
 * Application chrome. Everything outside the artboard lives here so brand.css
 * stays a pure description of the slides themselves.
 */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--grc-gray-100);
  color: var(--grc-ink);
  font-family: var(--grc-font);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  /* The studio sets this too. Without it Montserrat resolves fractionally
     different metrics and text sits a few pixels off, which shows up as a
     mismatch against the studio's own render. */
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
}

.app-header {
  background: var(--grc-navy);
  color: var(--grc-white);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header img {
  height: 30px;
  width: auto;
  display: block;
}

.app-title {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}

.app-header .spacer {
  flex: 1;
}

.app-main {
  padding: 28px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-heading {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
}

.page-sub {
  margin: 0 0 22px;
  color: var(--grc-gray-500);
  font-size: 14px;
}

/* ---- Buttons ---- */

.btn {
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grc-red);
  color: var(--grc-white);
}

.btn:hover {
  background: var(--grc-red-dark);
}

.btn.is-ghost {
  background: transparent;
  color: var(--grc-white);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn.is-quiet {
  background: var(--grc-white);
  color: var(--grc-ink);
  border: 1px solid var(--grc-gray-300);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---- Gallery ---- */

.search-field {
  width: 100%;
  max-width: 320px;
  border: 1px solid var(--grc-gray-300);
  border-radius: 9px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  margin-bottom: 20px;
  background: var(--grc-white);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--grc-white);
  border: 1px solid var(--grc-gray-200);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  border-color: var(--grc-red);
}

/* The cover is the real first slide, scaled down. No screenshot needed. */
.card-cover {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--grc-white);
  border-bottom: 1px solid var(--grc-gray-200);
}

.card-cover [data-scaler] {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  pointer-events: none;
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(12, 36, 48, 0.88);
  color: var(--grc-white);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
}

.card-meta {
  padding: 12px 14px 16px;
}

.card-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
}

.card-date {
  margin-top: 4px;
  font-size: 11px;
  color: var(--grc-gray-500);
}

.empty-state {
  padding: 48px 0;
  color: var(--grc-gray-500);
  font-size: 14px;
  max-width: 640px;
}

.empty-state code {
  background: var(--grc-white);
  border: 1px solid var(--grc-gray-200);
  border-radius: 6px;
  padding: 2px 6px;
}

/* ---- Post view ---- */

.post-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.filmstrip {
  width: 150px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--grc-gray-200);
  border-radius: 8px;
  overflow: hidden;
  background: var(--grc-white);
  cursor: pointer;
  padding: 0;
}

.thumb.is-active {
  border-color: var(--grc-red);
}

.thumb [data-scaler] {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  pointer-events: none;
  display: block;
}

.thumb-index {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(12, 36, 48, 0.85);
  color: var(--grc-white);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.stage-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.stage {
  background: var(--grc-white);
  border: 1px solid var(--grc-gray-200);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* The frame carries the scaled footprint; the inner block stays at 1080. */
.stage-frame {
  position: relative;
  overflow: hidden;
}

.stage-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  transform-origin: top left;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--grc-gray-500);
  min-width: 62px;
  text-align: center;
}

.status {
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
  margin-top: 10px;
}

.status.is-ok {
  color: #2f7d3a;
}

.status.is-error {
  color: var(--grc-red);
}

/* Inline editing affordance, editor only. Never present in an export. */
.is-editing [data-editable]:hover {
  outline: 2px dashed rgba(160, 33, 34, 0.5);
  outline-offset: 3px;
}

.is-editing [data-editable]:focus {
  outline: 2px solid var(--grc-red);
  outline-offset: 3px;
}

/* Gallery heading row, so the create action sits beside the title. */
.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
