/* =================================================================
   Portfólio LVG — área de trabalho
   Ordem: tokens · base · cabeçalho · abertura · filtros ·
          área de trabalho · janelas · painel do projeto · dock ·
          responsivo · acessibilidade
   ================================================================= */

/* ---------- tokens ---------- */
:root {
  --bg: #F4F5F7;
  --bg-grid: rgba(19, 24, 33, .07);
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --chrome: #F7F8FA;
  --line: rgba(19, 24, 33, .10);
  --line-strong: rgba(19, 24, 33, .18);

  --text: #131821;
  --text-2: #4B5563;
  --text-3: #8A93A0;

  --accent: #2547E0;
  --accent-soft: #EDF0FE;
  --accent-text: #FFFFFF;

  --dot-red: #ED6A5E;
  --dot-amber: #F4BF4F;
  --dot-green: #61C554;

  --shadow-1: 0 1px 2px rgba(19, 24, 33, .05);
  --shadow-2: 0 12px 28px -18px rgba(19, 24, 33, .40);
  --shadow-3: 0 28px 60px -28px rgba(19, 24, 33, .48);
  --shadow-focus: 0 32px 70px -26px rgba(19, 24, 33, .55);

  --r-win: 14px;
  --r-md: 10px;
  --r-sm: 7px;

  --ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bar-h: 40px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme='dark'] {
  --bg: #0E1116;
  --bg-grid: rgba(255, 255, 255, .06);
  --surface: #171B22;
  --surface-2: #1C212A;
  --chrome: #1C212A;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .20);

  --text: #E9ECF1;
  --text-2: #A8B0BC;
  --text-3: #6E7783;

  --accent: #6C86FF;
  --accent-soft: rgba(108, 134, 255, .14);
  --accent-text: #0E1116;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 12px 28px -16px rgba(0, 0, 0, .8);
  --shadow-3: 0 28px 60px -24px rgba(0, 0, 0, .85);
  --shadow-focus: 0 32px 70px -22px rgba(0, 0, 0, .9);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--bg-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

button { font: inherit; color: inherit; cursor: pointer; }

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.shell { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* ---------- cabeçalho ---------- */
.topbar {
  position: sticky; top: 0; z-index: 400;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__in {
  display: flex; align-items: center; gap: 16px;
  min-height: 64px; padding: 10px 0;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }

.brand__sq {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--text); color: var(--surface);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 13px; font-weight: 500;
}

.brand__mark {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: .1em; color: var(--text-2);
}

.identity { text-align: center; flex: 1; min-width: 0; }

.identity__name {
  margin: 0; font-size: clamp(15px, 2.2vw, 19px); font-weight: 700;
  letter-spacing: -.02em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.identity__role {
  margin: 1px 0 0; font-size: 12.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.actions { display: flex; gap: 6px; flex: none; }

.iconbtn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--text-2);
  text-decoration: none;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.iconbtn:hover { color: var(--accent); border-color: var(--line-strong); }
.iconbtn[aria-disabled='true'] { opacity: .38; cursor: not-allowed; }
.iconbtn[aria-disabled='true']:hover { color: var(--text-2); border-color: var(--line); }

/* ---------- abertura ---------- */
.intro {
  position: fixed; inset: 0; z-index: 900;
  background: var(--bg);
  display: grid; place-items: center; text-align: center;
  transition: opacity .45s var(--ease), visibility .45s;
}
.intro[hidden] { display: none; }
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.intro__line { opacity: 0; transform: translateY(8px); }
.intro__line.is-in { animation: introIn .5s var(--ease) forwards; }

@keyframes introIn { to { opacity: 1; transform: none; } }

.intro__mark {
  font-family: var(--mono); font-size: 13px; letter-spacing: .28em;
  color: var(--accent); margin-bottom: 18px;
}
.intro__name {
  font-size: clamp(26px, 5.5vw, 44px); font-weight: 700;
  letter-spacing: -.035em; margin: 0;
}
.intro__role { font-size: 14px; color: var(--text-3); margin: 10px 0 0; }

.intro__skip {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: none; border: 0; font-size: 12px; color: var(--text-3);
  font-family: var(--mono); letter-spacing: .08em;
}
.intro__skip:hover { color: var(--text); }

/* ---------- barra de ferramentas ---------- */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 14px; flex-wrap: wrap;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.filter {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 7px 14px;
  font-size: 13px; color: var(--text-2);
  transition: all .16s var(--ease);
}
.filter:hover { border-color: var(--line-strong); color: var(--text); }
.filter[aria-pressed='true'] {
  background: var(--text); border-color: var(--text); color: var(--surface);
}

.hint {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--text-3); letter-spacing: .04em;
}

/* ---------- área de trabalho ---------- */
.desktop {
  position: relative;
  min-height: 60vh;
  padding-bottom: 92px;
}

/* ---------- janela ---------- */
.win {
  position: absolute;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-win);
  box-shadow: var(--shadow-1), var(--shadow-2);
  overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(.985);
  transition: box-shadow .2s var(--ease), opacity .38s var(--ease),
              transform .38s var(--ease), filter .25s var(--ease);
}
.win.is-mounted { opacity: 1; transform: none; }
.win.is-focused { box-shadow: var(--shadow-1), var(--shadow-focus); border-color: var(--line-strong); }
.win.is-dimmed { opacity: .3; filter: saturate(.4); }
.win.is-minimized { display: none; }
.win.is-closed { display: none; }

/* transição suave ao maximizar / restaurar */
.win.is-animating { transition: all .34s var(--ease); }

/* rearranjo automático: anima só nesse momento, para não pesar o arrasto */
.win.is-arranging {
  transition: left .32s var(--ease), top .32s var(--ease),
              width .32s var(--ease), height .32s var(--ease),
              box-shadow .2s var(--ease), opacity .38s var(--ease);
}

.win.is-max {
  position: fixed;
  z-index: 700 !important;
  box-shadow: var(--shadow-3);
}

/* barra de título */
.win__bar {
  display: flex; align-items: center; gap: 10px;
  height: var(--bar-h); padding: 0 12px; flex: none;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  cursor: grab; user-select: none;
}
.win__bar:active { cursor: grabbing; }
.win.is-max .win__bar { cursor: default; }

.dots { display: flex; gap: 7px; flex: none; }

.dot {
  width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0;
  position: relative; transition: filter .14s var(--ease);
}
.dot:hover { filter: brightness(.88); }
.dot--close { background: var(--dot-red); }
.dot--min { background: var(--dot-amber); }
.dot--max { background: var(--dot-green); }

.win__title {
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
.win__title b { color: var(--text); font-weight: 600; }

.win__badge {
  flex: none; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px;
}

.win__tools { display: flex; gap: 2px; flex: none; }

.tool {
  width: 28px; height: 26px; border: 0; background: none;
  border-radius: var(--r-sm); color: var(--text-3);
  display: grid; place-items: center;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.tool:hover { background: var(--accent-soft); color: var(--accent); }

/* corpo com preview vivo */
.win__body {
  position: relative; flex: 1; min-height: 0;
  background: var(--surface); overflow: hidden;
}

.win__stage {
  position: absolute; inset: 0;
  overflow: hidden;
  background: #fff;
}

.win__stage iframe {
  border: 0; display: block;
  transform-origin: top left;
  background: #fff;
}

/* enquanto o projeto não carregou */
.skeleton {
  position: absolute; inset: 0; display: grid; place-items: center;
  gap: 10px; background: var(--surface-2); color: var(--text-3);
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
}
.skeleton::before {
  content: ''; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* camada que engole o clique enquanto arrasta, para o iframe não roubar o ponteiro */
.win__shield { position: absolute; inset: 0; display: none; z-index: 5; }
body.is-dragging .win__shield { display: block; }

/* rodapé */
.win__foot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; flex: none;
  border-top: 1px solid var(--line); background: var(--chrome);
}

.tech { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }

.tech span {
  font-family: var(--mono); font-size: 10px; letter-spacing: .03em;
  color: var(--text-3); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 6px; white-space: nowrap;
}

.openbtn {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--text); color: var(--surface);
  border: 0; border-radius: var(--r-sm); padding: 8px 13px;
  font-size: 12.5px; font-weight: 600;
  transition: background .16s var(--ease), transform .16s var(--ease);
}
.openbtn:hover { background: var(--accent); color: var(--accent-text); }
.openbtn:active { transform: scale(.97); }

/* alça de redimensionar */
.win__grip {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  cursor: nwse-resize; z-index: 6;
}
.win__grip::after {
  content: ''; position: absolute; right: 4px; bottom: 4px;
  width: 7px; height: 7px;
  border-right: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  border-radius: 0 0 2px 0;
}
.win.is-max .win__grip { display: none; }

/* ---------- painel de detalhe do projeto ---------- */
.win__detail {
  position: absolute; inset: auto 0 0 0; z-index: 8;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 20px 22px 22px;
  max-height: 62%; overflow: auto;
  transform: translateY(101%);
  transition: transform .34s var(--ease);
  box-shadow: 0 -18px 40px -28px rgba(19, 24, 33, .5);
}
.win.is-detail .win__detail { transform: none; }

.detail__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.detail__head h3 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.detail__cat {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); border-radius: 4px; padding: 3px 7px;
}
.detail__desc { margin: 8px 0 16px; color: var(--text-2); font-size: 14px; max-width: 62ch; }

.detail__cols { display: grid; grid-template-columns: 1fr 240px; gap: 24px; align-items: start; }

.detail__label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3); margin: 0 0 8px;
}

.detail__list { margin: 0; padding: 0; list-style: none; }
.detail__list li {
  position: relative; padding-left: 18px; margin-bottom: 6px;
  font-size: 13.5px; color: var(--text-2);
}
.detail__list li::before {
  content: ''; position: absolute; left: 4px; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

.detail__note {
  font-size: 12.5px; color: var(--text-2); background: var(--surface-2);
  border-left: 2px solid var(--dot-amber); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 10px 12px; margin: 14px 0 0;
}

.detail__actions { display: flex; flex-direction: column; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-sm); padding: 10px 14px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  transition: all .16s var(--ease);
}
.btn:hover { border-color: var(--line-strong); }
.btn--primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 500;
  display: flex; align-items: center; gap: 4px;
  padding: 7px; border-radius: 15px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  max-width: calc(100vw - 32px); overflow-x: auto;
}

.dock__btn {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 7px;
  border: 0; background: none; border-radius: var(--r-md);
  padding: 7px 11px; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.dock__btn:hover { background: var(--accent-soft); color: var(--accent); }
.dock__btn[data-state='open'] { color: var(--text); }
.dock__btn[data-state='closed'] { opacity: .5; }

.dock__led {
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-3);
  transition: background .16s var(--ease);
}
.dock__btn[data-state='open'] .dock__led { background: var(--accent); }
.dock__btn[data-state='minimized'] .dock__led { background: var(--dot-amber); }
.dock__btn[data-state='closed'] .dock__led { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

.dock__sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; flex: none; }

/* ---------- rodapé ---------- */
.foot {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 26px 0 110px;
  display: flex; gap: 14px; justify-content: space-between; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}

/* ---------- modo cartões (celular e tablet estreito) ---------- */
body.is-mobile .desktop {
  display: flex; flex-direction: column; gap: 16px;
  min-height: 0; padding-bottom: 20px;
}

body.is-mobile .win {
  position: relative !important;
  left: auto !important; top: auto !important;
  width: 100% !important; height: 420px !important;
  z-index: auto !important;
}

body.is-mobile .win__bar { cursor: default; }
body.is-mobile .win__grip { display: none; }
body.is-mobile .dot--min,
body.is-mobile .dot--max { display: none; }
body.is-mobile .win.is-minimized { display: flex; }

body.is-mobile .win.is-max {
  position: fixed;
  border-radius: 0; border: 0;
}

body.is-mobile .win__detail { max-height: 70%; }
body.is-mobile .detail__cols { grid-template-columns: 1fr; gap: 18px; }

/* O dock continua no celular: fechar um cartão sem ter como reabrir
   deixaria o projeto inacessível. Só fica mais compacto. */
body.is-mobile .dock { padding: 5px; border-radius: 13px; }
body.is-mobile .dock__btn { padding: 6px 9px; font-size: 12px; }
body.is-mobile .foot { padding-bottom: 92px; }

@media (max-width: 640px) {
  .shell { padding: 0 14px; }
  .topbar__in { min-height: 58px; }
  .identity { text-align: left; }
  .identity__role { font-size: 11.5px; }
  .brand__mark { display: none; }
  .toolbar { padding: 14px 0 10px; }
  .hint { display: none; }
  .win__foot .tech span:nth-child(n+4) { display: none; }
  .win__badge { display: none; }
}

/* ---------- acessibilidade ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.dot:focus-visible { outline-offset: 3px; }

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