@font-face {
  font-family: 'SF Pro Display';
  src:
    url('./fonts/SFProDisplay-Light.woff2') format('woff2'),
    url('./fonts/SF-Pro-Display-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src:
    url('./fonts/SFProDisplay-Regular.woff2') format('woff2'),
    url('./fonts/SF-Pro-Display-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src:
    url('./fonts/SFProDisplay-Medium.woff2') format('woff2'),
    url('./fonts/SF-Pro-Display-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src:
    url('./fonts/SFProDisplay-Bold.woff2') format('woff2'),
    url('./fonts/SF-Pro-Display-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src:
    url('./fonts/SFProDisplay-Heavy.woff2') format('woff2'),
    url('./fonts/SF-Pro-Display-Heavy.otf') format('opentype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-main: #254dca;
  --bg-shadow: #11338c;
  --card-cyan: #33ccff;
  --card-border: #2040a8;
  --title-blue: #11338c;
  --pill-blue: #11338c;
  --badge-dark: #11338c;
  --badge-mid: #0033cc;
  --badge-light: #3399ff;
  --text-white: #f6f8ff;
  --panel-height: calc(100dvh - 48px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'SF Pro Display', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    linear-gradient(132deg, transparent 68%, #1a3ea9 68%),
    var(--bg-main);
  color: var(--text-white);
}

.layout {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: stretch;
}

.controls-panel {
  background: rgba(14, 31, 91, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 24px;
  height: fit-content;
  max-height: var(--panel-height);
  align-self: start;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 28px;
  overflow: auto;
}

.controls-header {
  display: grid;
  gap: 8px;
}

.controls-panel h1 {
  margin: 0;
  font-size: 1.62rem;
  line-height: 1.05;
  font-weight: 500;
}

.controls-panel p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  opacity: 0.9;
  font-weight: 300;
}

.controls-form {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.field-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

label {
  font-weight: 500;
  font-size: 0.95rem;
}

input,
textarea,
button {
  width: 100%;
  font-family: inherit;
}

input,
textarea {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-white);
  font-size: 1rem;
}

input::placeholder,
textarea::placeholder {
  color: rgba(246, 248, 255, 0.7);
}

#news-url::placeholder,
#manual-title::placeholder {
  font-weight: 300;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: #31c2ff;
  color: #09338e;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.status {
  display: none;
  font-size: 0.95rem;
  line-height: 1.2;
  font-weight: 500;
}

.status.is-visible {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  margin-top: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

.status.success {
  color: #d8ffe6;
  border-color: rgba(37, 194, 110, 0.7);
  background: rgba(24, 129, 71, 0.4);
  box-shadow: inset 0 0 0 1px rgba(85, 255, 160, 0.2);
}

.status.error {
  color: #ffcece;
  border-color: rgba(255, 120, 120, 0.6);
  background: rgba(136, 33, 33, 0.35);
}

.preview-panel {
  --preview-card-size: min(665px, calc(var(--panel-height) - 130px), 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  height: var(--panel-height);
}

.preview-wrap {
  width: calc(var(--preview-card-size) + 2px);
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  /* border: 2px solid rgba(214, 232, 255, 0.48); */
  border-radius: 18px;
}

.whatsapp-card {
  --content-width: 76%;
  --stage-left-pct: 12%;
  --stage-right-pct: 88%;
  --stage-top-pct: 12%;
  --stage-bottom-pct: 88%;
  --shadow-corner-cut-pct: 75%;
  --shadow-start-top-right-x-shift-pct: 1%;
  --shadow-start-top-right-y-shift-pct: 1%;
  --shadow-start-bottom-left-x-shift-pct: 1%;
  --shadow-start-bottom-left-y-shift-pct: 1%;
  width: var(--preview-card-size);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 18px;
  background: #2255e3;
}

.card-shadow-poly {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

#card-shadow-polygon {
  fill: rgba(17, 51, 140, 0.32);
}

.brand-strip,
.card-stage-wrap,
.card-stage,
.link-pill {
  position: relative;
  z-index: 1;
}

.brand-strip {
  height: 64px;
  width: var(--content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 48px;
}

.gas-brasil-logo {
  width: min(276px, 45.54%);
  height: auto;
  object-fit: contain;
}

.sindigas-logo {
  width: min(179px, 29.1%);
  height: auto;
  object-fit: contain;
}

.card-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 18px;
  background: var(--card-cyan);
  border: 2px solid var(--card-border);
  padding: 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  row-gap: 14px;
}

.card-stage-wrap {
  position: relative;
  width: var(--content-width);
  flex: 1;
  min-height: 0;
  margin-bottom: 20px;
}

.card-stage-shadow {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: var(--bg-shadow);
  z-index: 0;
  pointer-events: none;
}

.card-stage {
  z-index: 1;
}

.portal-badge {
  width: 150px;
  height: 88px;
  position: absolute;
  left: -48px;
  top: 16px;
  display: grid;
  place-items: center;
  z-index: 2;
  isolation: isolate;
}

.portal-badge-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--badge-dark);
  border: 4px solid var(--badge-dark);
  z-index: 2;
}

.portal-badge-mid {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  width: 82%;
  height: 100%;
  border-radius: 8px;
  background: var(--badge-mid);
  z-index: 1;
}

.portal-badge-light {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  width: 64%;
  height: 100%;
  border-radius: 8px;
  background: var(--badge-light);
  z-index: 0;
}

.portal-badge img {
  position: relative;
  z-index: 3;
  width: auto;
  height: auto;
  max-width: 78%;
  max-height: 78%;
  object-fit: initial;
  display: block;
  margin: 0 auto;
}

.portal-badge img[src=''] {
  display: none;
}

#portal-logo-placeholder {
  position: relative;
  z-index: 3;
  color: #d7e4ff;
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.08em;
}

.media-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 236px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--card-border);
  background: linear-gradient(145deg, #d9e7f2, #c2d5e5);
}

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

#news-title {
  margin: 0;
  align-self: start;
  width: 100%;
  max-width: 100%;
  justify-self: center;
  color: var(--title-blue);
  font-size: 36px;
  font-weight: 750;
  line-height: 48px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--pill-blue);
  color: #33ccff;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  padding: 3px 18px 5px 18px;
  border-radius: 999px;
}

#news-link-label {
  display: block;
  line-height: 1;
}

.export-actions {
  width: var(--preview-card-size);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.export-button {
  text-transform: lowercase;
  font-weight: 500;
}

.export-button.secondary {
  background: #d8ecff;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .controls-panel {
    position: static;
    height: auto;
    display: grid;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .preview-panel {
    justify-content: center;
    padding-bottom: 14px;
    height: auto;
  }

  .preview-wrap {
    width: calc(var(--preview-card-size) + 2px);
  }

  .preview-panel {
    --preview-card-size: min(665px, 100%);
  }
}

@media (max-width: 820px) {
  .layout {
    padding: 14px;
    gap: 16px;
  }

  .preview-panel {
    --preview-card-size: min(92vw, 560px);
    width: 100%;
    gap: 10px;
  }

  .whatsapp-card {
    --content-width: 82%;
    width: var(--preview-card-size);
    aspect-ratio: 1 / 1.14;
    padding: 4px 0 14px;
  }

  .preview-wrap {
    width: calc(var(--preview-card-size) + 2px);
  }

  .brand-strip {
    height: 54px;
    width: var(--content-width);
  }

  .gas-brasil-logo {
    width: min(208px, 45.54%);
  }

  .sindigas-logo {
    width: min(136px, 29.1%);
  }

  .card-stage {
    padding: 20px;
    row-gap: 12px;
  }

  .card-stage-wrap {
    margin-bottom: 18px;
  }

  .portal-badge {
    width: clamp(106px, 23vw, 126px);
    height: clamp(62px, 13vw, 74px);
    left: clamp(-32px, -7vw, -22px);
    top: clamp(10px, 2vw, 14px);
  }

  .portal-badge-face {
    inset: 5%;
  }

  .portal-badge-mid {
    height: 90%;
  }

  .portal-badge-light {
    height: 88%;
  }

  .media-frame {
    max-height: none;
  }

  #portal-logo-placeholder {
    font-size: 16px;
  }

  #news-title {
    margin-top: 8px;
    font-size: clamp(20px, 4.4vw, 26px);
    -webkit-line-clamp: 5;
    line-clamp: 5;
  }

  .link-pill {
    padding: 5px 15px;
    font-size: clamp(1rem, 3.8vw, 1.1rem);
  }

  .export-actions {
    width: min(92vw, 560px);
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 560px) {
  .preview-panel {
    --preview-card-size: 92vw;
  }

  .whatsapp-card {
    --content-width: 84%;
    aspect-ratio: 1 / 1.2;
  }

  .brand-strip {
    height: 48px;
    padding: 0 16px;
  }

  .card-stage {
    padding: 16px;
  }

  .card-stage-wrap {
    margin-bottom: 12px;
  }

  .portal-badge {
    width: clamp(94px, 25vw, 114px);
    height: clamp(55px, 14vw, 66px);
    left: clamp(-28px, -8vw, -18px);
    top: 10px;
  }

  .portal-badge-face {
    inset: 5%;
  }

  .portal-badge-mid {
    height: 90%;
  }

  .portal-badge-light {
    height: 88%;
  }

  #news-title {
    -webkit-line-clamp: 5;
    line-clamp: 5;
  }

  .export-button {
    font-size: 0.95rem;
    padding: 10px;
  }
}
