/* ai-flip style theme */
:root {
  --primary-color: #000;
  --secondary-color: #ffd426;
  --bg-color: #fff;
  --bg-second-color: #f7f7f7;
  --font-main-color: #000;
  --font-second-color: #515151;
  --line-color: rgba(0, 0, 0, 0.08);
  --header-height: 59px;
  --aside-panel-width: 390px;
  --aside-space: 50px;
  --padding-container: 2.5rem;
  --border-radius-default: 5px;
  font-family: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-color);
  color: var(--font-main-color);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.material { font-family: 'Material Symbols Outlined'; font-size: 20px; line-height: 1; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-color);
  border-bottom: 1px solid var(--line-color);
}
.header__wrap {
  max-width: calc(56.875rem + 5rem);
  margin: 0 auto;
  padding: 0 2.5rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.main-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
}
.main-logo__img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--secondary-color);
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
}
.header__nav { flex: 1; }
.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.25rem;
}
.nav__link {
  display: inline-flex;
  padding: 1rem 0.9rem;
  font-size: 0.85rem;
  color: var(--font-second-color);
  text-decoration: none;
}
.nav__link:hover { color: var(--font-main-color); text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  border-radius: var(--border-radius-default);
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  background: var(--primary-color);
  color: #fff;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn--yellow { background: var(--secondary-color); color: #000; }
.btn--ghost {
  background: transparent;
  color: var(--font-main-color);
  border: 1px solid var(--line-color);
}
.header__toggle-btn {
  display: none;
  background: transparent;
  color: #000;
  border: 1px solid var(--line-color);
  padding: 0.5rem;
}
.header__wrap-mobile {
  display: none;
  border-top: 1px solid var(--line-color);
  padding: 1rem 2rem 1.25rem;
}
.header__wrap-mobile.is-open { display: block; }
.header__wrap-mobile a {
  display: block;
  padding: 0.65rem 0;
  color: var(--font-second-color);
}

/* Layout */
.content { border-left: 1px solid var(--line-color); border-right: 1px solid var(--line-color); max-width: calc(56.875rem + 5rem); margin: 0 auto; }
.blog-page { display: flex; position: relative; }
.blog-page__content { flex: 1; min-width: 0; }
.blog-page__aside {
  flex: 0 0 10.5rem;
  padding: 1.5rem 1rem 1.5rem 0.5rem;
  border-left: 1px solid var(--line-color);
}
.aside-nav__title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--font-second-color);
}
.aside-nav-list { list-style: none; margin: 0; padding: 0; }
.aside-nav-list__link {
  display: block;
  font-size: 0.8125rem;
  color: var(--font-second-color);
  padding: 0.35rem 0;
  text-decoration: none;
}
.aside-nav-list__link.is-active,
.aside-nav-list__link:hover {
  color: var(--font-main-color);
  text-decoration: none;
}

/* Hero & sections */
.blog-page-hero { padding: 5rem 2.5rem 1.375rem; }
.blog-page-hero__title {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.05em;
  margin: 0 0 1rem;
  max-width: 85%;
}
.blog-page-hero__description {
  max-width: 60%;
  color: var(--font-second-color);
  font-size: 1.05rem;
  margin: 0;
}

.section-block {
  padding: 2.5rem 2.5rem 3rem;
  border-top: 1px solid var(--line-color);
}
.section-block h2 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.section-block p,
.section-block li {
  color: var(--font-second-color);
  line-height: 1.6;
}
.section-block ul,
.section-block ol { padding-left: 1.25rem; }
.section-block li { margin-bottom: 0.5rem; }

.media-with-text {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  padding: 2rem 0 0;
}
.media-with-text__img {
  width: 100%;
  max-width: 50rem;
  border-radius: 10px;
  border: 1px solid var(--line-color);
  background: var(--bg-second-color);
  aspect-ratio: 16/9;
  object-fit: cover;
}
.media-with-text__caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--font-second-color);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line-color);
  border: 1px solid var(--line-color);
  margin-top: 1.5rem;
}
.feature-grid__item {
  background: var(--bg-color);
  padding: 1.25rem;
}
.feature-grid__item h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.feature-grid__item p { margin: 0; font-size: 0.92rem; color: var(--font-second-color); }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e8fff3;
  color: #067647;
}

.cta-section {
  margin: 0 2.5rem 2.5rem;
  padding: 2rem 2.25rem;
  background: #111;
  color: #fff;
  border-radius: var(--border-radius-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cta-section p { margin: 0; color: #ccc; }

/* FAQ */
.faq { border-top: 1px solid var(--line-color); }
.faq__item { border-bottom: 1px solid var(--line-color); }
.faq__q {
  width: 100%;
  text-align: left;
  background: var(--bg-second-color);
  border: 0;
  padding: 1.1rem 2.5rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.faq__a {
  display: none;
  padding: 0 2.5rem 1.25rem;
  color: var(--font-second-color);
}
.faq__item.is-open .faq__a { display: block; }

/* Footer */
.footer {
  border-top: 1px solid var(--line-color);
  max-width: calc(56.875rem + 5rem);
  margin: 0 auto;
  padding: 2.5rem;
  border-left: 1px solid var(--line-color);
  border-right: 1px solid var(--line-color);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 2rem;
}
.footer h4 { margin: 0 0 0.75rem; font-size: 0.92rem; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.5rem; }
.footer a { color: var(--font-second-color); font-size: 0.9rem; }
.footer__copy { margin-top: 2rem; color: var(--font-second-color); font-size: 0.85rem; }

/* Chat preview on landing */
.chat-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  justify-content: center;
}
.chat-preview__bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.chat-preview__bubble.user {
  align-self: flex-end;
  background: var(--secondary-color);
  color: #111;
}
.chat-preview__bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line-color);
  color: var(--font-second-color);
}

/* Chat aside panel — dark theme */
.aside-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: var(--aside-panel-width);
  height: 100dvh;
  background: #141414;
  z-index: 98;
  border-left: 1px solid rgba(255,255,255,0.08);
  transform: translateX(calc(100% - var(--aside-space)));
  transition: transform 0.15s ease-in-out;
}
.aside-panel.is-open { transform: translateX(0); }
.aside-panel__toggle {
  position: absolute;
  top: calc(50% + 44px);
  transform: translateY(-50%);
  left: 0;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--border-radius-default);
  background: #1e1e1e;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.aside-panel.is-open .aside-panel__toggle { left: -20px; }
.aside-panel__content {
  height: 100%;
  padding: calc(var(--header-height) + 8px) 12px 12px var(--aside-space);
  display: flex;
  flex-direction: column;
}

/* Widget chat — dark */
.widget-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  min-height: 0;
  color: #e8e8e8;
}
.widget-chat__top {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
}
.widget-chat__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.widget-chat__logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--secondary-color);
  color: #111;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.widget-chat__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.widget-chat__balance {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  color: #aaa;
}
.widget-chat__login {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  cursor: pointer;
}
.widget-chat__model-hint {
  margin: 0;
  padding: 6px 14px 0;
  font-size: 0.7rem;
  color: #888;
  line-height: 1.35;
}
.widget-chat__messages {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.w-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.w-msg.user {
  align-self: flex-end;
  background: #2d2d2d;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
}
.w-msg.bot,
.w-msg.assistant {
  align-self: flex-start;
  background: #252525;
  border: 1px solid rgba(255,255,255,0.06);
  color: #e0e0e0;
}
.w-msg.bot.streaming::after,
.w-msg.assistant.streaming::after { content: '▍'; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.widget-chat__bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 12px 12px;
}
.widget-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px;
}
.widget-chat__form select {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.8rem;
  background: #252525;
  color: #e8e8e8;
}
.widget-chat__form textarea {
  grid-column: 1;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.88rem;
  resize: none;
  background: #252525;
  color: #fff;
  min-height: 44px;
  max-height: 120px;
}
.widget-chat__form textarea::placeholder { color: #666; }
.widget-chat__send {
  grid-column: 2;
  grid-row: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--secondary-color);
  color: #111;
  cursor: pointer;
  display: grid;
  place-items: center;
  align-self: end;
}
.widget-chat__error {
  display: none;
  color: #ff6b6b;
  font-size: 0.78rem;
  padding: 0 2px 6px;
}
.widget-chat__error.show { display: block; }

/* Auth modal */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-modal.is-open { display: flex; }
.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.auth-modal__box {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #2a2a2a;
  border-radius: 16px;
  padding: 32px 28px 24px;
  color: #fff;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
}
.auth-modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.auth-modal__title {
  margin: 0 0 24px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.auth-btn:hover { opacity: 0.92; }
.auth-btn--google {
  background: #fff;
  color: #333;
  border: none;
}
.auth-btn--outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.auth-btn--submit {
  background: var(--secondary-color);
  color: #111;
  border: none;
  margin-bottom: 0;
}
.auth-email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 12px;
}
.auth-email-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: #1e1e1e;
  color: #fff;
  font: inherit;
}
.auth-email-form input::placeholder { color: #666; }
.auth-modal__error {
  color: #ff6b6b;
  font-size: 0.85rem;
  text-align: center;
  margin: 0 0 8px;
}
.auth-modal__switch {
  text-align: center;
  margin: 16px 0 0;
  font-size: 0.9rem;
  color: #888;
}
.auth-modal__switch button {
  background: none;
  border: none;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}
.auth-modal__switch button:hover { text-decoration: underline; }

@media (max-width: 767px) {
  .header__nav, .btn--desktop { display: none; }
  .header__toggle-btn { display: inline-grid; place-items: center; margin-left: auto; }
  .blog-page__aside { display: none; }
  .blog-page-hero { padding: 2.5rem 1rem 1.25rem; }
  .blog-page-hero__title, .blog-page-hero__description { max-width: 100%; }
  .section-block { padding: 1.75rem 1rem 2rem; }
  .faq__q { padding: 1rem; }
  .faq__a { padding: 0 1rem 1rem; }
  .footer { padding: 1.5rem 1rem; }
  .footer__grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .cta-section { margin: 0 1rem 1.5rem; flex-direction: column; align-items: flex-start; }
  .header__wrap { padding: 0 1rem; }
  .content, .footer { border-left: none; border-right: none; }
  :root { --aside-panel-width: 100%; --aside-space: 44px; }
}
