/* =========================================================
   Colo Pediatria — Design Tokens
   Colors, type, spacing, radii, shadows, motion.
   Use as <link rel="stylesheet" href="colors_and_type.css">
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Nunito:wght@400;500;600;700;800&family=Caveat:wght@400;600;700&display=swap');

:root {
  /* ---------- Brand color families (primary + tag) ---------- */
  /* Sampled directly from the eight logo PNGs. */

  --colo-blue:           #9BC2E7;
  --colo-blue-tag:       #9ABDC6;

  --colo-pink:           #E79BC4;
  --colo-pink-tag:       #B69BC9;

  --colo-sand:           #E8C79A;
  --colo-sand-tag:       #C5AE99;

  --colo-sage:           #A4D498;
  --colo-sage-tag:       #BEC99A;

  --colo-lavender:       #A299CB;
  --colo-lavender-tag:   #989BC7;

  --colo-coral:          #E7A59C;
  --colo-coral-tag:      #CA9AB5;

  --colo-aqua:           #9AD8E1;
  --colo-aqua-tag:       #C9C799;

  --colo-olive:          #C5BE99;
  --colo-olive-tag:      #99C9A5;

  /* Tinted "wash" surfaces — 18% strength, on cream */
  --colo-blue-50:        #EAF2F9;
  --colo-pink-50:        #FAEAF2;
  --colo-sand-50:        #FBF1E1;
  --colo-sage-50:        #ECF6E7;
  --colo-lavender-50:    #ECEAF4;
  --colo-coral-50:       #FBE9E5;
  --colo-aqua-50:        #E8F6F8;
  --colo-olive-50:       #F1EFE0;

  /* ---------- Theme: blue is the default house family ---------- */
  --brand:               var(--colo-blue);
  --brand-tag:           var(--colo-blue-tag);
  --brand-50:            var(--colo-blue-50);

  /* ---------- Neutrals ---------- */
  --bg:                  #FFFAF3;   /* cream, never pure white */
  --bg-alt:              #FAF3E8;   /* slightly warmer surface */
  --ink:                 #3A2E2A;   /* warm brown-grey, never pure black */
  --ink-2:               #6B5C56;   /* secondary text */
  --ink-3:               #9A8A82;   /* tertiary / placeholder */
  --line:                rgba(58, 46, 42, 0.08); /* whisper-quiet borders */
  --line-2:              rgba(58, 46, 42, 0.14);

  /* ---------- Semantic / state ---------- */
  --ok:                  #7BB36A;   /* dusty sage */
  --ok-bg:               #ECF6E7;
  --warn:                #D9A85A;   /* dusty sand */
  --warn-bg:             #FBF1E1;
  --err:                 #C77264;   /* dusty coral */
  --err-bg:              #FBE9E5;
  --info:                #6FA6CF;   /* dusty blue */
  --info-bg:             #EAF2F9;

  /* ---------- Type ---------- */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body:    'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-hand:    'Caveat', 'Bradley Hand', cursive;

  /* fluid-ish type scale, body=16 */
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;
  --fs-40: 2.5rem;
  --fs-56: 3.5rem;
  --fs-72: 4.5rem;

  --lh-tight:  1.1;
  --lh-snug:   1.25;
  --lh-normal: 1.5;
  --lh-loose:  1.7;

  --tracking-tight:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.04em;

  /* ---------- Spacing scale (4px base) ---------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* ---------- Radii ---------- */
  --r-sm:   8px;
  --r-md:   16px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-pill: 999px;

  /* ---------- Shadows (warm-tinted, never grey-black) ---------- */
  --shadow-sm: 0 1px 2px rgba(58, 46, 42, 0.06), 0 2px 6px rgba(58, 46, 42, 0.04);
  --shadow-md: 0 2px 6px rgba(58, 46, 42, 0.06), 0 8px 24px rgba(58, 46, 42, 0.06);
  --shadow-lg: 0 8px 24px rgba(58, 46, 42, 0.08), 0 24px 48px rgba(58, 46, 42, 0.08);
  --shadow-focus: 0 0 0 3px rgba(155, 194, 231, 0.45); /* blue family default */

  /* ---------- Motion ---------- */
  --ease:   cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1:  180ms;
  --dur-2:  280ms;
  --dur-3:  480ms;

  /* ---------- Layout ---------- */
  --container: 1100px;
  --container-narrow: 720px;
}

/* =========================================================
   Base / element styles — opt-in via class on <body>
   .colo-base sets the document-level defaults
   ========================================================= */

.colo-base {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Foco visível para qualquer elemento interativo (acessibilidade) */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Respeita usuários que reduziram movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Semantic type roles */
.h-display, .colo-base h1.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
}

.h1, .colo-base h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
  margin: 0;
}
.h2, .colo-base h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-32);
  line-height: var(--lh-snug);
  color: var(--ink);
  text-wrap: balance;
  margin: 0;
}
.h3, .colo-base h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-24);
  line-height: var(--lh-snug);
  color: var(--ink);
  margin: 0;
}
.h4, .colo-base h4 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-18);
  line-height: var(--lh-snug);
  color: var(--ink);
  margin: 0;
}
.p, .colo-base p {
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--lh-normal);
  color: var(--ink);
  margin: 0;
}
.lede {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-20);
  line-height: var(--lh-normal);
  color: var(--ink-2);
  text-wrap: pretty;
}
.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-3);
}
.handwritten {
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: var(--fs-24);
  color: var(--brand-tag);
}
.small, .caption {
  font-size: var(--fs-14);
  color: var(--ink-2);
}

/* Surfaces */
.surface {
  background: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.surface-tinted {
  background: var(--brand-50);
  border-radius: var(--r-md);
}
.bg-paper {
  background-image:
    radial-gradient(rgba(58,46,42,0.018) 1px, transparent 1px),
    radial-gradient(rgba(58,46,42,0.012) 1px, transparent 1px);
  background-size: 24px 24px, 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* Buttons */
.btn {
  --btn-fg: var(--ink);
  --btn-bg: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: var(--fs-16);
  font-weight: 700;
  line-height: 1;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: var(--shadow-sm); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn--ghost {
  --btn-bg: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line-2);
}
.btn--ghost:hover {
  background: var(--brand-50);
  box-shadow: inset 0 0 0 1.5px var(--brand);
}
.btn--soft {
  --btn-bg: var(--brand-50);
  color: var(--ink);
  box-shadow: none;
}
.btn--soft:hover { background: color-mix(in oklab, var(--brand) 25%, var(--bg)); box-shadow: var(--shadow-sm); }

/* Inputs */
.input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: var(--fs-16);
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: rgba(58, 46, 42, 0.2); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }

/* Cards */
.card {
  background: var(--bg);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Pills / badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 6px 14px;
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink);
  background: var(--brand-50);
  border-radius: var(--r-pill);
}

/* =========================================================
   Drawer responsivo: side em desktop, bottom-sheet em mobile
   ========================================================= */
.drawer-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 92vw;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  overflow-y: auto;
  padding: var(--s-6);
  border-radius: 0;
}
@media (max-width: 720px) {
  .drawer-panel {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: var(--s-5);
  }
}

/* Tabs scrolláveis em mobile */
@media (max-width: 720px) {
  .tabs-bar {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs-bar::-webkit-scrollbar { display: none; }
}

/* Header colapsável em mobile */
@media (max-width: 720px) {
  .app-header-grid {
    grid-template-columns: 1fr !important;
    gap: var(--s-3) !important;
    padding: var(--s-4) var(--s-4) !important;
  }
  .app-header-radar { justify-self: stretch !important; max-width: 100% !important; }
  .page-shell { padding: var(--s-4) !important; }
}

/* =========================================================
   Conflitos: outline pulsante coral nos blocos conflitantes
   ========================================================= */
@keyframes colo-pulse-conflict {
  0%, 100% { box-shadow: 0 0 0 0 rgba(199, 114, 100, 0.55), inset 0 0 0 2px var(--err); }
  50%      { box-shadow: 0 0 0 8px rgba(199, 114, 100, 0),    inset 0 0 0 2px var(--err); }
}
.bloco-em-conflito {
  outline: 2px solid var(--err);
  outline-offset: -2px;
  animation: colo-pulse-conflict 2.4s var(--ease) infinite;
  z-index: 5 !important;
}
.bloco-em-conflito-aceito {
  outline: 1px dashed var(--err);
  outline-offset: -1px;
  z-index: 3 !important;
}

@keyframes colo-banner-shine {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.banner-conflitos {
  background: linear-gradient(90deg, var(--err-bg) 0%, #FBE0DC 50%, var(--err-bg) 100%);
  background-size: 200% 100%;
  animation: colo-banner-shine 4s linear infinite;
  border-bottom: 2px solid var(--err);
}

/* Theme helpers — drop on a section to switch the family */
.theme-blue     { --brand: var(--colo-blue);     --brand-tag: var(--colo-blue-tag);     --brand-50: var(--colo-blue-50);     --shadow-focus: 0 0 0 3px rgba(155,194,231,0.45); }
.theme-pink     { --brand: var(--colo-pink);     --brand-tag: var(--colo-pink-tag);     --brand-50: var(--colo-pink-50);     --shadow-focus: 0 0 0 3px rgba(231,155,196,0.45); }
.theme-sand     { --brand: var(--colo-sand);     --brand-tag: var(--colo-sand-tag);     --brand-50: var(--colo-sand-50);     --shadow-focus: 0 0 0 3px rgba(232,199,154,0.5); }
.theme-sage     { --brand: var(--colo-sage);     --brand-tag: var(--colo-sage-tag);     --brand-50: var(--colo-sage-50);     --shadow-focus: 0 0 0 3px rgba(164,212,152,0.5); }
.theme-lavender { --brand: var(--colo-lavender); --brand-tag: var(--colo-lavender-tag); --brand-50: var(--colo-lavender-50); --shadow-focus: 0 0 0 3px rgba(162,153,203,0.5); }
.theme-coral    { --brand: var(--colo-coral);    --brand-tag: var(--colo-coral-tag);    --brand-50: var(--colo-coral-50);    --shadow-focus: 0 0 0 3px rgba(231,165,156,0.5); }
.theme-aqua     { --brand: var(--colo-aqua);     --brand-tag: var(--colo-aqua-tag);     --brand-50: var(--colo-aqua-50);     --shadow-focus: 0 0 0 3px rgba(154,216,225,0.5); }
.theme-olive    { --brand: var(--colo-olive);    --brand-tag: var(--colo-olive-tag);    --brand-50: var(--colo-olive-50);    --shadow-focus: 0 0 0 3px rgba(197,190,153,0.5); }
