/* Tikitago F103.31 — sistema visual global verificable.
   Se carga únicamente en superficies de producto; nunca en fuentes transparentes/runtime. */
@layer tg-design-reset, tg-design-system, tg-design-components, tg-design-responsive;

@layer tg-design-system {
  html.tg-design-surface {
    --tgds-violet: #9f6bff;
    --tgds-violet-2: #7a5cff;
    --tgds-cyan: #27d9ff;
    --tgds-mint: #48f3c3;
    --tgds-amber: #ffb84d;
    --tgds-rose: #ff5ca8;
    --tgds-ink-0: #070812;
    --tgds-ink-1: #0b0d19;
    --tgds-ink-2: #111425;
    --tgds-ink-3: #171a2e;
    --tgds-line: rgba(182, 169, 255, .15);
    --tgds-line-strong: rgba(182, 169, 255, .28);
    --tgds-text: #f7f5ff;
    --tgds-muted: #aaa7be;
    --tgds-soft: #d4d0e4;
    --tgds-accent: var(--tgds-violet);
    --tgds-accent-2: var(--tgds-cyan);
    --tgds-page-x: clamp(14px, 2vw, 34px);
    --tgds-page-y: clamp(16px, 2.1vw, 32px);
    --tgds-gap-1: 8px;
    --tgds-gap-2: 12px;
    --tgds-gap-3: 16px;
    --tgds-gap-4: 22px;
    --tgds-gap-5: 30px;
    --tgds-radius-s: 12px;
    --tgds-radius-m: 18px;
    --tgds-radius-l: 26px;
    --tgds-shadow-card: 0 18px 55px rgba(0, 0, 0, .27), inset 0 1px 0 rgba(255,255,255,.035);
    --tgds-shadow-focus: 0 0 0 3px rgba(159, 107, 255, .22), 0 0 0 1px rgba(199, 178, 255, .72);
    color-scheme: dark;
    background: var(--tgds-ink-0);
    scroll-padding-top: 88px;
  }

  html.tg-design-surface[data-tg-product="camara"] { --tgds-accent: var(--tgds-cyan); --tgds-accent-2: var(--tgds-mint); }
  html.tg-design-surface[data-tg-product="disparadores"] { --tgds-accent: var(--tgds-amber); --tgds-accent-2: var(--tgds-rose); }
  html.tg-design-surface[data-tg-product="botonera"] { --tgds-accent: var(--tgds-rose); --tgds-accent-2: var(--tgds-violet); }
  html.tg-design-surface[data-tg-product="perfil"] { --tgds-accent: var(--tgds-mint); --tgds-accent-2: var(--tgds-cyan); }
  html.tg-design-surface[data-tg-product="home"] { --tgds-accent: var(--tgds-violet); --tgds-accent-2: var(--tgds-cyan); }

  html.tg-design-surface body {
    min-width: 0;
    min-height: 100%;
    overflow-x: clip;
    background-color: var(--tgds-ink-0);
    background-image:
      radial-gradient(circle at 14% -8%, color-mix(in srgb, var(--tgds-accent) 17%, transparent), transparent 35%),
      radial-gradient(circle at 94% 12%, color-mix(in srgb, var(--tgds-accent-2) 11%, transparent), transparent 31%),
      linear-gradient(180deg, rgba(255,255,255,.012), transparent 28%);
    background-attachment: fixed;
  }

  html.tg-design-surface body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .32;
    background-image:
      linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 74%);
  }

  html.tg-design-surface .tgds-content-root {
    box-sizing: border-box;
    width: min(100%, 1760px);
    min-width: 0;
    margin-inline: auto;
  }
  html.tg-design-surface .tgds-content-root.tgds-content-root--pad-inline {
    padding-inline: var(--tgds-page-x);
  }
  html.tg-design-surface .tgds-content-root.tgds-content-root--pad-block {
    padding-block: var(--tgds-page-y);
  }

  html.tg-design-surface .tgds-skip-link {
    position: fixed;
    z-index: 100000;
    inset: 10px auto auto 10px;
    translate: 0 -160%;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--tgds-text);
    background: #171525;
    border: 1px solid var(--tgds-line-strong);
    transition: translate .18s ease;
  }
  html.tg-design-surface .tgds-skip-link:focus { translate: 0 0; }

  html.tg-design-surface :where(h1,h2,h3,h4,p,label,legend,li,dt,dd) {
    min-width: 0;
    overflow-wrap: break-word;
  }
  /* Las etiquetas compactas no pueden romper palabras como VINCULADO, LIVE o PRO. */
  html.tg-design-surface :where(button,[role="button"],.tt-status,.tt-caret,.cd-pro) {
    overflow-wrap: normal;
    word-break: normal;
  }
  html.tg-design-surface :where(img,svg,video,canvas) { max-width: 100%; }
  html.tg-design-surface :where(input,select,textarea,button) { font: inherit; }

  html.tg-design-surface :where(a,button,input,select,textarea,[tabindex]):focus-visible {
    outline: none;
    box-shadow: var(--tgds-shadow-focus);
  }

  html.tg-design-surface :where(button,[role="button"],.btn,.button) {
    -webkit-tap-highlight-color: transparent;
  }

  /* Microinteracción canónica: respuesta táctil/ratón sin alterar geometría permanente. */
  html.tg-design-surface :where(button,[role="button"],.btn,.button):not(:disabled):not([aria-disabled="true"]) {
    transition-property: transform, translate, border-color, background-color, box-shadow, filter, opacity;
    transition-duration: .16s;
    transition-timing-function: cubic-bezier(.2,.8,.2,1);
  }
  @media (hover:hover) {
    html.tg-design-surface :where(button,[role="button"],.btn,.button):not(:disabled):not([aria-disabled="true"]):hover {
      filter: brightness(1.045);
    }
  }
  html.tg-design-surface :where(button,[role="button"],.btn,.button):not(:disabled):not([aria-disabled="true"]):active {
    transform: scale(.985);
  }

  html.tg-design-surface :where(button,[role="button"],.btn,.button):disabled,
  html.tg-design-surface :where(button,[role="button"],.btn,.button)[aria-disabled="true"] {
    cursor: not-allowed !important;
    opacity: .48;
    filter: saturate(.55);
    transform: none !important;
  }

  html.tg-design-surface .tgds-viewport-guard {
    max-width: min(calc(100vw - 24px), 100%);
    max-height: min(calc(100dvh - 24px), 100%);
    overscroll-behavior: contain;
  }
}

@layer tg-design-components {
  html.tg-design-surface :where(.card,.panel,.surface,.widget-card,.product-card,.settings-card,.section-card,.content-card)[data-tgds-card],
  html.tg-design-surface .tgds-card {
    position: relative;
    min-width: 0;
    border: 1px solid var(--tgds-line);
    border-radius: var(--tgds-radius-m);
    background:
      linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.014) 42%, rgba(255,255,255,.024)),
      color-mix(in srgb, var(--tgds-ink-2) 92%, transparent);
    box-shadow: var(--tgds-shadow-card);
    isolation: isolate;
  }

  html.tg-design-surface :where(.card,.panel,.surface,.widget-card,.product-card,.settings-card,.section-card,.content-card)[data-tgds-card]::before,
  html.tg-design-surface .tgds-card::before {
    content: "";
    position: absolute;
    pointer-events: none;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: radial-gradient(circle at 0 0, color-mix(in srgb, var(--tgds-accent) 9%, transparent), transparent 44%);
    opacity: .9;
  }

  html.tg-design-surface .tgds-product-hero {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--tgds-line);
    border-radius: var(--tgds-radius-l);
    background:
      radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--tgds-accent-2) 15%, transparent), transparent 31%),
      radial-gradient(circle at 4% 110%, color-mix(in srgb, var(--tgds-accent) 16%, transparent), transparent 43%),
      linear-gradient(135deg, rgba(255,255,255,.052), rgba(255,255,255,.015));
    box-shadow: 0 24px 70px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.055);
  }

  html.tg-design-surface .tgds-product-hero.tgds-product-hero--pad {
    padding: clamp(18px, 2.4vw, 30px);
  }

  html.tg-design-surface .tgds-product-hero::after {
    content: "";
    position: absolute;
    width: 220px;
    aspect-ratio: 1;
    top: -136px;
    right: -82px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--tgds-accent) 35%, transparent);
    box-shadow: 0 0 70px color-mix(in srgb, var(--tgds-accent) 18%, transparent);
    pointer-events: none;
  }

  html.tg-design-surface .tgds-product-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    margin-block-end: 10px;
    color: color-mix(in srgb, var(--tgds-accent) 76%, white);
    font-size: .72rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
  }
  html.tg-design-surface .tgds-product-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--tgds-accent);
    box-shadow: 0 0 16px var(--tgds-accent);
  }

  html.tg-design-surface .tgds-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    border-radius: var(--tgds-radius-s);
  }
  html.tg-design-surface .tgds-table-scroll > table { min-width: max-content; }

  html.tg-design-surface :where(.modal,.dialog,[role="dialog"],[aria-modal="true"]) {
    max-width: min(calc(100vw - 24px), 980px);
    max-height: calc(100dvh - 24px);
  }

  html.tg-design-surface .tgds-overflow-safe {
    min-width: 0 !important;
    max-width: 100%;
    overflow-wrap: break-word;
  }
  html.tg-design-surface :where(button,[role="button"]).tgds-overflow-safe {
    overflow-wrap: normal;
    word-break: normal;
  }
  html.tg-design-surface [data-tgds-overflow="true"] {
    min-width: 0;
    max-width: 100%;
  }
  html.tg-design-surface[data-tg-debug="true"] [data-tgds-overflow="true"] {
    outline: 1px dashed color-mix(in srgb, var(--tgds-amber) 62%, transparent);
    outline-offset: 2px;
  }

  html.tg-design-surface .tgds-ambient-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--tgds-muted);
    font-size: .76rem;
  }
  html.tg-design-surface .tgds-ambient-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--tgds-mint);
    box-shadow: 0 0 12px rgba(72,243,195,.65);
  }

  html.tg-design-surface .tgds-command-deck {
    position: relative;
    display: grid;
    gap: clamp(18px, 2.2vw, 30px);
    margin-block: clamp(24px, 4vw, 58px);
    padding: clamp(20px, 3.4vw, 48px);
    border: 1px solid var(--tgds-line);
    border-radius: clamp(22px, 3vw, 36px);
    overflow: hidden;
    background:
      radial-gradient(circle at 78% -16%, rgba(39,217,255,.13), transparent 34%),
      radial-gradient(circle at -4% 110%, rgba(159,107,255,.16), transparent 43%),
      linear-gradient(145deg, rgba(18,20,37,.96), rgba(8,9,18,.98));
    box-shadow: 0 34px 100px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.055);
    isolation: isolate;
  }
  html.tg-design-surface .tgds-command-deck::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .55;
    background-image:
      linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(circle at 70% 30%, black, transparent 73%);
  }

  html.tg-design-surface .tgds-deck-head {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 18px;
  }
  html.tg-design-surface .tgds-deck-head h2 {
    margin: 5px 0 8px;
    max-width: 760px;
    color: var(--tgds-text);
    font-size: clamp(1.45rem, 2.5vw, 2.55rem);
    line-height: 1.06;
    letter-spacing: -.035em;
  }
  html.tg-design-surface .tgds-deck-head p {
    margin: 0;
    max-width: 720px;
    color: var(--tgds-muted);
    line-height: 1.65;
  }

  html.tg-design-surface .tgds-product-constellation {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(12px, 1.6vw, 20px);
  }

  html.tg-design-surface .tgds-product-node {
    --node-accent: var(--tgds-violet);
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-column: span 3;
    min-width: 0;
    min-height: 216px;
    padding: 18px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.085);
    border-radius: 22px;
    background:
      radial-gradient(circle at 90% 0, color-mix(in srgb, var(--node-accent) 14%, transparent), transparent 39%),
      linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 16px 40px rgba(0,0,0,.18);
    transform: translateZ(0);
    transition: translate .22s ease, border-color .22s ease, box-shadow .22s ease;
  }
  html.tg-design-surface .tgds-product-node:hover {
    translate: 0 -5px;
    border-color: color-mix(in srgb, var(--node-accent) 44%, transparent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 22px 52px rgba(0,0,0,.28), 0 0 34px color-mix(in srgb, var(--node-accent) 10%, transparent);
  }
  html.tg-design-surface .tgds-product-node[data-product="camara"] { --node-accent: var(--tgds-cyan); }
  html.tg-design-surface .tgds-product-node[data-product="disparadores"] { --node-accent: var(--tgds-amber); }
  html.tg-design-surface .tgds-product-node[data-product="botonera"] { --node-accent: var(--tgds-rose); }
  html.tg-design-surface .tgds-product-node[data-product="estudio"] { --node-accent: var(--tgds-violet); }
  html.tg-design-surface .tgds-node-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-block-end: 26px;
    border: 1px solid color-mix(in srgb, var(--node-accent) 36%, transparent);
    border-radius: 15px;
    color: white;
    background: color-mix(in srgb, var(--node-accent) 17%, rgba(255,255,255,.02));
    box-shadow: 0 0 28px color-mix(in srgb, var(--node-accent) 13%, transparent), inset 0 1px 0 rgba(255,255,255,.12);
  }
  html.tg-design-surface .tgds-node-icon svg { width: 22px; height: 22px; }
  html.tg-design-surface .tgds-product-node h3 { margin: 0 0 8px; color: var(--tgds-text); font-size: 1.05rem; }
  html.tg-design-surface .tgds-product-node p { margin: 0; color: var(--tgds-muted); font-size: .86rem; line-height: 1.55; }
  html.tg-design-surface .tgds-node-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-block-start: 22px;
    color: color-mix(in srgb, var(--node-accent) 72%, white);
    font-size: .76rem;
    font-weight: 800;
  }
  html.tg-design-surface .tgds-node-foot svg { width: 16px; height: 16px; transition: translate .2s ease; }
  html.tg-design-surface .tgds-product-node:hover .tgds-node-foot svg { translate: 4px 0; }

  html.tg-design-surface .tgds-live-orbit {
    position: relative;
    z-index: 1;
    min-height: 184px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 24px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, rgba(159,107,255,.09), transparent 48%), rgba(255,255,255,.014);
  }
  html.tg-design-surface .tgds-live-orbit::before,
  html.tg-design-surface .tgds-live-orbit::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(70vw, 520px);
    aspect-ratio: 2.8 / 1;
    translate: -50% -50%;
    border: 1px solid rgba(184,169,255,.16);
    border-radius: 50%;
    rotate: -7deg;
  }
  html.tg-design-surface .tgds-live-orbit::after { width: min(52vw, 360px); rotate: 12deg; border-color: rgba(39,217,255,.14); }
  html.tg-design-surface .tgds-orbit-core {
    position: absolute;
    inset: 50% auto auto 50%;
    translate: -50% -50%;
    display: grid;
    place-items: center;
    width: 86px;
    aspect-ratio: 1;
    border-radius: 28px;
    color: white;
    font-weight: 900;
    letter-spacing: -.04em;
    background: linear-gradient(145deg, rgba(159,107,255,.78), rgba(39,217,255,.36));
    box-shadow: 0 0 60px rgba(159,107,255,.28), inset 0 1px 0 rgba(255,255,255,.3);
  }
  html.tg-design-surface .tgds-orbit-chip {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.085);
    border-radius: 999px;
    color: var(--tgds-soft);
    font-size: .69rem;
    font-weight: 750;
    background: rgba(9,10,20,.76);
    backdrop-filter: blur(10px);
  }
  html.tg-design-surface .tgds-orbit-chip::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--chip,var(--tgds-violet)); box-shadow:0 0 10px var(--chip,var(--tgds-violet)); }
  html.tg-design-surface .tgds-orbit-chip:nth-child(2) { left: 9%; top: 20%; --chip: var(--tgds-cyan); }
  html.tg-design-surface .tgds-orbit-chip:nth-child(3) { right: 8%; top: 17%; --chip: var(--tgds-amber); }
  html.tg-design-surface .tgds-orbit-chip:nth-child(4) { left: 15%; bottom: 17%; --chip: var(--tgds-rose); }
  html.tg-design-surface .tgds-orbit-chip:nth-child(5) { right: 12%; bottom: 19%; --chip: var(--tgds-mint); }

  html.tg-design-surface .tgds-home-flow {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  html.tg-design-surface .tgds-flow-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    min-width: 0;
    padding: 15px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 18px;
    background: rgba(255,255,255,.018);
  }
  html.tg-design-surface .tgds-flow-number {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    color: white;
    font-size: .78rem;
    font-weight: 900;
    background: linear-gradient(145deg, var(--tgds-violet), var(--tgds-cyan));
    box-shadow: 0 8px 22px rgba(159,107,255,.2);
  }
  html.tg-design-surface .tgds-flow-step strong { display:block; margin:1px 0 4px; color:var(--tgds-text); font-size:.86rem; }
  html.tg-design-surface .tgds-flow-step span { display:block; color:var(--tgds-muted); font-size:.74rem; line-height:1.45; }

  html.tg-design-surface .tgds-reveal { opacity: 0; translate: 0 18px; }
  html.tg-design-surface .tgds-reveal.tgds-visible { opacity: 1; translate: 0 0; transition: opacity .62s ease, translate .62s cubic-bezier(.2,.8,.2,1); }
}

@layer tg-design-responsive {
  @media (max-width: 1180px) {
    html.tg-design-surface .tgds-product-node { grid-column: span 6; }
  }
  @media (max-width: 860px) {
    html.tg-design-surface { --tgds-page-x: clamp(12px, 3.5vw, 22px); }
    html.tg-design-surface .tgds-deck-head { grid-template-columns: 1fr; align-items: start; }
    html.tg-design-surface .tgds-home-flow { grid-template-columns: 1fr; }
  }
  @media (max-width: 620px) {
    html.tg-design-surface .tgds-command-deck { border-radius: 22px; padding: 17px; }
    html.tg-design-surface .tgds-product-node { grid-column: 1 / -1; min-height: 190px; }
    html.tg-design-surface .tgds-live-orbit { min-height: 156px; }
    html.tg-design-surface .tgds-orbit-core { width: 72px; border-radius: 23px; }
    html.tg-design-surface .tgds-orbit-chip { font-size: .61rem; padding: 6px 8px; }
  }
  @media (max-width: 390px) {
    html.tg-design-surface { --tgds-page-x: 10px; --tgds-page-y: 12px; }
    html.tg-design-surface .tgds-orbit-chip:nth-child(3),
    html.tg-design-surface .tgds-orbit-chip:nth-child(4) { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    html.tg-design-surface *,
    html.tg-design-surface *::before,
    html.tg-design-surface *::after {
      scroll-behavior: auto !important;
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
    }
    html.tg-design-surface .tgds-reveal { opacity: 1; translate: none; }
  }
  @media (forced-colors: active) {
    html.tg-design-surface .tgds-card,
    html.tg-design-surface .tgds-command-deck,
    html.tg-design-surface .tgds-product-node { border: 1px solid CanvasText; }
  }
}
