/* =========================================================
   ARTICLE SYSTEM — public styles.
   Extends assets/style.css using the same design tokens.
   ========================================================= */

/* Prevent any horizontal panning of the page itself (the carousel is the
   only element that may scroll sideways, inside its own container).
   `clip` fully removes the horizontal scroll area (better than `hidden`);
   the `hidden` line is the fallback for older browsers. */
html, body {
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100%;
}

/* ---------- Homepage carousel ---------- */
.article-carousel-section .section-title { margin-bottom: 12px; }

.article-carousel-section .container,
.article-carousel-wrap {
  max-width: 100%;
  min-width: 0;
}

.article-carousel-wrap { position: relative; }

.article-carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 10px 4px 26px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* Swiping past the last card must NOT drag the whole page sideways. */
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  scrollbar-color: var(--silver) transparent;
}

.article-carousel:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }

.article-card {
  flex: 0 0 min(360px, 82vw);
  scroll-snap-align: start;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--metal-silver);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.35s ease;
}

.article-card:hover {
  transform: translateY(-6px);
  border-color: rgba(199, 161, 87, 0.48);
  box-shadow: var(--shadow-lg);
}

.article-card-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink-2);
}

.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.article-card:hover .article-card-image img { transform: scale(1.04); }

.article-card-image .article-card-category {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
}

.article-card-category {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--metal-gold);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-card-body {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 22px 24px 26px;
}

.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--ink-3);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-card h3 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  line-height: 1.15;
}

.article-card h3 a:hover { color: var(--teal); }

.article-card-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .text-link { margin-top: 6px; }

.article-carousel-controls {
  display: flex;
  margin-top: 6px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.article-carousel-arrows { display: flex; gap: 8px; }

.article-carousel-arrows .slider-arrow {
  color: var(--ink);
  border-color: var(--line);
  background: var(--white);
}

.article-carousel-arrows .slider-arrow:hover { color: var(--white); background: var(--ink); }
.article-carousel-arrows .slider-arrow[disabled] { opacity: 0.35; cursor: default; }

/* ---------- Article grid (listing pages) ---------- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.articles-grid .article-card { flex: none; }

.cms-empty {
  display: grid;
  padding: 70px 30px;
  place-items: center;
  gap: 14px;
  text-align: center;
  border: 1px dashed var(--silver);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
}

.cms-empty h3 { margin: 0; font-size: 1.7rem; }
.cms-empty p { margin: 0; color: var(--muted); max-width: 480px; }

/* ---------- Pagination ---------- */
.cms-pagination {
  display: flex;
  flex-wrap: wrap;
  margin-top: 48px;
  justify-content: center;
  gap: 8px;
}

.cms-pagination .page-link {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 800;
  transition: background 0.25s ease, color 0.25s ease;
}

.cms-pagination .page-link:hover { color: var(--white); background: var(--ink); }
.cms-pagination .page-link.is-current { color: var(--ink); background: var(--metal-gold); border-color: transparent; }

/* ---------- Search ---------- */
.article-search-form {
  display: flex;
  max-width: 560px;
  gap: 10px;
}

.article-search-form input[type="search"] {
  flex: 1;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

.article-search-form input[type="search"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(183, 142, 66, 0.13);
}

/* ---------- Single article ---------- */
.article-layout {
  max-width: 800px;
  margin-inline: auto;
}

/* Article headline. Adjust the three clamp() values to control size:
   clamp(minimum, preferred, maximum). */
.article-title {
  margin-bottom: 20px;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.15;
}

@media (max-width: 620px) {
  .article-title { font-size: clamp(1.5rem, 6.5vw, 2rem); }
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 26px;
  color: var(--ink-3);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.article-hero-image {
  overflow: hidden;
  margin: 0 0 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.article-hero-image img { width: 100%; height: auto; }
.article-hero-image figcaption { padding: 12px 4px 0; color: var(--muted); font-size: 0.85rem; }

.article-content {
  font-size: 1.08rem;
  line-height: 1.8;
}

.article-content h2, .article-content h3, .article-content h4 { margin: 1.6em 0 0.6em; }
.article-content p, .article-content ul, .article-content ol { margin-bottom: 1.2em; }
.article-content img { border-radius: var(--radius-sm); height: auto; }
.article-content a { color: #8b6a30; text-decoration: underline; text-underline-offset: 3px; }
.article-content blockquote {
  margin: 1.6em 0;
  padding: 18px 26px;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--gold-soft);
  font-family: Georgia, serif;
  font-size: 1.15rem;
}
.article-content pre {
  padding: 18px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  color: var(--silver-light);
  background: var(--ink);
  font-size: 0.9rem;
}
.article-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; }
.article-content th, .article-content td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.article-content th { background: var(--silver-soft); }

.article-tags-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 34px; }

.article-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.share-btn {
  display: inline-flex;
  min-height: 42px;
  padding: 0 16px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.share-btn:hover { color: var(--white); background: var(--ink); }

.article-author-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  margin-top: 44px;
  padding: 26px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--metal-silver);
}

.article-author-avatar {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--metal-gold);
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
}

.article-author-box h3 { margin-bottom: 4px; font-size: 1.3rem; }
.article-author-box p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.article-prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 44px;
}

.article-prevnext a {
  display: grid;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.article-prevnext a:hover { border-color: rgba(199, 161, 87, 0.5); transform: translateY(-3px); }
.article-prevnext span { color: var(--ink-3); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.article-prevnext strong { font-family: Georgia, serif; font-size: 1.08rem; font-weight: 500; }
.article-prevnext .next { text-align: right; }

/* ---------- Comments ---------- */
.comments-section { margin-top: 64px; }
.comments-section > h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin-bottom: 26px; }

.comment-item {
  display: grid;
  gap: 8px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.comment-item-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.comment-item-header strong { font-size: 1rem; }
.comment-item-header time { color: var(--ink-3); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.comment-item p { margin: 0; color: var(--ink-2); }

.comment-form-wrap {
  margin-top: 40px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.comment-form-wrap h3 { margin-bottom: 20px; }

.comments-closed-note {
  margin-top: 26px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--silver-soft);
  font-size: 0.92rem;
}

.form-alert {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
}

.form-alert.is-success { color: #2b5b34; background: #e9f5ec; border: 1px solid #bfe0c8; }
.form-alert.is-error { color: #7c2f2f; background: #fdecec; border: 1px solid #f2c6c6; }

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

/* Honeypot: visually removed, still in the DOM for bots. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Contact OTP panel ---------- */
.otp-panel {
  text-align: center;
  align-self: start;
}

.otp-panel-icon {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 20px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--metal-gold);
  box-shadow: 0 0 0 12px rgba(199, 161, 87, 0.12);
}

.otp-panel-icon svg { width: 34px; height: 34px; }

.otp-code-input {
  width: min(320px, 100%);
  min-height: 72px;
  margin-inline: auto;
  padding: 0 18px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  text-align: center;
  text-indent: 0.45em; /* visually centres the spaced digits */
  outline: none;
}

.otp-code-input:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 5px rgba(183, 142, 66, 0.15);
}

.otp-panel .btn { max-width: 320px; margin-inline: auto; }

.otp-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.otp-panel-actions form { display: inline; }

/* ---------- Breadcrumb (light pages) ---------- */
.breadcrumbs-light {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 22px;
  align-items: center;
  gap: 9px;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 700;
}

.breadcrumbs-light a:hover { color: var(--teal); }
.breadcrumbs-light span:last-child { color: #8b6a30; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .articles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .article-prevnext { grid-template-columns: 1fr; }
  .article-prevnext .next { text-align: left; }
}

@media (max-width: 620px) {
  .articles-grid { grid-template-columns: 1fr; }
  .article-card { flex-basis: 86vw; }
  .article-author-box { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .article-carousel { scroll-behavior: auto; }
  .article-card, .article-card-image img { transition: none; }
}
