/* ==========================================================================
   AI Insight — grey & black theme
   ========================================================================== */

:root {
  --black: #0c0c0c;
  --ink: #161616;
  --graphite: #232323;
  --charcoal: #2e2e2e;
  --steel: #5c5c5c;
  --grey: #8a8a8a;
  --silver: #b9b9b9;
  --mist: #d6d6d6;
  --paper: #e9e9e9;
  --sheet: #f5f5f5;
  --white: #ffffff;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;

  --wrap: 1240px;
  --gutter: 16px;
  --radius: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--white);
  color: var(--black);
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

:focus-visible {
  outline: 2px solid var(--grey);
  outline-offset: 3px;
}

/* ---------- Top bar ---------- */

.topbar {
  background: var(--black);
  color: var(--mist);
  border-bottom: 1px solid var(--charcoal);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand__mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--steel);
  background: var(--graphite);
  color: var(--white);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .02em;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.2;
  min-width: 0;
}

.brand__text strong {
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: .01em;
}

.brand__text small {
  color: var(--grey);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- Language switcher ---------- */

.lang-switch ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-switch a {
  display: block;
  min-width: 40px;
  padding: 6px 9px;
  border: 1px solid var(--charcoal);
  border-radius: var(--radius);
  color: var(--silver);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .06em;
  text-align: center;
  text-decoration: none;
  transition: background-color .2s, color .2s, border-color .2s;
}

.lang-switch a:hover {
  border-color: var(--grey);
  color: var(--white);
}

.lang-switch a.is-active {
  background: var(--sheet);
  border-color: var(--sheet);
  color: var(--black);
}

/* ---------- Layout: main text + right column ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  align-items: start;
  padding-top: 32px;
  padding-bottom: 56px;
}

.layout__main {
  min-width: 0;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--steel);
  font-size: 14px;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--silver);
}

.breadcrumbs a {
  color: var(--charcoal);
  text-decoration: none;
  border-bottom: 1px solid var(--silver);
}

.breadcrumbs a:hover {
  border-color: var(--black);
}

/* ---------- Article ---------- */

.post {
  background: var(--sheet);
  border: 1px solid var(--mist);
  padding: 40px 48px 48px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 30px -18px rgba(0, 0, 0, .25);
}

.post__category,
.card__category {
  margin: 0 0 10px;
  color: var(--steel);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.post__title {
  margin: 0 0 16px;
  color: var(--black);
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--mist);
  color: var(--steel);
  font-size: 14px;
}

.post__meta strong {
  color: var(--ink);
  font-weight: 600;
}

.post__figure {
  margin: 0 0 32px;
}

.post__figure figcaption {
  margin-top: 10px;
  color: var(--steel);
  font-size: 13px;
  text-align: center;
}

.post__body > :first-child {
  margin-top: 0;
}

.post__body h2 {
  margin: 40px 0 14px;
  color: var(--black);
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.4vw, 27px);
  line-height: 1.3;
}

.post__body h3 {
  margin: 28px 0 10px;
  font-size: 19px;
  line-height: 1.4;
}

.post__body p {
  margin: 0 0 18px;
}

.post__body ul,
.post__body ol {
  margin: 0 0 22px;
  padding-left: 22px;
}

.post__body li {
  margin-bottom: 8px;
}

.post__body li::marker {
  color: var(--steel);
}

.post__body .summary {
  margin: 0 0 28px;
  padding: 22px 26px 12px;
  background: var(--paper);
  border-left: 4px solid var(--black);
}

.post__body .summary h2 {
  margin-top: 0;
}

.post__body .conclusion {
  padding: 14px 18px;
  background: var(--white);
  border: 1px solid var(--mist);
  border-left: 4px solid var(--steel);
}

.post__body .note {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--mist);
  color: var(--steel);
  font-size: 14px;
}

/* ---------- Image frames: fixed ratio, centered, never stretched ---------- */

.frame {
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--silver);
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .45);
}

.frame__inner {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: var(--graphite);
  border: 1px solid var(--mist);
}

/* Fallback for browsers without aspect-ratio support. */
@supports not (aspect-ratio: 1 / 1) {
  .frame__inner { height: 0; padding-top: 56.25%; }
  .frame--portrait .frame__inner { padding-top: 125%; }
  .frame__inner img { position: absolute; inset: 0; }
}

.frame__inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.frame--portrait {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.frame--wide {
  width: 100%;
  margin: 0 auto;
}

.frame--thumb {
  padding: 6px;
  background: var(--graphite);
  border: 0;
  border-bottom: 1px solid var(--charcoal);
  box-shadow: none;
}

.frame--thumb .frame__inner {
  border-color: var(--charcoal);
}

/* ---------- Right column: 4 vertical article blocks ---------- */

.aside__title {
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--black);
  color: var(--black);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--ink);
  border: 1px solid var(--charcoal);
  color: var(--mist);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--steel);
  box-shadow: 0 14px 28px -18px rgba(0, 0, 0, .6);
}

.card.is-current {
  border-color: var(--grey);
  box-shadow: inset 4px 0 0 var(--silver);
}

.card__link {
  display: block;
  text-decoration: none;
}

.card__body {
  padding: 16px 18px 18px;
}

.card .card__category {
  margin-bottom: 6px;
  color: var(--grey);
  font-size: 11px;
}

.card__title {
  margin: 0 0 8px;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.35;
}

.card__excerpt {
  margin: 0 0 12px;
  color: var(--silver);
  font-size: 14px;
  line-height: 1.55;
}

.card__more {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--steel);
}

/* ---------- Footer ---------- */

.footer {
  background: var(--black);
  color: var(--silver);
  font-size: 15px;
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 40px;
  padding-top: 44px;
  padding-bottom: 32px;
}

.footer__brand {
  margin: 0 0 10px;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 22px;
}

.footer__about p:last-child {
  margin: 0;
  line-height: 1.7;
}

.footer__heading {
  margin: 0 0 12px;
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.footer__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__nav li {
  margin-bottom: 8px;
  line-height: 1.45;
}

.footer__nav a {
  color: var(--silver);
  text-decoration: none;
}

.footer__nav a:hover {
  color: var(--white);
  text-decoration: underline;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 22px;
  border-top: 1px solid var(--charcoal);
  color: var(--grey);
  font-size: 13px;
}

.footer__bottom p {
  margin: 0;
}

/* ---------- 404 ---------- */

.not-found {
  padding: 80px 0;
  text-align: center;
}

.not-found h1 {
  font-family: var(--font-serif);
  font-size: 40px;
  margin: 0 0 12px;
}

.not-found a {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 18px;
  background: var(--black);
  color: var(--white);
  text-decoration: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
  }

  .post {
    padding: 32px 32px 40px;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .layout {
    padding-top: 20px;
  }

  .post {
    padding: 22px 16px 28px;
    margin: 0 calc(var(--gutter) * -1);
    border-left: 0;
    border-right: 0;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand__text small {
    display: none;
  }

  .brand__text strong {
    font-size: 19px;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .lang-switch a {
    min-width: 0;
    padding: 5px 7px;
    font-size: 12px;
  }

  .post__body .summary {
    padding: 18px 16px 8px;
  }

  .frame--portrait {
    max-width: calc(100% - 14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card {
    transition: none;
  }
}
