/* ============================================================= */
/* HelloBrivio — Responsive Design System                        */
/* QuickImageTools implementation (ported from the QuickPDFTools  */
/* reference so the QuickTools family shares one visual language).*/
/* Mobile-first. Organized: Tokens, Base, Utilities, Layout,     */
/* Navigation, Typography, Buttons, Cards, Upload, Forms,        */
/* SEO content, Preview, Feedback, Result, Footer, Image Tools,  */
/* Responsive Rules, Reduced-motion.                             */
/* ============================================================= */

/* ============================================================= */
/* DESIGN TOKENS                                                 */
/* ============================================================= */

:root {
  --brand: #e5322d;
  --brand-dark: #c62823;
  --ink: #222;
  --text: #333;
  --muted: #777;
  --muted-2: #888;
  --line: #e6e6e6;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --success: #2e7d32;
  --danger: #c0392b;

  /* 8px spacing scale */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 60px;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 22px rgba(0, 0, 0, 0.12);
  --tap: 44px; /* minimum touch target */
  --maxw: 1100px;
}

/* ============================================================= */
/* BASE                                                          */
/* ============================================================= */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  text-align: center;
  line-height: 1.5;
  overflow-x: hidden; /* never allow horizontal scroll */
}

img {
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================= */
/* UTILITIES                                                     */
/* ============================================================= */

.hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 2000;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.upload-box:focus-visible,
.upload-area:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ============================================================= */
/* LAYOUT                                                        */
/* ============================================================= */

.main-container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s5) var(--s2);
}

/* ============================================================= */
/* NAVIGATION                                                    */
/* ============================================================= */

.topbar {
  background: var(--surface);
  padding: 14px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-wrapper {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s2);
}

.logo a {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
}

/* Desktop nav — hidden on mobile (mobile-first) */
.nav-desktop {
  display: none;
  gap: var(--s3);
}

.nav-desktop a {
  color: var(--text);
  font-weight: 600;
  padding: 8px 4px;
  transition: color 0.2s ease;
}

.nav-desktop a:hover {
  color: var(--brand);
  text-decoration: none;
}

.nav-desktop a[aria-current="page"] {
  color: var(--brand);
}

/* Hamburger button */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--tap);
  height: var(--tap);
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Overlay behind the drawer */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 1100;
}

.nav-open .nav-overlay {
  opacity: 1;
}

/* Slide-in drawer */
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(80vw, 320px);
  background: var(--surface);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  padding: 70px var(--s3) var(--s3);
  text-align: left;
}

.nav-open .nav-drawer {
  transform: translateX(0);
}

.nav-drawer a {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  border-bottom: 1px solid var(--line);
}

.nav-drawer a:hover,
.nav-drawer a[aria-current="page"] {
  color: var(--brand);
  text-decoration: none;
}

.nav-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: var(--tap);
  height: var(--tap);
  font-size: 30px;
  line-height: 1;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
}

/* Lock page scroll while the drawer is open */
.nav-open {
  overflow: hidden;
}

/* ============================================================= */
/* TYPOGRAPHY                                                    */
/* ============================================================= */

h1 {
  font-size: clamp(26px, 6vw, 40px);
  line-height: 1.15;
  margin-bottom: var(--s1);
  color: var(--ink);
}

h2 {
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1.25;
}

h3 {
  font-size: clamp(18px, 3vw, 22px);
}

.subtitle {
  color: var(--muted);
  margin-bottom: var(--s4);
  font-size: clamp(15px, 2.5vw, 18px);
}

/* ============================================================= */
/* BUTTONS                                                       */
/* ============================================================= */

.main-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin: var(--s3) 0;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
}

.main-btn:hover,
.btn:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.main-btn:active,
.btn:active {
  transform: translateY(1px);
}

.main-btn:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: #e9eaee;
}

.btn-success {
  background: var(--success);
}

.btn-success:hover {
  background: #256428;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #a03227;
}

.btn-block {
  width: 100%;
}

/* ============================================================= */
/* FEATURES                                                      */
/* ============================================================= */

.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s3);
  color: #666;
  font-size: 15px;
}

.feature {
  background: var(--surface-2);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}

/* ============================================================= */
/* CARDS + TOOL GRID                                             */
/* ============================================================= */

.tools-grid {
  display: grid;
  grid-template-columns: 1fr; /* mobile: 1 column */
  gap: var(--s3);
  max-width: 1000px;
  margin: var(--s5) auto;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  padding: 26px 20px;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: 1px solid #f0f0f0;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: var(--brand);
  border-color: var(--brand);
  text-decoration: none;
}

/* touch feedback on mobile */
.tool-card:active {
  transform: scale(0.98);
}

.tool-card::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 3px;
  background: var(--brand);
  transition: width 0.3s ease;
}

.tool-card:hover::after {
  width: 100%;
}

.tool-card-icon {
  font-size: 30px;
  line-height: 1;
}

.tool-card-title {
  font-size: 16px;
  font-weight: 700;
}

.tool-card-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.browse-tools {
  margin-top: var(--s3);
}

/* ============================================================= */
/* UPLOAD AREAS                                                  */
/* ============================================================= */

.upload-box,
.upload-area {
  display: block;
  border: 2px dashed #ccc;
  border-radius: var(--radius);
  padding: var(--s5) var(--s3);
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  max-width: 560px;
  margin: var(--s3) auto;
  min-height: var(--tap);
}

.upload-box:hover,
.upload-area:hover,
.upload-box.is-dragover,
.upload-area.is-dragover {
  background: var(--surface-2);
  border-color: var(--brand);
}

/* Big upload icon (added via ::before on the label/box) */
.upload-area::before,
.upload-box::before {
  content: "⬆";
  display: block;
  font-size: 40px;
  color: var(--brand);
  margin-bottom: var(--s1);
  line-height: 1;
}

.upload-text {
  font-size: 16px;
  color: var(--text);
}

.upload-link,
.upload-text span {
  color: var(--brand);
  font-weight: 600;
}

#fileName,
.upload-content #fileName {
  margin-top: 10px;
  color: #666;
  font-size: 14px;
  word-break: break-word;
}

.file-info {
  font-size: 13px;
  color: var(--muted-2);
  margin-top: 10px;
  margin-bottom: var(--s4);
}

/* ============================================================= */
/* FORMS                                                         */
/* ============================================================= */

.options-box {
  margin: var(--s3) auto 0;
  padding: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafafa;
  text-align: left;
  max-width: 460px;
}

.field-label {
  display: block;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--ink);
}

.input-field,
.options-box input[type="text"],
.options-box input[type="number"],
.options-box input[type="password"],
.options-box select,
.options-box textarea {
  margin-top: var(--s1);
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
  font-size: 16px; /* >=16px prevents iOS zoom-on-focus */
  background: #fff;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

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

/* ============================================================= */
/* SEO CONTENT / STEPS / BENEFITS                                */
/* ============================================================= */

.seo-content {
  max-width: 800px;
  margin: var(--s6) auto;
  line-height: 1.7;
  color: #444;
  font-size: 16px;
  text-align: left;
}

.seo-content h2 {
  text-align: center;
}

.seo-content a {
  color: var(--brand);
}

.steps {
  max-width: 600px;
  margin: var(--s3) auto;
  text-align: left;
  line-height: 1.8;
  list-style: none;
  padding-left: 0;
}

.steps li {
  display: flex;
  align-items: center;
  margin: 12px 0;
  font-size: 16px;
}

.step-number {
  flex: 0 0 auto;
  background: var(--brand);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-right: 10px;
}

.benefits {
  max-width: 400px;
  margin: var(--s3) auto;
  text-align: left;
  color: #444;
  line-height: 1.6;
  list-style: none;
  padding-left: 0;
}

.benefits li {
  margin: var(--s1) 0;
}

.benefits a {
  color: var(--brand);
}

/* ============================================================= */
/* RELATED TOOLS (mini grid)                                     */
/* ============================================================= */

.more-tools {
  margin-top: var(--s5);
}

.tools-links {
  margin-top: var(--s4);
}

.tools-mini-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: var(--s2);
}

.tools-mini-grid a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  background: #f3f3f3;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
}

.tools-mini-grid a:hover {
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}

/* ============================================================= */
/* PREVIEW AREAS                                                 */
/* ============================================================= */

.relative-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

/* Generic responsive preview image / canvas */
.preview-image {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ============================================================= */
/* FEEDBACK (spinner + progress + messages)                     */
/* ============================================================= */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #eee;
  border-top: 4px solid var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: var(--s4) auto;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.status-msg {
  color: var(--brand);
  font-weight: 600;
  margin: var(--s2) 0;
}

.error-msg {
  color: var(--danger);
  font-weight: 600;
  margin: var(--s2) 0;
}

/* ============================================================= */
/* RESULT                                                        */
/* ============================================================= */

.result-box {
  background: var(--surface);
  padding: var(--s4);
  display: inline-block;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  text-align: center;
}

.result-box .success {
  color: var(--success);
  font-size: 18px;
  margin-bottom: var(--s3);
}

.ad-container {
  margin: var(--s4) auto;
  max-width: 100%;
  overflow-x: hidden;
}

.ad-label {
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 4px;
}

/* ============================================================= */
/* FOOTER                                                        */
/* ============================================================= */

.footer {
  margin-top: var(--s6);
  padding: var(--s5) var(--s2) var(--s3);
  background: #f2f2f2;
  font-size: 14px;
  color: #666;
}

.footer-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr; /* mobile: single column */
  gap: var(--s3);
  text-align: left;
}

.footer-col {
  display: flex;
  flex-direction: column;
}

.footer-col h4 {
  margin: 0 0 var(--s1);
  font-size: 15px;
  color: var(--ink);
}

.footer-col a {
  color: #666;
  padding: 7px 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}

.footer-col a:hover {
  color: var(--brand);
  text-decoration: none;
}

.footer-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: var(--s1);
}

.footer-brand p {
  margin: 0 0 var(--s2);
  max-width: 320px;
}

.footer-ecosystem {
  font-size: 13px;
  color: var(--muted);
}

.footer-ecosystem strong {
  color: var(--brand);
}

.footer-social {
  display: flex;
  gap: 10px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  background: #e6e6e6;
  border-radius: 50%;
  color: var(--text);
  font-weight: 700;
}

.footer-social a:hover {
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}

.footer-bottom {
  max-width: var(--maxw);
  margin: var(--s3) auto 0;
  padding-top: var(--s2);
  border-top: 1px solid #ddd;
  text-align: center;
}

.footer-bottom p {
  margin: 4px 0;
}

/* ============================================================= */
/* COOKIE BANNER                                                 */
/* ============================================================= */

.cookie-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #222;
  color: #fff;
  padding: 16px 24px;
  z-index: 9999;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  text-align: left;
}

.cookie-banner.is-visible {
  display: flex;
}

.cookie-banner p {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.cookie-banner a {
  color: #aad4f5;
}

.cookie-actions {
  display: flex;
  gap: 10px;
}

.cookie-actions button {
  min-height: var(--tap);
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: #fff;
}

.cookie-accept {
  background: var(--brand);
}

.cookie-decline {
  background: #555;
}

/* ============================================================= */
/* IMAGE TOOLS — tool-specific components (built on tokens)      */
/* ============================================================= */

/* White interactive tool panel (resizer / background remover) */
.tool-panel {
  background: var(--surface);
  border: 1px solid #f0f0f0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s4) var(--s3);
  max-width: 520px;
  margin: var(--s4) auto;
}

/* Social-media preset chips (resizer) */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s2);
  margin: var(--s2) 0 var(--s3);
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: var(--tap);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.preset-btn small {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.preset-btn:hover {
  border-color: var(--brand);
}

.preset-btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.preset-btn[aria-pressed="true"] small {
  color: rgba(255, 255, 255, 0.85);
}

/* Reference data tables (social-media size guides) */
.table-wrap {
  overflow-x: auto; /* wide tables scroll inside their own box */
  max-width: 820px;
  margin: var(--s3) auto;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  text-align: left;
}

.data-table th,
.data-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.data-table th {
  background: var(--surface-2);
  color: var(--ink);
}

.data-table td.mono {
  font-family: "Courier New", monospace;
}

/* FAQ accordion (native <details>) */
.faq {
  max-width: 800px;
  margin: var(--s4) auto;
  text-align: left;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 var(--s2);
  margin-bottom: var(--s1);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 12px 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--brand);
  font-size: 22px;
  line-height: 1;
}

.faq details[open] summary::after {
  content: "\2013"; /* – */
}

.faq details[open] summary {
  color: var(--brand);
}

.faq p {
  margin: 0 0 var(--s2);
  color: var(--text);
  line-height: 1.7;
}

/* ============================================================= */
/* RESPONSIVE RULES                                              */
/* ============================================================= */

/* Small tablets / large phones: 2-column tool grid */
@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet: desktop nav appears, hamburger hides */
@media (min-width: 768px) {
  .nav-desktop {
    display: flex;
  }
  .nav-toggle {
    display: none;
  }
  .nav-drawer,
  .nav-overlay {
    display: none;
  }
  .main-container {
    padding: var(--s6) var(--s3);
  }
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop: 4-column tool grid + full footer */
@media (min-width: 1024px) {
  .nav-desktop {
    gap: var(--s4);
  }
  .tools-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  }
}

/* ============================================================= */
/* REDUCED MOTION                                                */
/* ============================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
