/* Terminal agent — fullscreen studio landing */
.page-terminal.agente-page {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

.page-terminal.agente-page main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 2;
}

.agente-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  padding:
    calc(52px + env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  min-height: 0;
}

.agente-shell--home {
  height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  height: calc(100svh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.agente-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.68rem;
  color: var(--muted);
  flex-shrink: 0;
}

.agente-top a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.agente-top a:hover {
  color: var(--accent);
}

.agente-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agente-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
}

.agente-status-dot.is-offline {
  background: var(--muted);
  box-shadow: none;
}

.agente-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 24px 80px var(--shadow);
  backdrop-filter: blur(6px);
}

.agente-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.agente-chrome-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agente-chrome-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.agente-chrome-dots span {
  width: 10px;
  height: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.agente-chrome-dots span:nth-child(1) { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.agente-chrome-dots span:nth-child(2) { opacity: 0.85; }
.agente-chrome-dots span:nth-child(3) { opacity: 0.65; }

.agente-chrome-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agente-log {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px max(10px, env(safe-area-inset-bottom, 0px));
  cursor: text;
  font-size: clamp(0.8125rem, 2.8vw, 0.9rem);
  line-height: 1.6;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.agente-line {
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.agente-line.is-new {
  animation: agente-line-in 160ms ease-out;
}

@keyframes agente-line-in {
  from {
    opacity: 0.55;
    transform: translateX(1px);
    text-shadow: 1px 0 rgba(61, 255, 122, 0.25);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    text-shadow: none;
  }
}

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

.agente-type-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--signal);
  animation: agente-cursor-blink 0.95s steps(1, end) infinite;
}

.agente-caret {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: agente-cursor-blink 0.95s steps(1, end) infinite;
  flex-shrink: 0;
}

.agente-caret[hidden] {
  display: none !important;
}

@keyframes agente-cursor-blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agente-line.is-new {
    animation: none;
  }

  .agente-type-cursor,
  .agente-caret {
    animation: none;
  }
}

.agente-line--system {
  color: var(--muted);
  font-size: 0.78em;
}

.agente-ascii {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.45rem, 1.55vw, 0.62rem);
  line-height: 1.15;
  color: var(--accent);
  text-shadow: 0 0 18px var(--glow);
  overflow-x: auto;
}

.agente-line--user .agente-label {
  color: var(--accent-dark);
}

html[data-theme="dark"] .agente-line--user .agente-label {
  color: var(--accent);
}

.agente-line--bot .agente-label {
  color: var(--signal);
  font-weight: 600;
}

.agente-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agente-actions a,
.agente-actions button {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 8px 12px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}

.agente-actions a:hover,
.agente-actions button:hover {
  background: var(--panel-hover);
  border-color: var(--accent);
}

/* Active command line — inline in the scrollback like a real shell */
.agente-input-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em;
  margin: 0 0 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: text;
}

.agente-field {
  display: inline-flex;
  align-items: baseline;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.agente-prompt {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--accent-dark);
  white-space: nowrap;
}

html[data-theme="dark"] .agente-prompt {
  color: var(--accent);
}

.agente-input-line .agente-label {
  font-weight: 500;
}

.agente-input-line input {
  flex: 0 1 auto;
  min-width: 0.25ch;
  width: 0.25ch;
  max-width: 100%;
  field-sizing: content;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: max(16px, 0.875rem);
  line-height: inherit;
  color: inherit;
  outline: none;
  padding: 0;
  margin: 0;
  caret-color: transparent;
}

.agente-log--visitor-turn .agente-input-line.is-ready input:focus {
  caret-color: var(--accent);
  caret-shape: block;
}

.agente-log--visitor-turn .agente-input-line.is-ready input:focus:not(:placeholder-shown),
.agente-log--visitor-turn .agente-input-line.is-ready input.has-text {
  caret-color: var(--accent);
}

.agente-log--guru-turn .agente-input-line {
  opacity: 0.35;
  pointer-events: none;
}

.agente-input-line input:disabled {
  opacity: 0.55;
}

.agente-input-line input::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.agente-hint {
  margin-top: 6px;
  font-size: 0.65rem;
  color: var(--muted);
  flex-shrink: 0;
}

.agente-hint a {
  color: var(--accent);
}

.page-terminal .site-nav {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--nav-bg) 82%, transparent);
  backdrop-filter: blur(8px);
}

.page-terminal .site-nav .nav-links a.is-active {
  color: var(--accent);
}

.page-terminal .site-footer--terminal {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom, 0px));
  font-size: 0.68rem;
  background: color-mix(in srgb, var(--deep) 94%, transparent);
}

.page-terminal .seo-landmark {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .agente-chrome-title span:last-child {
    display: none;
  }

  .agente-top {
    font-size: 0.62rem;
  }

  .agente-prompt {
    font-size: 0.72rem;
  }
}

@media (display-mode: standalone) {
  .page-terminal .site-nav {
    padding-top: 4px;
  }

  .agente-shell {
    padding-top: calc(56px + env(safe-area-inset-top, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .agente-ascii {
    text-shadow: none;
  }
}

/* Legacy /agente route (non-home) */
.agente-page:not(.page-terminal) {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.agente-page:not(.page-terminal) .agente-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 72px 16px 24px;
  min-height: calc(100dvh - 56px);
}

.agente-page:not(.page-terminal) .agente-frame {
  min-height: 280px;
}


.agente-page:not(.page-terminal) .site-nav {
  position: fixed;
}

@media (max-width: 640px) {
  .agente-page:not(.page-terminal) .agente-shell {
    padding-top: 64px;
  }
}
