/* =============================================================================
 * ALC App — UI mobile-first (iPhone). HTML/CSS/JS puro, sem framework.
 * Identidade OFICIAL ALC Group (marca-mãe): paleta Apple Pure, ZERO accent
 * colorido. Fundo pitch, texto cream, secundário steel. Tipografia Inter
 * (Black 900 wordmark, SemiBold 600 labels) + Instrument Serif italic (display).
 * Fontes embutidas localmente em fonts/ (@font-face) para funcionar offline.
 * ========================================================================== */

/* ---- Fontes locais (self-hosted p/ PWA offline) ---- */
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:900; font-display:swap;
  src:url('fonts/inter-900-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:900; font-display:swap;
  src:url('fonts/inter-900-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src:url('fonts/inter-600-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src:url('fonts/inter-600-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src:url('fonts/inter-400-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src:url('fonts/inter-400-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face{
  font-family:'Instrument Serif'; font-style:italic; font-weight:400; font-display:swap;
  src:url('fonts/instr-italic-latin.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face{
  font-family:'Instrument Serif'; font-style:italic; font-weight:400; font-display:swap;
  src:url('fonts/instr-italic-latin-ext.woff2') format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Tokens (Apple Pure — zero accent colorido) ---- */
:root {
  /* superfícies */
  --bg:          #0A0A0A;   /* pitch */
  --surface:     #141414;
  --surface-2:   #1a1a1a;
  --surface-3:   #222327;
  --border:      rgba(255, 255, 255, 0.08);
  --border-2:    rgba(255, 255, 255, 0.16);

  /* texto */
  --text:        #FAFAFA;   /* cream */
  --mist:        #E5E7EB;
  --text-dim:    #9ca3af;   /* secundário legível */
  --steel:       #6B7280;   /* steel oficial (labels, GROUP, dividers) */
  --text-faint:  #6B7280;

  /* neutro de destaque (substitui o antigo ouro) */
  --accent:      #FAFAFA;   /* cream */
  --accent-soft: rgba(255,255,255,0.10);
  --accent-line: rgba(255,255,255,0.22);

  --ok:          #FAFAFA;   /* status neutro */

  --font-ui:     'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif:  'Instrument Serif', Georgia, "Times New Roman", serif;

  --radius:      18px;
  --radius-sm:   12px;
  --shadow:      0 1px 2px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.45);
  --shadow-press:0 1px 2px rgba(0,0,0,0.6);

  /* safe-area do iPhone (notch / home indicator) */
  --sa-top:    env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left:   env(safe-area-inset-left, 0px);
  --sa-right:  env(safe-area-inset-right, 0px);
}

/* ---- Reset enxuto ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;             /* sem bounce estranho no shell */
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

/* ---- Layout raiz ---- */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: var(--sa-left);
  padding-right: var(--sa-right);
}

/* ---- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(var(--sa-top) + 14px) 20px 14px;
  background: linear-gradient(180deg, rgba(10,10,10,0.94), rgba(10,10,10,0.74));
  backdrop-filter: saturate(120%) blur(12px);
  -webkit-backdrop-filter: saturate(120%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* Mark oficial (globo + stamp ALC + GROUP), reversed p/ fundo escuro */
.brand-lockup { height: 38px; width: auto; display: block; }
.brand-lockup text { font-family: var(--font-ui); }
.brand-sub {
  font-size: 11px; color: var(--steel); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ghost-btn {
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  min-height: 40px;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.ghost-btn:active { transform: scale(0.96); background: var(--surface-3); }

/* ---- Conteúdo ---- */
.content {
  flex: 1;
  padding: 26px 20px 8px;
}
.hero { margin: 8px 2px 24px; }
.hero-kicker {
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--steel); font-weight: 600;
}
.hero-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--mist);
  font-size: 46px; line-height: 1.02; letter-spacing: -0.5px;
  margin-top: 10px;
}
.hero-sub { color: var(--text-dim); font-size: 15px; margin-top: 10px; }

/* ---- Grid de módulos ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 22px;
  min-height: 128px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: left;
  width: 100%;
  color: var(--text);
  transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease;
  -webkit-user-select: none; user-select: none;
}
.tile:active { transform: scale(0.97); box-shadow: var(--shadow-press); }
.tile.is-active { border-color: var(--accent-line); }
.tile.is-soon { opacity: 0.72; }

.tile-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-2);
  color: var(--mist);
}
.tile.is-active .tile-icon {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent-line);
  color: var(--text);
}
.tile-icon svg { width: 24px; height: 24px; display: block; }

.tile-body { display: flex; flex-direction: column; gap: 3px; }
.tile-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.tile-sub { font-size: 12.5px; color: var(--text-dim); line-height: 1.3; }

.tile-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
  color: var(--text-faint);
  background: var(--surface-3);
  border: 1px solid var(--border);
}
/* "Ativo" vira chip cream invertido (sem dourado) */
.tile.is-active .tile-badge {
  color: #0A0A0A;
  background: var(--text);
  border-color: transparent;
}

/* ---- Statusbar ---- */
.statusbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px calc(var(--sa-bottom) + 14px);
  color: var(--text-faint); font-size: 12px;
  border-top: 1px solid var(--border);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.03);
}
.dot.is-ok  { background: var(--mist); }
.dot.is-warn{ background: var(--steel); }

/* ---- Dica iOS ---- */
.ios-hint {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: end center;
  padding: 0 16px calc(var(--sa-bottom) + 18px);
  background: rgba(0,0,0,0.55);
}
.ios-hint[hidden] { display: none; }
.ios-hint-card {
  width: 100%; max-width: 440px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.ios-hint-card strong { font-size: 16px; }
.ios-hint-card p { color: var(--text-dim); font-size: 14px; margin: 8px 0 14px; line-height: 1.45; }
.ios-hint-card em { color: var(--text); font-style: normal; font-weight: 600; }
.ios-share {
  display: inline-block; padding: 0 6px; border-radius: 6px;
  background: var(--surface-3); color: var(--mist); font-weight: 600;
}

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(12px);
  bottom: calc(var(--sa-bottom) + 22px); z-index: 60;
  max-width: calc(100vw - 40px);
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Larguras maiores (tablet/desktop dev) ---- */
@media (min-width: 640px) {
  .content { max-width: 720px; margin: 0 auto; width: 100%; }
  .grid { gap: 16px; }
  .hero-title { font-size: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
