/* =====================================================================
   CALMON.system — website styles
   Mobile-first, but inline styles in JSX define the desktop baseline.
   This file extends with classes + media queries that override inline
   styles using attribute-selector specificity bumps where needed.
   ===================================================================== */

@import url('./colors_and_type.css');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-canvas);
  color: var(--fg-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: rgba(34, 211, 238, 0.18);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--accent); color: var(--bg-canvas); }

/* =====================================================================
   CONTAINER
   ===================================================================== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }

/* =====================================================================
   BRAND UTILITIES
   ===================================================================== */
.gt { color: var(--accent); font-family: var(--font-mono); font-weight: 700; }
.dot { color: var(--accent); }
.cur::after {
  content: '_';
  color: var(--accent);
  font-family: var(--font-mono);
  margin-left: 2px;
  animation: cb 1.06s steps(1, end) infinite;
}
@keyframes cb { 0%, 50% { opacity: 1 } 51%, 100% { opacity: 0 } }

.mono-cap {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.mono-cap.muted { color: var(--fg-3); }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all 120ms var(--ease);
  min-height: 44px;
  white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--bg-canvas); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); }
.btn.ghost { background: transparent; color: var(--fg-1); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn.ghost:active { background: var(--surface-1); }

/* =====================================================================
   GRID BACKDROP (hero)
   ===================================================================== */
.grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* =====================================================================
   JEFF FRAME (used on founder portrait)
   ===================================================================== */
.jeff-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-1);
}
.jeff-frame img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(8%) contrast(1.05) brightness(0.95);
  transition: filter 600ms var(--ease), transform 600ms var(--ease);
}
.jeff-frame:hover img { filter: grayscale(0%) contrast(1.08) brightness(1); transform: scale(1.02); }
.jeff-frame .corners::before,
.jeff-frame .corners::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border: 1px solid var(--accent); pointer-events: none;
}
.jeff-frame .corners::before { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.jeff-frame .corners::after { bottom: 8px; right: 8px; border-left: none; border-top: none; }
.jeff-frame .scan {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(34,211,238,0.12) 50%, transparent 100%);
  mix-blend-mode: screen; opacity: 0; animation: scan 6s ease-in-out infinite;
}
@keyframes scan { 0%, 100% { transform: translateY(-100%); opacity: 0 } 45%, 55% { opacity: 0.5 } 50% { transform: translateY(100%) } }
.jeff-frame .badge {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--accent); background: rgba(10,14,19,0.7); backdrop-filter: blur(8px);
  padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(34,211,238,0.3);
}
.jeff-frame .meta {
  position: absolute; bottom: 12px; left: 12px;
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-2);
  background: rgba(10,14,19,0.7); backdrop-filter: blur(8px);
  padding: 4px 8px; border-radius: 4px;
  letter-spacing: 0.06em;
}

/* =====================================================================
   HERO LAYOUT
   ===================================================================== */
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  align-items: center;
}
.hero-portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-1);
}
.hero-portrait img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  filter: grayscale(20%) contrast(1.05) brightness(0.95);
}
.hero-portrait::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 50%, rgba(10,14,19,0.7) 100%);
}
.hero-portrait .corners::before,
.hero-portrait .corners::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 1px solid var(--accent); pointer-events: none; z-index: 2;
}
.hero-portrait .corners::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.hero-portrait .corners::after { bottom: 12px; right: 12px; border-left: none; border-top: none; }
.hero-portrait .tag {
  position: absolute; bottom: 16px; left: 16px; z-index: 2;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-1);
  display: flex; flex-direction: column; gap: 2px;
}
.hero-portrait .tag .name { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.hero-portrait .tag .role { color: var(--accent); letter-spacing: 0.06em; }

/* hero ghost portrait — DEPRECATED */
.hero-ghost { display: none !important; }

/* =====================================================================
   FOUNDER
   ===================================================================== */
.founder { display: grid; grid-template-columns: 280px 1fr; gap: 64px; align-items: center; }
.founder .portrait { width: 280px; aspect-ratio: 4 / 5; }
.founder .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; }
.founder .stat {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
}
.founder .stat .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 6px; }
.founder .stat .v { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--fg-1); }
.founder .stat .v .acc { color: var(--accent); }

/* =====================================================================
   CTA PORTRAIT
   ===================================================================== */
.cta-portrait {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--border); width: 180px; justify-self: center;
}
.cta-portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(15%) contrast(1.05); }
.cta-portrait::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(10,14,19,0.7) 100%);
}
.cta-portrait .sig {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-1);
  display: flex; justify-content: space-between; align-items: baseline;
}
.cta-portrait .sig .name { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--fg-1); }
.cta-portrait .sig .role { color: var(--accent); }

/* =====================================================================
   NAV — desktop default, mobile hamburger
   ===================================================================== */
.nav-links { display: flex; gap: 24px; margin-left: 32px; font-size: 14px; color: var(--fg-2); }
.nav-cta { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.nav-version { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.04em; }
.nav-hamburger { display: none; }
.nav-mobile-drawer { display: none; }

/* =====================================================================
   STICKY CTA (mobile only)
   ===================================================================== */
.sticky-cta { display: none; }

/* =====================================================================
   SECTION CLASSES — for media-query targeting
   We add these via JSX to enable mobile overrides
   ===================================================================== */
.section { padding: 128px 0; }
.section.section-alt { background: var(--surface-0); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 48px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--fg-1);
  margin: 0 0 64px;
  max-width: 760px;
}

/* =====================================================================
   CARDS
   ===================================================================== */
.svc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.cases-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ===== CASE CARD ===== */
.case-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}
.case-card:hover { border-color: var(--border-strong); }
.case-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.case-id {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.18);
  padding: 4px 8px; border-radius: var(--r-sm);
}
.case-tag {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.06em; color: var(--fg-3);
}
.case-client {
  font-family: var(--font-display); font-weight: 600;
  font-size: 15px; color: var(--fg-1); letter-spacing: -0.005em;
}
.case-row {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.case-label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.case-label-bad { color: var(--danger); }
.case-gargalo {
  margin: 0;
  font-size: 15px; line-height: 1.55;
  color: var(--fg-2);
}
.case-solucao {
  margin: 0;
  font-family: var(--font-display); font-weight: 500;
  font-size: 18px; line-height: 1.4;
  color: var(--fg-1); letter-spacing: -0.01em;
}
.case-metric {
  margin-top: 4px;
  display: inline-flex; align-items: baseline; gap: 8px;
  align-self: flex-start;
  padding: 10px 14px;
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.24);
  border-radius: var(--r-md);
}
.case-metric-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: 22px; letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
}
.case-metric-label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; color: var(--fg-2);
}
.process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; position: relative; }
.process-line { position: absolute; top: 14px; left: 0; right: 0; height: 1px; background: var(--border); }

.cta-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 64px;
  display: grid;
  grid-template-columns: 1.4fr 180px 1fr;
  gap: 48px;
  align-items: center;
}

.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 48px; margin-bottom: 64px; }

/* =====================================================================
   ANIMATION / MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =====================================================================
   ====================  MOBILE / TABLET BREAKPOINTS  ==================
   ===================================================================== */

/* ----- TABLET (1024px) ----- */
@media (max-width: 1024px) {
  .container { padding: 0 24px; }
  .svc-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr repeat(2, 1fr); gap: 32px; }
  .cta-wrap { padding: 48px; grid-template-columns: 1.4fr 1fr; gap: 32px; }
  .cta-portrait { display: none; }
}

/* ----- MOBILE LANDSCAPE / SMALL TABLET (768px) ----- */
@media (max-width: 768px) {
  .container { padding: 0 20px; }

  /* sections breathe less but still breathe */
  .section { padding: 72px 0 !important; }
  [data-section] { padding: 72px 0 !important; }

  /* hero collapse — text first, photo after */
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-portrait {
    max-width: 100%;
    aspect-ratio: 16 / 11;
    order: 2;
  }
  .hero-portrait img { object-position: center 25%; }
  .hero-portrait .tag .name { font-size: 16px; }

  /* nav — hide desktop links, show hamburger */
  .nav-links { display: none; }
  .nav-cta .btn { display: none; }
  .nav-version { display: none; }
  .nav-hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-left: auto;
    background: transparent; border: 1px solid var(--border-strong);
    border-radius: var(--r-md); color: var(--fg-1);
    cursor: pointer;
  }
  .nav-hamburger:hover { background: var(--surface-2); }
  .nav-hamburger svg { width: 20px; height: 20px; stroke-width: 2; }

  /* mobile drawer */
  .nav-mobile-drawer.open {
    display: flex; flex-direction: column;
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: rgba(10, 14, 19, 0.98);
    backdrop-filter: blur(20px);
    z-index: 49;
    padding: 32px 20px 120px;
    gap: 4px;
    animation: drawerIn 240ms var(--ease);
  }
  .nav-mobile-drawer a {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--fg-1);
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .nav-mobile-drawer a::after {
    content: '→'; color: var(--accent); font-family: var(--font-mono);
  }
  .nav-mobile-drawer .drawer-cta {
    margin-top: 24px;
    background: var(--accent);
    color: var(--bg-canvas);
    border-radius: var(--r-md);
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 500;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border-bottom: none;
  }
  .nav-mobile-drawer .drawer-cta::after { display: none; }
  body.nav-open { overflow: hidden; }

  @keyframes drawerIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
  }

  /* type scale mobile */
  .section-title,
  h2[data-h2] {
    font-size: 32px !important;
    line-height: 1.1 !important;
    margin-bottom: 40px !important;
  }

  /* hero headline scale */
  [data-hero-h1] {
    font-size: clamp(36px, 9vw, 48px) !important;
    line-height: 1.08 !important;
  }
  [data-hero-sub] {
    font-size: 16px !important;
    max-width: 100% !important;
  }
  [data-hero-cta] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  [data-hero-cta] .btn { width: 100%; justify-content: center; padding: 14px 20px; }

  /* services / cases / process — single column */
  .svc-grid { grid-template-columns: 1fr; gap: 12px; }
  [data-svc-card] { padding: 24px !important; }

  .cases-grid { grid-template-columns: 1fr; gap: 16px; }
  .case-card { padding: 24px; gap: 18px; }
  .case-head { flex-direction: row; align-items: flex-start; }
  .case-client { font-size: 16px; line-height: 1.3; }
  .case-row { gap: 8px; padding-top: 14px; }
  .case-gargalo { font-size: 16px; line-height: 1.55; }
  .case-solucao { font-size: 19px; line-height: 1.35; }
  .case-metric { padding: 12px 16px; gap: 10px; align-self: stretch; }
  .case-metric-num { font-size: 26px; }
  .case-metric-label { font-size: 12px; }

  /* process — vertical with connector line */
  .process-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-left: 32px;
    position: relative;
  }
  .process-line {
    top: 0; bottom: 0; left: 14px; right: auto;
    height: auto; width: 1px;
  }
  .process-grid > * {
    padding: 0 !important;
    background: transparent !important;
    position: relative;
  }
  .process-grid > * > div:first-child {
    margin-bottom: 12px !important;
    margin-left: -32px !important;
  }

  /* founder */
  .founder {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .founder .portrait { width: 100%; max-width: 280px; margin: 0 auto; }
  [data-founder-h2] {
    font-size: 36px !important;
    line-height: 1.1 !important;
  }
  .founder .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .founder .stat { padding: 14px; }
  .founder .stat .v { font-size: 18px; }

  /* CTA */
  .cta-wrap {
    grid-template-columns: 1fr;
    padding: 32px;
    gap: 28px;
  }
  .cta-portrait { display: none; }
  [data-cta-h2] {
    font-size: 28px !important;
    line-height: 1.15 !important;
  }
  [data-cta-info] { font-size: 12px !important; }

  /* footer */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px 20px;
    margin-bottom: 40px;
  }
  [data-footer-brand] {
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }
  [data-footer-bottom] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* sticky CTA bottom — visible on mobile only */
  .sticky-cta {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 40;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(10, 14, 19, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    gap: 12px;
    align-items: center;
    transition: transform 240ms var(--ease), opacity 240ms var(--ease);
  }
  .sticky-cta.hide {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
  }
  .sticky-cta .label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-3);
    letter-spacing: 0.06em;
    flex: 1;
    line-height: 1.3;
  }
  .sticky-cta .label strong { color: var(--fg-1); font-weight: 500; }
  .sticky-cta .btn {
    padding: 12px 16px;
    font-size: 13px;
    flex-shrink: 0;
  }
  /* space at the end so sticky CTA doesn't overlap footer */
  body { padding-bottom: 72px; }
}

/* ----- SMALL PHONES (≤ 380px iPhone SE) ----- */
@media (max-width: 380px) {
  .container { padding: 0 16px; }
  .section { padding: 56px 0 !important; }
  [data-section] { padding: 56px 0 !important; }
  [data-hero-h1] { font-size: 34px !important; }
  .section-title { font-size: 28px !important; }
  [data-founder-h2] { font-size: 30px !important; }
  [data-cta-h2] { font-size: 24px !important; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ----- TOUCH DEVICES — kill hover artifacts ----- */
@media (hover: none) {
  .jeff-frame:hover img { filter: grayscale(8%) contrast(1.05) brightness(0.95); transform: none; }
  .btn.primary:hover { background: var(--accent); }
  .btn.ghost:hover { background: transparent; border-color: var(--border-strong); color: var(--fg-1); }
}
