/* ==========================================================================
   Marcos Carlson — portfólio
   CSS modernizado: variáveis, Flexbox/Grid, responsivo mobile-first.
   Paleta e tipografia originais preservadas.
   ========================================================================== */

/* ---- Fontes originais do site (mesmos arquivos, mesma pasta /fonts) ---- */
@font-face {
  font-family: 'droid_sans_monoregular';
  src: url('../fonts/droid_sans_monoregular/droidsansmono-webfont.woff') format('woff'),
       url('../fonts/droid_sans_monoregular/droidsansmono-webfont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'paytone_oneregular';
  src: url('../fonts/paytone_oneregular/paytoneone-webfont.woff') format('woff'),
       url('../fonts/paytone_oneregular/paytoneone-webfont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'blackouttwo_am';
  src: url('../fonts/blackouttwo_am/blackout_twoam-webfont.woff') format('woff'),
       url('../fonts/blackouttwo_am/blackout_twoam-webfont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'radios-icons';
  src: url('../fonts/radios/type-icons-otimizada.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  color-scheme: light;
  --color-text: #555;
  --color-muted: #999;
  --color-accent: #d00;
  --color-bg: #fff;
  --font-mono: 'droid_sans_monoregular', monospace;
  --font-display: 'paytone_oneregular', sans-serif;
  --font-nav: 'blackouttwo_am', sans-serif;

  /* Ciclo de 30 cores originais (classes .cor01–.cor30 do site antigo) */
  --tag-1:  #008; --tag-2:  #080; --tag-3:  #800; --tag-4:  #088; --tag-5:  #808;
  --tag-6:  #880; --tag-7:  #048; --tag-8:  #084; --tag-9:  #408; --tag-10: #480;
  --tag-11: #804; --tag-12: #840; --tag-13: #448; --tag-14: #484; --tag-15: #844;
  --tag-16: #884; --tag-17: #848; --tag-18: #488; --tag-19: #00a; --tag-20: #0a0;
  --tag-21: #a00; --tag-22: #05a; --tag-23: #0a5; --tag-24: #50a; --tag-25: #5a0;
  --tag-26: #a05; --tag-27: #a50; --tag-28: #55a; --tag-29: #5a5; --tag-30: #a55;

  --sidebar-w: 21.25em; /* 340px na escala base — deriva só do clamp global do html, sem fórmula própria */
}

* { box-sizing: border-box; }

html {
  /* Escala fluida global: menu, rodapé e botões (tudo fora do cabeçalho,
     que tem sua própria escala maior) encolhem/crescem juntos e na mesma
     proporção conforme a largura da janela muda. */
  font-size: clamp(12px, .26vw + 11px, 16px);
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--color-bg, #fff);
  color: var(--color-text, #555);
  font-family: var(--font-display);
  line-height: 1.25;
}

a { color: var(--color-text, #555); text-decoration: none; }
a:hover, a:focus-visible { opacity: 1; text-decoration: underline; }
a[target="_blank"],
a[target="_blank"]:hover,
a[target="_blank"]:focus-visible,
a[target="_blank"]:visited { text-decoration: none; }
a:not(:hover):not(:focus-visible) { opacity: 0.75; }

/* Foco visível para navegação por teclado */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  padding: 8px 12px;
  z-index: 1000;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* ---- Header ---- */
#top {
  background: #fff url('../images/bg/linen/linen_inv_gr.png') repeat;
  background-position: center;
  /* Arquivo nativo em 256×256px. 16em bate exatamente nisso no teto da
     escala global (16px de base); no piso (12px), cai pra 192px — uma
     redução leve, imperceptível numa textura de fundo — mas acompanha
     a mesma escala de tudo o mais na página, como pedido. */
  background-size: 16em 16em;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(0, 0, 0, .12);
  box-shadow: 0 4px 6px -2px rgba(0, 0, 0, .25);
  position: relative;
  z-index: 5; /* garante que a sombra apareça por cima do conteúdo abaixo */
}

.top-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
  gap: 12px;
  padding: 10px 14px;
  /* Sem escala própria: herda o mesmo clamp global do html (ver topo do
     arquivo), garantindo que o cabeçalho cresça/encolha exatamente junto
     com o resto da página — não numa curva independente. */
}

.header-brand {
  display: contents;
}

.logo {
  display: flex;
  align-items: stretch;
  min-height: 0;
  height: 6em; /* mesmo valor explícito do .header-media, evita depender de "stretch" */
}
.logo img {
  display: block;
  height: 100%;
  width: auto;
}

/* Bloco central (imagem giratória + textos) e o selo, colados um ao
   outro, centralizados juntos no espaço que sobra ao lado da foto. */
.header-center {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 auto;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
}

.header-media {
  width: 27.5em; /* 440px na escala base (440/16) */
  max-width: 100%;
  min-width: 0;
  /* Altura fixa e explícita (rotator 2.5em + [até 2015] + VIDEO/MAC/
     JORNALISMO): a foto e o selo agora também usam altura explícita
     (ver .logo e .header-stamp) em vez de "esticar" via grid — por
     isso não precisa mais de overflow:hidden aqui (isso cortava
     VIDEO/MAC/JORNALISMO nas pontas, já que essa linha é um pouco
     mais larga que a imagem giratória). */
  height: 6em;
  min-height: 0;
}

.rotator-link {
  display: block;
}
.rotator {
  width: 100%;
  aspect-ratio: 440 / 40;
  overflow: hidden;
}
.rotator img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Selo no cabeçalho — sobreposto à borda direita da imagem giratória
   (onde termina "Carlson"), como um carimbo de verdade "pegando" no
   "n" final. Valores provisórios/modestos — a imagem nova (quadrada,
   recortada rente ao desenho) não deve precisar da compensação extrema
   da versão anterior (400×300, com muita margem transparente). Ajustar
   fino depois de ver o resultado real. */
.header-stamp {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  min-height: 0;
  height: 6em; /* mesmo valor explícito, evita depender de "stretch" */
  margin-left: -1.1em; /* mais um tanto de aproximação, sobre o ajuste anterior */
  position: relative;
  z-index: 1;
  overflow: visible;
}
.header-stamp img {
  display: block;
  height: 92%;
  width: auto;
  align-self: center;
  opacity: .9;
  transform: translateY(-.35em); /* um pouco mais alto em relação à giratória */
}

.ate2015 {
  font-family: var(--font-mono);
  font-size: .7em;
  color: var(--color-accent);
  margin: .4em 0 0;
  text-align: center;
}

.quicknav {
  display: flex;
  justify-content: center;
  gap: .9em;
  font-family: var(--font-nav);
  letter-spacing: .15em;
  font-size: 1.15em;
  margin-top: .7em;
}

/* ---- Coluna do menu: barra de ferramentas fixa (hambúrguer + voltar/
   avançar) em cima, fora da área que rola — nunca se move, nem some
   quando o menu vira gaveta em telas estreitas. ---- */
.sidebar-col {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  flex: 0 0 auto;
}

.sidebar-toolbar {
  display: flex;
  gap: .4em;
  padding: 8px 8px 4px;
}

.nav-btn {
  width: 2.1em;
  height: 2.1em;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text);
  font-size: 1.15em;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease;
}
.nav-btn:hover { background: rgba(0, 0, 0, .08); }
.nav-btn:active { background: rgba(0, 0, 0, .14); }
.nav-btn:disabled {
  opacity: .3;
  cursor: default;
  pointer-events: none;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: .2em;
  width: 2.1em;
  height: 2.1em;
  border: none;
  background: transparent;
  cursor: pointer;
}
.menu-toggle-bar {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

/* ---- Layout principal ---- */
.container {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.sidebar {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 12px 12px;
}

.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.content-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.footer {
  flex: 0 0 auto;
  width: 100%;
  font-family: var(--font-mono);
  font-size: .7em;
  letter-spacing: .05em;
  text-align: center;
  background: #fff;
  padding: 4px 0;
  display: flex;
  justify-content: center;
  gap: 16px;
}
.footer-link {
  color: var(--color-accent);
}
.footer-link:hover { text-decoration: none; }
.icon-wa {
  font-family: 'radios-icons';
  font-style: normal;
  font-size: 1.1em;
}

/* ---- Menu em árvore (details/summary nativos, sem jQuery) ---- */
.menu-tree {
  line-height: 1.1;
}
.menu-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 14px;
}
.menu-tree > ul { padding-left: 0; }

.menu-tree summary {
  cursor: pointer;
  list-style: none;
  letter-spacing: .03em;
  padding: 2px 0;
  opacity: .75;
}
.menu-tree summary:hover,
.menu-tree summary:focus-visible {
  opacity: 1;
}
.menu-tree summary::-webkit-details-marker,
.menu-tree summary::marker { display: none; content: ''; }

.menu-tree li > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
}

/* QUEM e seus links (redes sociais) ficam cinza, como no site original */
.quem > details > summary { color: var(--color-text); }
.subquem > a { color: #6f6f6f; }
#menu > li.quem { margin-bottom: 1em; }
.subquem-gap { margin-top: .8em; }

/* Cor por item, igual ao esquema original (classes cor01-cor60, aqui tag-1..tag-30) */
.tag-1 > details > summary, .tag-1 > a { color: var(--tag-1); }
.tag-2 > details > summary, .tag-2 > a { color: var(--tag-2); }
.tag-3 > details > summary, .tag-3 > a { color: var(--tag-3); }
.tag-4 > details > summary, .tag-4 > a { color: var(--tag-4); }
.tag-5 > details > summary, .tag-5 > a { color: var(--tag-5); }
.tag-6 > details > summary, .tag-6 > a { color: var(--tag-6); }
.tag-7 > details > summary, .tag-7 > a { color: var(--tag-7); }
.tag-8 > details > summary, .tag-8 > a { color: var(--tag-8); }
.tag-9 > details > summary, .tag-9 > a { color: var(--tag-9); }
.tag-10 > details > summary, .tag-10 > a { color: var(--tag-10); }
.tag-11 > details > summary, .tag-11 > a { color: var(--tag-11); }
.tag-12 > details > summary, .tag-12 > a { color: var(--tag-12); }
.tag-13 > details > summary, .tag-13 > a { color: var(--tag-13); }
.tag-14 > details > summary, .tag-14 > a { color: var(--tag-14); }
.tag-15 > details > summary, .tag-15 > a { color: var(--tag-15); }
.tag-16 > details > summary, .tag-16 > a { color: var(--tag-16); }
.tag-17 > details > summary, .tag-17 > a { color: var(--tag-17); }
.tag-18 > details > summary, .tag-18 > a { color: var(--tag-18); }
.tag-19 > details > summary, .tag-19 > a { color: var(--tag-19); }
.tag-20 > details > summary, .tag-20 > a { color: var(--tag-20); }
.tag-21 > details > summary, .tag-21 > a { color: var(--tag-21); }
.tag-22 > details > summary, .tag-22 > a { color: var(--tag-22); }
.tag-23 > details > summary, .tag-23 > a { color: var(--tag-23); }
.tag-24 > details > summary, .tag-24 > a { color: var(--tag-24); }
.tag-25 > details > summary, .tag-25 > a { color: var(--tag-25); }
.tag-26 > details > summary, .tag-26 > a { color: var(--tag-26); }
.tag-27 > details > summary, .tag-27 > a { color: var(--tag-27); }
.tag-28 > details > summary, .tag-28 > a { color: var(--tag-28); }
.tag-29 > details > summary, .tag-29 > a { color: var(--tag-29); }
.tag-30 > details > summary, .tag-30 > a { color: var(--tag-30); }

/* ---- Backdrop do menu mobile ---- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 20;
}

/* ==========================================================================
   O menu fica visível em qualquer largura, só encolhendo (--sidebar-w acima
   é fluido). A gaveta com hambúrguer só entra como último recurso, em
   telas muito estreitas onde nem uma coluna reduzida cabe mais — a barra
   de ferramentas (hambúrguer + voltar/avançar) nunca é escondida, para
   sempre dar acesso ao menu, mesmo com ele fechado.
   ========================================================================== */
@media (max-width: 360px) {
  .menu-toggle { display: flex; }

  .sidebar-col {
    position: relative;
    width: auto;
  }

  .sidebar-toolbar {
    position: relative;
    z-index: 35;
    background: #fff;
  }

  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 85vw;
    max-width: 320px;
    background: #fff;
    z-index: 30;
    box-shadow: 2px 0 12px rgba(0, 0, 0, .15);
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }

  .content { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
