/* ==========================================================================
   Abaklabs Banner Creator – custom styles (Tailwind handles the rest of the page)
   ========================================================================== */

:root {
  --ink: #16202D;
  --cobalt: #2447F5;
  --rule: #C9D1DD;
}

/* Keyboard focus that stays visible on every control */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
}

/* The real file input is visually hidden; show focus on its label instead */
#image-input:focus-visible + .file-btn {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
}

/* ---------- Preview frame: print-style crop marks around the canvas ---------- */
.crop {
  --m: 16px;
  --c: var(--ink);
  padding: 14px;
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--m) 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 0 / 1.5px var(--m) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--m) 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / 1.5px var(--m) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / var(--m) 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / 1.5px var(--m) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--m) 1.5px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / 1.5px var(--m) no-repeat;
}

#banner-canvas {
  box-shadow: 0 1px 2px rgba(22, 32, 45, .18), 0 12px 32px -12px rgba(22, 32, 45, .35);
}

/* Native color input: make the swatch fill the control */
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: 0; border-radius: 4px; }
.color-swatch::-moz-color-swatch { border: 0; border-radius: 4px; }

/* ==========================================================================
   Ad / processing modal
   Hidden by default. Toggle the `.is-open` class from JS to show it.
   ========================================================================== */
.ad-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: rgba(10, 16, 28, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);

  /* Hidden state: not clickable, not focusable, not read by screen readers */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, visibility 0s linear .2s;
}

.ad-modal.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity .2s ease, visibility 0s;
}

/* Stop the page behind the modal from scrolling */
body.modal-open { overflow: hidden; }

.ad-modal__panel {
  width: min(100%, 720px);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.25rem;
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  outline: none;
}

.ad-modal__title {
  margin: 0;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.15;
}

.ad-modal__status {
  margin: 0;
  font-size: .95rem;
  color: rgba(22, 32, 45, .75);
  min-height: 1.4em;
}

/* ---------- Video container: scales on desktop and mobile ---------- */
.ad-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 60vh;            /* fallback */
  max-height: 60dvh;           /* mobile browsers with dynamic toolbars */
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}

/* contain = portrait or odd-ratio ads are letterboxed, never cropped or stretched */
.ad-player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

.ad-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, .6);
  border-radius: 4px;
  pointer-events: none;
}

.ad-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: .75rem 1.5rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, .7);
  border: 2px solid #fff;
  border-radius: 999px;
  cursor: pointer;
}

.ad-unmute {
  position: absolute;
  left: 8px;
  bottom: 14px;
  padding: .4rem .8rem;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, .7);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

/* The `hidden` attribute must win over the display rules above */
.ad-overlay-btn[hidden],
.ad-unmute[hidden],
.btn[hidden] { display: none; }

.ad-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, .25);
}

.ad-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cobalt);
}

/* ---------- Modal buttons ---------- */
.ad-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}

.btn {
  min-height: 44px;                /* comfortable touch target */
  padding: 0 1.25rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.btn--ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
}

.btn--solid {
  margin-left: auto;
  color: #fff;
  background: var(--cobalt);
  border: 1px solid var(--cobalt);
}

.btn--solid:disabled {
  color: rgba(22, 32, 45, .6);
  background: #E9EDF3;
  border-color: var(--rule);
  cursor: not-allowed;
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .ad-modal__panel { padding: 1rem; }
  .ad-modal__title { font-size: 1.25rem; }
  .crop { padding: 10px; }
}

/* Phones held sideways: keep the whole modal inside the viewport */
@media (max-height: 500px) and (orientation: landscape) {
  .ad-player { max-height: 50dvh; }
  .ad-modal__title { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ad-modal,
  .ad-modal.is-open { transition: none; }
}

/* ==========================================================================
   Preview stage + safe-zone guide (guide is preview-only, never exported)
   ========================================================================== */
.stage { position: relative; line-height: 0; }

.safe-guide {
  position: absolute;
  pointer-events: none;
  border: 2px dashed #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .55);
}
.safe-guide[hidden] { display: none; }
.safe-guide span {
  position: absolute;
  left: 6px;
  top: 4px;
  padding: 1px 6px;
  font: 600 11px/1.4 "IBM Plex Sans", system-ui, sans-serif;
  color: #fff;
  background: rgba(0, 0, 0, .65);
  border-radius: 3px;
}

/* ==========================================================================
   Article content below the tool (Tailwind preflight strips heading styles)
   ========================================================================== */
.content { max-width: 44rem; }
.content h2 {
  margin: 2.75rem 0 .75rem;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.65rem;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.content h3 { margin: 1.5rem 0 .35rem; font-weight: 600; font-size: 1.05rem; }
.content p, .content li { font-size: 1.02rem; line-height: 1.7; color: rgba(22, 32, 45, .88); }
.content p { margin: 0 0 1rem; }
.content ol, .content ul { margin: 0 0 1.25rem 1.25rem; padding: 0; }
.content ol { list-style: decimal; }
.content ul { list-style: disc; }
.content li { margin-bottom: .5rem; padding-left: .25rem; }
.content a { color: var(--cobalt); text-decoration: underline; text-underline-offset: 2px; }
.content a:hover { text-decoration-thickness: 2px; }

.spec { width: 100%; margin: 0 0 1.25rem; border-collapse: collapse; font-size: .98rem; }
.spec th, .spec td { padding: .65rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.spec th { width: 38%; font-weight: 600; }

.tool-links { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin: 1rem 0 0; padding: 0; list-style: none; }
.tool-links li { margin: 0; padding: 0; }
.tool-links a {
  display: block; height: 100%; padding: .9rem 1rem; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--rule); border-radius: 8px;
}
.tool-links a:hover { border-color: var(--cobalt); }
.tool-links strong { display: block; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 1.05rem; }
.tool-links span { font-size: .9rem; color: rgba(22, 32, 45, .7); }

.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--cobalt); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }
