/* Base layout — optimised for Chrome on 27"+ desktop screens */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f5f5f2;
  color: #222222;
  line-height: 1.72;
  font-size: 17px;
}

a {
  color: #1b4f72;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* --- Index page container --- */
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* --- Article page: wider reading column (desktop-focused) --- */
.page--article {
  max-width: 1500px;
}

.site-header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #ddd;
}

.site-title {
  font-size: 1.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.site-subtitle {
  margin-top: 0.4rem;
  color: #666;
  font-size: 1rem;
}

.site-meta {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: #999;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.article-card {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 1.35rem 1.6rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  border: 1px solid #e3e3df;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.article-card:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.article-card-title {
  font-size: 1.3rem;
  margin: 0 0 0.35rem 0;
}

.article-card-title a {
  color: inherit;
}

.article-card-meta {
  font-size: 0.88rem;
  color: #777;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.article-card-dek {
  font-size: 0.95rem;
  color: #555;
  margin-top: 0.4rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background-color: #eef3f7;
  color: #415a77;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-page-header {
  margin-bottom: 2.25rem;
}

.article-title {
  font-size: 2.15rem;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.article-subtitle {
  font-size: 1.1rem;
  color: #555;
  margin: 0.35rem 0 0.75rem 0;
}

.article-byline {
  font-size: 0.97rem;
  color: #555;
}

.article-date {
  font-size: 0.92rem;
  color: #777;
  margin-top: 0.1rem;
}

.article-url {
  font-size: 0.82rem;
  color: #999;
  margin-top: 0.75rem;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.78;
  margin-top: 2rem;
}

/* Two-column layout for article + study companion on large desktop screens */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.05fr);
  column-gap: 3.25rem;
  align-items: flex-start;
}

.article-main {
  min-width: 0;
}

.article-bot-panel {
  min-width: 0;
  padding: 0.25rem 0 0 1.75rem;
  border-left: 1px solid #e0e0dc;
  color: #333;
  font-size: 0.95rem;
}

/* On large screens, keep the study companion floating alongside the scrolling article body. */
@media (min-width: 1024px) {
  .article-bot-panel {
    position: sticky;
    top: 1.75rem;
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
  }
}

.article-bot-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #888;
  margin: 0 0 0.4rem 0;
}

.article-bot-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0 0.9rem 0;
}

.article-bot-selection {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #e2e2dc;
  background-color: #fafaf7;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.article-bot-selection.has-selection {
  border-color: #c8d8c8;
  background-color: #f7faf7;
}

.article-bot-selection__label {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #888;
  padding: 0.15rem 0.35rem;
  background: #eee;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-bot-selection.has-selection .article-bot-selection__label {
  background: #d8e8d8;
  color: #456;
}

.article-bot-selection__text {
  flex: 1;
  max-height: 6rem;
  overflow: auto;
  white-space: pre-wrap;
  color: #444;
}

.article-bot-selection__placeholder {
  color: #999;
  font-style: italic;
}

.article-bot-selection__clear {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 0.9rem;
  color: #888;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.article-bot-selection__clear:hover {
  color: #c44;
}

.article-bot-history {
  margin-bottom: 0.85rem;
  border: 1px solid #dcdcd6;
  border-radius: 8px;
  background: #fafaf7;
}

.article-bot-history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid #e6e6df;
}

.article-bot-history__title {
  font-size: 0.82rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-bot-history__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.article-bot-history__new {
  border-radius: 999px;
  border: 1px solid #d1d1cb;
  background: #fff;
  color: #666;
  cursor: pointer;
  font-size: 0.76rem;
  padding: 0.1rem 0.58rem;
}

.article-bot-history__new:hover {
  background: #f3f3ef;
}

.article-bot-history__io {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  margin-top: 0.45rem;
}

.article-bot-history__io button {
  font-size: 0.72rem;
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #d1d1cb;
  background: #fff;
  color: #555;
  cursor: pointer;
}

.article-bot-history__io button:hover {
  background: #f3f3ef;
}

.article-bot-history__toggle {
  border-radius: 999px;
  border: 1px solid #d1d1cb;
  background: #fff;
  color: #666;
  cursor: pointer;
  font-size: 0.76rem;
  padding: 0.1rem 0.58rem;
}

.article-bot-history__toggle:hover {
  background: #f3f3ef;
}

.article-bot-history.is-collapsed [data-bot-history-board] {
  display: none;
}

.article-bot-history__board {
  max-height: 16rem;
  overflow: auto;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.article-bot-history__empty {
  font-size: 0.82rem;
  color: #8a8a83;
  padding: 0.2rem 0.12rem;
}

.chat-history-card {
  border: 1px solid #e2e2db;
  background: #fff;
  border-radius: 7px;
}

.chat-history-card.is-active {
  border-color: #c9d8e9;
  box-shadow: inset 0 0 0 1px #e4eef8;
}

.chat-history-card__head {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  padding: 0.45rem 0.52rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.chat-history-card__title {
  font-size: 0.82rem;
  color: #444;
  line-height: 1.35;
  margin-bottom: 0.15rem;
}

.chat-history-card__meta {
  font-size: 0.74rem;
  color: #888;
}

.chat-history-card__caret {
  color: #888;
  font-size: 0.82rem;
  transition: transform 0.16s ease;
}

.chat-history-card.is-collapsed .chat-history-card__caret {
  transform: rotate(-90deg);
}

.chat-history-card__body {
  border-top: 1px dashed #ecece6;
  padding: 0.45rem 0.52rem 0.55rem;
}

.chat-history-card.is-collapsed .chat-history-card__body {
  display: none;
}

.chat-history-card__preview {
  margin: 0 0 0.45rem;
  color: #666;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-history-card__continue {
  border-radius: 999px;
  border: 1px solid #d0d0cb;
  background: #f8f8f6;
  color: #555;
  cursor: pointer;
  font-size: 0.74rem;
  padding: 0.1rem 0.55rem;
}

.chat-history-card__continue:hover {
  background: #ecece6;
}

.article-bot-messages {
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.2rem;
  margin-bottom: 0.75rem;
}

.article-bot-message {
  margin-bottom: 0.7rem;
}

.article-bot-message__role {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 0.1rem;
}

.article-bot-message__content {
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.article-bot-message__meta {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: #7a7a74;
}

.article-bot-message__actions {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.article-bot-copy-btn {
  border-radius: 999px;
  border: 1px solid #d0d0cb;
  background: #fff;
  color: #666;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.12rem 0.55rem;
}

.article-bot-copy-btn:hover {
  background: #f3f3ef;
}

.article-bot-sources {
  margin: 0.3rem 0 0.2rem 1rem;
  padding: 0;
}

.article-bot-sources li {
  margin: 0.15rem 0;
}

.article-bot-sources a {
  font-size: 0.8rem;
  color: #1b4f72;
}

.article-bot-input {
  width: 100%;
  min-height: 3rem;
  max-height: 6rem;
  resize: vertical;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #d0d0cb;
  font-family: inherit;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.article-bot-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.article-bot-preset-btn {
  border-radius: 999px;
  border: 1px solid #d0d0cb;
  background-color: #f7f7f4;
  padding: 0.18rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: #555;
}

.article-bot-preset-btn:hover {
  background-color: #ecece6;
}

.article-bot-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-bot-send-btn {
  border-radius: 999px;
  border: 1px solid #c5c5c0;
  background-color: #fcfcfb;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #444;
}

.article-bot-send-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.article-bot-send-btn:hover:not(:disabled) {
  background-color: #f1f1ee;
}

.article-bot-model-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.article-bot-model-label {
  font-size: 0.78rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.article-bot-model-dropdown {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #d0d0cb;
  background-color: #fcfcfb;
  color: #444;
  font-family: inherit;
  cursor: pointer;
}

.article-bot-model-dropdown:focus {
  outline: none;
  border-color: #1b4f72;
  box-shadow: 0 0 0 2px rgba(27, 79, 114, 0.15);
}

.article-bot-status {
  font-size: 0.8rem;
  color: #999;
}

.article-body p {
  margin: 0 0 1.15rem 0;
}

.article-body h2 {
  font-size: 1.25rem;
  margin: 1.8rem 0 0.6rem;
}

.article-body h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.4rem;
}

.meta-toggle {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e0e0dc;
}

.meta-toggle button {
  border-radius: 999px;
  border: 1px solid #c5c5c0;
  background-color: #fcfcfb;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #444;
}

.meta-toggle button:hover {
  background-color: #f1f1ee;
}

.meta-block {
  margin-top: 0.8rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background-color: #fbfbf7;
  border: 1px dashed #d2d2cd;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, "Courier New", monospace;
  font-size: 0.82rem;
  overflow-x: auto;
  max-height: 360px;
}

.meta-block pre {
  margin: 0;
  white-space: pre;
}

.breadcrumb {
  font-size: 0.82rem;
  margin-bottom: 1rem;
  color: #777;
}

.breadcrumb a {
  color: #777;
}

.breadcrumb a:hover {
  color: #1b4f72;
}

.print-learner-btn {
  margin-left: 1rem;
  border-radius: 999px;
  border: 1px solid #c5c5c0;
  background-color: #fcfcfb;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #444;
}

.print-learner-btn:hover {
  background-color: #f1f1ee;
}

.article-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.article-actions .print-learner-btn {
  margin-left: 0;
}

.session-copy-status {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  min-height: 1.3em;
}

/* ----- Print: full width, senior-friendly font and line spacing for annotations ----- */
@media print {
  @page {
    size: letter;
    margin: 0.75in;
  }

  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .page {
    max-width: none;
    width: 100%;
    padding: 0;
  }

  .article-page-header {
    break-after: avoid;
  }

  .article-title,
  .article-subtitle,
  .article-byline,
  .article-date {
    color: #000;
  }

  .article-body {
    width: 100%;
    max-width: none;
    padding: 0;
    font-size: 14pt;
    line-height: 2;
  }

  .article-body p {
    margin: 0 0 1rem 0;
    orphans: 2;
    widows: 2;
  }

  .article-body h2, .article-body h3 {
    break-after: avoid;
    orphans: 2;
    widows: 2;
  }
}
