/* Integrated Sakshi AI side panel. */
:root {
  --portfolio-agent-width: clamp(380px, 29vw, 440px);
  --portfolio-agent-accent: #fe5eae;
}

::selection {
  background: #ffe1ef;
  color: #d9368b;
}

::-moz-selection {
  background: #ffe1ef;
  color: #d9368b;
}

::highlight(sakshi-agent-quote) {
  background: #ffe1ef;
  color: #d9368b;
}

.portfolio-page-shell {
  width: 100%;
  min-height: 100vh;
  transition: width 300ms cubic-bezier(.22, .7, .25, 1);
  container: portfolio-page / inline-size;
}

body.portfolio-agent-open .portfolio-page-shell {
  width: calc(100% - var(--portfolio-agent-width));
  margin-right: var(--portfolio-agent-width);
}

body.portfolio-agent-open .site-footer { width: 100%; margin-left: 0; }

.portfolio-agent-host {
  position: fixed;
  z-index: 10000;
  inset: 0;
  pointer-events: none;
  color: #171717;
  font-family: 'Product Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.portfolio-page-shell .site-header .header-right {
  max-width: 140px;
  overflow: hidden;
  transition: max-width 220ms cubic-bezier(.22, .7, .25, 1), opacity 160ms ease, transform 220ms cubic-bezier(.22, .7, .25, 1), visibility 0s linear;
}

body.portfolio-agent-open .portfolio-page-shell .site-header .header-right {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  visibility: hidden;
  transition: max-width 220ms cubic-bezier(.22, .7, .25, 1), opacity 160ms ease, transform 220ms cubic-bezier(.22, .7, .25, 1), visibility 0s linear 220ms;
}

.portfolio-agent-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 10001;
  display: flex;
  width: var(--portfolio-agent-width);
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid #e9e3e8;
  background: #fffdf6;
  color: #171717;
  pointer-events: none;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(.22, .7, .25, 1);
  will-change: transform;
}

.portfolio-agent-panel.is-open { pointer-events: auto; transform: translateX(0); }
.portfolio-agent-panel[aria-hidden="true"] { visibility: hidden; transition: transform 300ms cubic-bezier(.22, .7, .25, 1), visibility 0s linear 300ms; }
.portfolio-agent-panel.is-open[aria-hidden="false"] { visibility: visible; transition: transform 300ms cubic-bezier(.22, .7, .25, 1), visibility 0s; }

.portfolio-agent-panel-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px 22px;
  border-bottom: 1px solid #ebe7e4;
}

.portfolio-agent-panel-header h2 { margin: 0; color: #111; font-family: inherit; font-size: 18px; font-weight: 400; line-height: 1.2; }
.portfolio-agent-header-actions { display: flex; align-items: center; gap: 8px; }

.portfolio-agent-close,
.portfolio-agent-reset {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 7px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.portfolio-agent-close:hover,
.portfolio-agent-reset:hover { background: #f3eeef; }
.portfolio-agent-close img, .portfolio-agent-reset img { display: block; width: 20px; height: 20px; }

.portfolio-agent-main {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 22px 0;
}

.portfolio-agent-log {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 4px 2px 20px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.portfolio-agent-msg {
  max-width: 90%;
  padding: 12px 14px;
  border-radius: 13px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.portfolio-agent-msg--user { align-self: flex-end; background: #fceaf3; }
.portfolio-agent-msg--assistant { align-self: flex-start; background: #f3f1ee; }
.portfolio-agent-msg--assistant { transition: opacity 180ms ease, transform 180ms ease; }
.portfolio-agent-msg--assistant.is-entering { opacity: 0; transform: translateY(4px); }
.portfolio-agent-msg-role { margin-bottom: 4px; color: #555; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.portfolio-agent-msg-quote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px 11px;
  border: 1px solid #f3dce7;
  border-left: 3px solid var(--portfolio-agent-accent);
  border-radius: 7px;
  background: #fff8fb;
  color: #333;
  font-size: 14px;
  line-height: 1.45;
}
.portfolio-agent-msg-quote-icon { flex: 0 0 auto; color: #d9368b; font-size: 22px; line-height: 1; }
.portfolio-agent-msg-quote-text { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.portfolio-agent-msg-text { color: #171717; }
.portfolio-agent-msg-text p { margin: 0; white-space: pre-wrap; }
.portfolio-agent-msg-text p + p { margin-top: 0.7em; }
.portfolio-agent-msg-text ul { margin: 0.35em 0 0.2em; padding-left: 1.25em; }
.portfolio-agent-msg-text li + li { margin-top: 0.2em; }
.portfolio-agent-msg-text a { color: #3b5bb5; text-decoration: underline; text-underline-offset: 2px; }
.portfolio-agent-msg-text a:focus-visible { outline: 2px solid #3b5bb5; outline-offset: 2px; border-radius: 2px; }
.portfolio-agent-thinking { display: inline-flex; align-items: center; gap: 9px; color: #444; font-size: 15px; line-height: 1.5; }
.portfolio-agent-thinking-dots { display: inline-flex; align-items: center; gap: 4px; }
.portfolio-agent-thinking-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--portfolio-agent-accent); animation: portfolio-agent-dot-wave 1.05s ease-in-out infinite; }
.portfolio-agent-thinking-dot:nth-child(2) { animation-delay: 140ms; }
.portfolio-agent-thinking-dot:nth-child(3) { animation-delay: 280ms; }

@keyframes portfolio-agent-dot-wave {
  0%, 60%, 100% { opacity: .42; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.portfolio-agent-empty-state { flex: 0 0 auto; padding: 0 0 18px; }
.portfolio-agent-empty-state[hidden] { display: none; }
.portfolio-agent-empty-state h3 { margin: 0 0 12px; color: #111; font-size: 30px; font-weight: 400; letter-spacing: -.035em; line-height: 1.15; }
.portfolio-agent-suggestions { display: grid; gap: 6px; }

.portfolio-agent-suggestion {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #555;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.portfolio-agent-suggestion:hover { color: #111; }
.portfolio-agent-suggestion-icon { display: block; width: 19px; height: 22px; flex: 0 0 auto; }
.portfolio-agent-suggestion-icon img { display: block; width: 19px; height: 16px; transform: rotate(-45deg); }

.portfolio-agent-status { min-height: 20px; flex: 0 0 auto; margin: 0 22px; color: #555; font-size: 14px; line-height: 1.4; }
.portfolio-agent-status:empty { min-height: 0; }
.portfolio-agent-status--error { color: #a62c42; }

.portfolio-agent-form {
  display: flex;
  min-height: 56px;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 10px;
  margin: 0 22px max(20px, env(safe-area-inset-bottom));
  padding: 8px 8px 8px 14px;
  border: 1px solid #ded9d6;
  border-radius: 12px;
  background: #fff;
}

.portfolio-agent-form:focus-within { border-color: var(--portfolio-agent-accent); outline: 2px solid rgb(254 94 174 / 20%); outline-offset: 2px; }
.portfolio-agent-input { display: block; width: 100%; min-width: 0; min-height: 36px; max-height: 136px; resize: none; padding: 8px 0; border: 0; background: transparent; color: #171717; font: inherit; font-size: 16px; line-height: 1.35; }
.portfolio-agent-input:focus { outline: 0; }
.portfolio-agent-input::placeholder { color: #666; opacity: 1; }

.portfolio-agent-send-btn {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  background: #fceaf3;
  cursor: pointer;
}

.portfolio-agent-send-btn img { display: block; width: 20px; height: 20px; }
.portfolio-agent-send-btn:hover { background: #f8d8e8; }
.portfolio-agent-send-btn:disabled { opacity: .55; cursor: wait; }

.portfolio-agent-quote-context {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 10px;
  margin: 0 22px 10px;
  padding: 10px 12px;
  border: 1px solid #e9e3e8;
  border-radius: 10px;
  background: #fff;
}
.portfolio-agent-quote-context[hidden] { display: none; }
.portfolio-agent-quote-icon { flex: 0 0 auto; color: var(--portfolio-agent-accent); font-size: 26px; line-height: 1; }
.portfolio-agent-quote-text { display: -webkit-box; min-width: 0; flex: 1; overflow: hidden; margin: 1px 0 0; color: #555; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.portfolio-agent-quote-remove { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; margin: -5px -5px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #555; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.portfolio-agent-quote-remove:hover { background: #fceaf3; color: #171717; }

.portfolio-agent-selection-action {
  position: fixed;
  z-index: 10002;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 0;
  border-radius: 2px;
  background: var(--portfolio-agent-accent);
  color: #fff;
  font: 500 12px/1.2 'Product Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.portfolio-agent-selection-action[hidden] { display: none; }
.portfolio-agent-selection-action.is-visible { opacity: 1; }
.portfolio-agent-selection-star { color: #fff; font-size: 13px; line-height: 1; }
.portfolio-agent-selection-action:focus-visible,
.portfolio-agent-quote-remove:focus-visible { outline: 2px solid #d9368b; outline-offset: 3px; }

.portfolio-agent-close:focus-visible,
.portfolio-agent-reset:focus-visible,
.portfolio-agent-suggestion:focus-visible,
.portfolio-agent-send-btn:focus-visible { outline: 3px solid var(--portfolio-agent-accent); outline-offset: 3px; }

@container portfolio-page (max-width: 1100px) {
  .page-container { padding-right: 32px; padding-left: 32px; }
  .portfolio-page-shell .site-header .brand-logo { position: static; margin-right: 0; }
  .project-list, .project-row { width: 100%; }
  .project-row { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 22px; }
}

@container portfolio-page (max-width: 800px) {
  .page-container { padding-right: 24px; padding-left: 24px; }
  .portfolio-page-shell .site-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; height: auto; min-height: 0; padding: 12px 16px; flex-wrap: initial; gap: 12px; }
  .portfolio-page-shell .site-header .brand-logo { grid-column: 1; grid-row: 1; margin: 0; }
  .portfolio-page-shell .site-header .header-right { grid-column: 2; grid-row: 1; margin-left: 0; }
  .portfolio-page-shell .site-header .site-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; min-width: 0; justify-content: space-between; flex-wrap: nowrap; gap: clamp(8px, 3vw, 18px); margin: 0; }
  .project-row { min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .project-meta { width: 100%; min-width: 0; }
}

@container portfolio-page (max-width: 400px) {
  .portfolio-page-shell .site-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
  .portfolio-page-shell .site-header .brand-logo { grid-column: 1; grid-row: 1; margin: 0; }
  .portfolio-page-shell .site-header .header-right { grid-column: 2; grid-row: 1; margin-left: 0; }
  .portfolio-page-shell .site-header .site-nav { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; gap: clamp(8px, 3vw, 14px); }
}

@media (max-width: 1100px) and (min-width: 761px) {
  :root { --portfolio-agent-width: clamp(320px, 36vw, 380px); }
}

@media (max-width: 760px) {
  body.portfolio-agent-open .portfolio-page-shell { width: 100%; margin-right: 0; }
  .portfolio-agent-panel { width: 100vw; border-left: 0; }
  .portfolio-agent-panel-header { min-height: 64px; padding: 10px 18px; }
  .portfolio-agent-main { padding: 12px 18px 0; }
  .portfolio-agent-status { margin-right: 18px; margin-left: 18px; }
  .portfolio-agent-quote-context { margin-right: 18px; margin-left: 18px; }
  .portfolio-agent-form { margin-right: 18px; margin-left: 18px; }
  .portfolio-agent-empty-state { padding-bottom: 14px; }
}

@media (max-width: 390px) {
  .portfolio-agent-panel-header { padding-right: 14px; padding-left: 14px; }
  .portfolio-agent-main { padding-right: 14px; padding-left: 14px; }
  .portfolio-agent-status { margin-right: 14px; margin-left: 14px; }
  .portfolio-agent-quote-context { margin-right: 14px; margin-left: 14px; }
  .portfolio-agent-form { margin-right: 14px; margin-left: 14px; }
  .portfolio-agent-empty-state h3 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-page-shell, .portfolio-page-shell .site-header .header-right, .portfolio-agent-panel { transition: none; }
  .portfolio-agent-msg--assistant { transition: none; }
  .portfolio-agent-thinking-dot { animation: none; opacity: .8; transform: none; }
  .portfolio-agent-selection-action { transition: none; }
}
