/* Brand Studio UI.
   The tool itself uses the same palette and chamfered geometry it applies to
   the exports, so what you see around the canvas matches what lands in it. */

:root {
  --blue: #0068ee;
  --blue-lift: #2a86ff;
  --cyan: #4ddcff;
  --ink: #061225;
  --surface: #0b1b33;
  --surface-2: #102743;
  --line: #1b3557;
  --text: #eef4ff;
  --muted: #93aac9;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --cut: 10px;
}

* {
  box-sizing: border-box;
}

/* Author display rules outrank the UA rule for [hidden], and several elements
   below set display explicitly, so restate it with priority. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--display);
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------- banner -- */

.banner {
  background: #4a1d1d;
  border-bottom: 1px solid #7d3030;
  color: #ffe4e4;
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.banner code {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  font-size: 12px;
}

/* ---------------------------------------------------------------- topbar -- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: auto;
  /* The extracted mark is blue-on-transparent; brighten it against the navy. */
  filter: brightness(1.35);
}

.brand-name {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--cyan);
}

.topbar h1 {
  font-size: 19px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 5px 10px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  background: var(--surface-2);
}

.chip[data-tone='warn'] {
  color: #ffd6a8;
  border-color: #7a5320;
  background: #33240f;
}

.chip[data-tone='good'] {
  color: var(--cyan);
  border-color: #1d4f6b;
  background: #082436;
}

/* --------------------------------------------------------------- buttons -- */

.btn {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid transparent;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  /* 45-degree cuts, the same move the wordmark makes on its letterforms. */
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn:hover:not(:disabled) {
  background: var(--blue-lift);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--blue);
}

.btn-small {
  padding: 7px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
.option:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- layout -- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}

.panel {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  padding: 4px 0 40px;
}

.group {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.group h2 {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 500;
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* --------------------------------------------------------------- options -- */

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.option-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.option {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  font-family: var(--body);
  transition: border-color 0.15s ease, background 0.15s ease;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}

.option:hover {
  border-color: var(--blue);
}

.option[aria-checked='true'] {
  background: var(--blue);
  border-color: var(--blue);
}

.option strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--display);
}

.option span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.option[aria-checked='true'] span {
  color: rgba(255, 255, 255, 0.82);
}

.option-row .option {
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
}

/* ---------------------------------------------------------------- fields -- */

.field {
  display: block;
  margin-top: 12px;
}

.field > span {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.field-inline > span {
  margin: 0;
}

input[type='text'],
textarea,
select {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 11px;
  font-family: var(--body);
  font-size: 13px;
  resize: vertical;
}

input[type='text']:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--blue);
}

output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- stage -- */

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  /* A faint blue wash keeps the working area from reading as flat black. */
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 104, 238, 0.16), transparent 70%),
    var(--ink);
}

.dropzone {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px;
}

.dropzone.is-hidden {
  display: none;
}

.dropzone-inner {
  text-align: center;
  border: 2px dashed var(--line);
  padding: 56px 48px;
  max-width: 520px;
  background: rgba(11, 27, 51, 0.55);
  clip-path: polygon(26px 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%, 0 26px);
}

.dropzone.is-dragging .dropzone-inner {
  border-color: var(--cyan);
  background: rgba(0, 104, 238, 0.14);
}

.dropzone-logo {
  width: 132px;
  height: auto;
  margin-bottom: 20px;
  filter: brightness(1.3);
}

.dropzone h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.dropzone p {
  color: var(--muted);
  margin: 0 0 18px;
}

.canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  min-height: 0;
}

#preview {
  max-width: 100%;
  max-height: 100%;
  cursor: grab;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

#preview.is-panning {
  cursor: grabbing;
}

/* ----------------------------------------------------------------- strip -- */

.strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.strip-items {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 2px;
}

.thumb {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border: 2px solid transparent;
  background: var(--surface-2);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb[aria-current='true'] {
  border-color: var(--cyan);
}

.thumb-kind {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(6, 18, 37, 0.82);
  pointer-events: none;
}

.thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(6, 18, 37, 0.85);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.thumb-remove:hover {
  background: #b91c1c;
}

/* ---------------------------------------------------------------- status -- */

.status {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--blue);
  color: var(--text);
  padding: 10px 18px;
  font-size: 13px;
  z-index: 20;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 46vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
