/* ==========================================================================
   KlikkMedia Magazin — magazine stylesheet (hand-written, no build step)
   Extends klikkmedia.css (copied into dist/assets by build.py). Adds:
   editorial homepage, article layout,
   and WCAG 2.1 AA helpers. Tokens are inherited from klikkmedia.css.
   ========================================================================== */

/* 3. Magazine sub-nav ------------------------------------------------------- */
.mag-nav { border-top: 1px solid var(--line-soft); background: #fff; }
.mag-nav-in { display: flex; align-items: center; gap: 2px; overflow-x: auto; }
.mag-nav-in a {
  display: inline-flex; align-items: center; padding: 12px 14px; white-space: nowrap;
  font: 500 14px/1 var(--f-body); color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent;
}
.mag-nav-in a:hover { color: var(--b-600); }
.mag-nav-in a[aria-current="page"] { color: var(--b-600); border-bottom-color: var(--b-600); font-weight: 600; }

/* 4. Home — masthead & topic chips ----------------------------------------- */
.mag-masthead { padding: clamp(40px, 6vw, 72px) 0 clamp(28px, 4vw, 44px); }
.mag-masthead h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); margin-bottom: .3em; }
.mag-masthead .lead { margin-bottom: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font: 500 13.5px/1 var(--f-body);
}
a.chip:hover { border-color: var(--b-600); color: var(--b-600); }
.chip-inactive { color: var(--muted); border-style: dashed; }

/* 5. Story cards & covers --------------------------------------------------- */
.cover { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--b-100); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.kicker {
  display: inline-block; font: 500 11.5px/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--b-600);
  margin: 0 0 8px;
}
.story-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--body);
  background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden;
  transition: border-color .2s, transform .25s var(--ease);
}
.story-card:hover { border-color: var(--b-300); transform: translateY(-3px); color: var(--body); }
.story-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font: 600 1.06rem/1.3 var(--f-display); color: var(--ink); letter-spacing: -.01em; }
.story-card:hover .card-title { color: var(--b-700); }
.card-lead { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.story-meta { margin-top: auto; padding-top: 10px; font: 500 12px/1.4 var(--f-mono); letter-spacing: .02em; color: var(--muted); }
.story-card h2.card-title { font-size: 1.2rem; }
.story-card h3.card-title { font-size: 1.06rem; }

.badge-planned {
  display: inline-block; align-self: flex-start; margin: 0 0 6px;
  background: var(--paper-2); color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 3px 8px;
  font: 600 10.5px/1.3 var(--f-mono); letter-spacing: .05em; text-transform: uppercase;
}
.story-card.planned { border-style: dashed; background: var(--paper); }
.story-card.planned .cover img { opacity: .55; }

/* 6. Home — lead story, top grid, rails, latest ----------------------------- */
.mag-lead { padding: 0 0 clamp(40px, 5vw, 64px); }
.lead-story {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(20px, 3vw, 40px);
  align-items: center; text-decoration: none; color: var(--body);
}
.lead-story .cover { aspect-ratio: 16 / 9; border-radius: var(--r-lg); }
.lead-story .lead-body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.lead-story h2.card-title { font-size: clamp(1.5rem, 3vw, 2.3rem); margin: 2px 0 8px; }
.lead-story .card-lead { font-size: 17px; }
.lead-story:hover h2.card-title { color: var(--b-700); }

.top-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }

.rail { margin: 0 0 clamp(40px, 5vw, 60px); }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 3px solid var(--line); padding-bottom: 10px; margin-bottom: 18px; }
.rail-head h2 { font-size: clamp(1.25rem, 2vw, 1.6rem); margin: 0; }
.rail-head a { font: 500 13px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.rail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.latest { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.latest li { border-bottom: 1px solid var(--line-soft); }
.latest a { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 20px; padding: 16px 4px; text-decoration: none; color: var(--body); }
.latest a:hover .lt-title { color: var(--b-600); }
.latest .lt-date { font: 500 12.5px/1.5 var(--f-mono); color: var(--muted); }
.latest .lt-title { font: 600 1.02rem/1.4 var(--f-display); color: var(--ink); letter-spacing: -.01em; }
.latest .lt-cat { grid-column: 2; font: 500 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--b-600); }
@media (max-width: 640px) {
  .latest a { grid-template-columns: 1fr; }
  .latest .lt-cat { grid-column: 1; }
}

.empty {
  border: 1px dashed var(--line); border-radius: var(--r-md); background: #fff; padding: 40px 28px; text-align: center;
}
.empty h2 { font-size: 1.3rem; }
.empty p { margin: 0 auto; max-width: 52ch; color: var(--muted); }

@media (max-width: 1080px) { .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .lead-story { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .top-grid, .rail-grid { grid-template-columns: 1fr; } }

/* 7. Listing pages (category / tag) ---------------------------------------- */
.listing-head { padding: clamp(32px, 5vw, 56px) 0 24px; }
.listing-head h1 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
.listing-head .lead { color: var(--muted); }
.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding-bottom: clamp(40px, 5vw, 64px); }
@media (max-width: 900px) { .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .listing-grid { grid-template-columns: 1fr; } }

/* 8. Article page ----------------------------------------------------------- */
.article-wrap { padding-bottom: clamp(48px, 6vw, 80px); }
.article { max-width: 760px; margin: 0 auto; }
.article-head { padding: 8px 0 4px; }

  .article-head h1 { margin: 6px 0 .4em; }
.article-head .lead { font-size: clamp(17px, 1.7vw, 20px); }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0 2px; font: 500 12.5px/1.5 var(--f-mono); color: var(--muted); }
.article-meta time { color: var(--ink); }
.article-cover { margin: 22px 0 26px; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16 / 9; background: var(--b-100); }
.article-cover img, .article-cover picture { display: block; width: 100%; height: 100%; object-fit: cover; }
.article-cover picture img { width: 100%; height: 100%; object-fit: cover; }

.toc { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 22px; margin: 0 0 26px; }
.toc h2 { font: 500 12px/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc ol { margin: 0; padding-left: 1.25em; }
.toc li { margin: 6px 0; }
.toc a { color: var(--b-600); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.prose { font-size: 1.02em; }

  .prose h2 { margin: 1.7em 0 .6em; }

  .prose h3 { margin: 1.5em 0 .5em; }
.prose blockquote { border-left: 3px solid var(--b-500); margin: 1.3em 0; padding: 4px 0 4px 20px; color: var(--ink); font-size: 1.05em; }
.prose blockquote p:last-child { margin: 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--paper-2); color: var(--ink); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.sources { font-size: 15px; padding-left: 1.2em; }
.sources li { margin-bottom: 8px; }
.sources a { word-break: break-word; }

/* CTA box (builder-inserted, from front matter) */
.cta-box { background: var(--ink-deep); color: var(--on-dark); border-radius: var(--r-lg); padding: clamp(26px, 3.4vw, 40px); margin: 40px 0; }
.cta-box h2 { color: #fff; font-size: clamp(1.4rem, 2.6vw, 2rem); }
.cta-box .cta-text { color: var(--on-dark); max-width: 52ch; }
.cta-box .btn-primary { background: #fff; color: var(--ink); }
.cta-box .btn-primary:hover { background: var(--b-100); color: var(--ink); }
.cta-box .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
.cta-box .btn-ghost:hover { border-color: #fff; color: #fff; }

.related-articles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.related-articles .rel-card { min-height: 0; }
.related-articles .rel-card .kicker { margin: 0 0 4px; }
@media (max-width: 860px) { .related-articles { grid-template-columns: 1fr; } }

/* 9. Footer — 5 columns (Magazin added) ------------------------------------- */
.site-footer .foot-grid { grid-template-columns: 1.25fr 1fr 1fr 1fr 1.2fr; }
@media (max-width: 1060px) { .site-footer .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .site-footer .foot-grid { grid-template-columns: 1fr; } }

/* 10. SEL-style home: featured, stream, guides, lead magnet, editor picks ---- */
.featured { margin-bottom: clamp(40px, 5vw, 64px); }
.featured .rail-head { border-bottom-color: var(--b-600); }
.fresh-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--b-500); margin-right: 10px; }
.featured-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr); gap: 18px; }
.featured-side { display: flex; flex-direction: column; gap: 14px; }
.side-story { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; text-decoration: none; color: var(--body); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; background: #fff; }
.side-story .side-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--b-100); }
.side-story .side-img img { width: 100%; height: 100%; object-fit: cover; }
.side-story .side-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.side-story:hover .card-title { color: var(--b-600); }
.side-story .card-title { font-size: .98rem; }

.stream { margin-bottom: clamp(40px, 5vw, 60px); }
.stream-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.stream-item { border-bottom: 1px solid var(--line-soft); padding: 14px 2px; }
.stream-title { font: 600 1.05rem/1.4 var(--f-display); color: var(--ink); text-decoration: none; }
.stream-title:hover { color: var(--b-600); }
.stream-meta { display: block; margin-top: 4px; font: 500 12px/1.5 var(--f-mono); color: var(--muted); }
.stream-cat { color: var(--b-600); text-transform: uppercase; letter-spacing: .08em; }

.guides { margin-bottom: clamp(40px, 5vw, 60px); }
.guides-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.guide-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: #fff; text-decoration: none; color: var(--body); }
.guide-card:hover { border-color: var(--b-300); }
.guide-card:hover strong { color: var(--b-600); }
.guide-card strong { color: var(--ink); }

.lead-magnet { margin-bottom: clamp(40px, 5vw, 64px); }
.lm-box { display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--ink-deep); color: var(--on-dark); border-radius: var(--r-lg); padding: clamp(28px, 4vw, 48px); }
.lm-box h2 { color: #fff; font-size: clamp(1.4rem, 2.6vw, 2rem); margin: .2em 0; }
.lm-box p { max-width: 56ch; color: var(--on-dark); }
.lm-box .btn-primary { background: #fff; color: var(--ink); white-space: nowrap; }
.lm-box .btn-primary:hover { background: var(--b-100); color: var(--ink); }

.editors { margin-bottom: clamp(40px, 5vw, 64px); }
.editors-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pick-card { display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 1px solid var(--line); border-left: 5px solid var(--b-500); border-radius: var(--r-md); background: #fff; text-decoration: none; color: var(--body); }
.pick-card:hover strong { color: var(--b-600); }
.pick-card strong { font: 600 1.15rem/1.3 var(--f-display); color: var(--ink); }

.listing-tile { display: block; width: 100%; max-width: 720px; height: auto; aspect-ratio: 8 / 5; object-fit: contain; background: var(--paper-2); border-radius: var(--r-lg); margin-bottom: 22px; } /* 2026-10-26: no crop (tile has title text) */

@media (max-width: 900px) {
  .featured-grid { grid-template-columns: 1fr; }
  .guides-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lm-box { flex-direction: column; align-items: flex-start; }
  .editors-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .guides-grid { grid-template-columns: 1fr; }
  .side-story { grid-template-columns: 1fr; }
}

/* 11. Article conversion components ----------------------------------------- */
.for-whom { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); padding: 20px 24px; margin: 0 0 28px; }
.for-whom h2 { font-size: 1.15rem; margin: 0 0 12px; }
.for-whom p { margin: 8px 0; font-size: 15.5px; }
.for-whom .fw-yes::before { content: "✓ "; color: var(--b-600); font-weight: 700; }
.for-whom .fw-no::before { content: "✕ "; color: #C2410C; font-weight: 700; }

.prose blockquote.advertiser-claim { border-left: 3px solid #C2410C; background: var(--paper-2); padding: 14px 18px; border-radius: 0 var(--r-md) var(--r-md) 0; }
.prose blockquote.advertiser-claim .claim-label { display: block; font: 600 11px/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: #C2410C; margin-bottom: 6px; }

/* 12. Mobile layout fix 2026-10-26 ------------------------------------------
   Every magazine image is an infographic or contains text, so it is shown
   whole (object-fit: contain) on a neutral background in a fixed-ratio box.
   Add .is-photo to a .cover / .article-cover / .side-img for real photos (cover). */
main img, main picture, main svg { max-width: 100%; }
main picture { display: block; }
.cover, .article-cover, .side-story .side-img { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-2); }
.cover img, .side-story .side-img img,
.article-cover img, .article-cover picture, .article-cover picture img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; }
.cover.is-photo img, .article-cover.is-photo img, .side-img.is-photo img { object-fit: cover; }
.story-card .cover { border-bottom: 1px solid var(--line-soft); flex: none; }
.lead-story .cover { width: 100%; }

/* text: always left-aligned, never justified; long Hungarian compounds wrap */
main, main p, main li, main h1, main h2, main h3, .card-lead, .lead, .prose, .story-body, .lead-body, .listing-head { text-align: left; }
main h1, main h2, main h3, .card-title, .lead, .card-lead, .prose p, .prose li { overflow-wrap: break-word; hyphens: manual; }
.empty, .empty p { text-align: center; }

/* no horizontal overflow */
html, body { overflow-x: clip; }
.wrap { min-width: 0; }
.listing-grid > *, .rail-grid > *, .top-grid > *, .featured-grid > *, .lead-story > *, .editors-grid > *, .guides-grid > * { min-width: 0; }

@media (max-width: 600px) {
  .listing-head { padding: 24px 0 16px; }
  .listing-head .listing-tile { margin-bottom: 18px; border-radius: var(--r-md); }
  .listing-head h1, .article-head h1 { position: static; margin-top: 0; }
  .listing-grid, .rail-grid, .top-grid { gap: 16px; }
  .story-body { padding: 14px 16px 16px; }
  .lead-story { gap: 16px; }
  .lead-story .cover, .article-cover { border-radius: var(--r-md); }
  .article-cover { margin: 18px 0 22px; }
  .side-story { grid-template-columns: 1fr; gap: 0; }
  .side-story .side-body { padding: 12px 14px 14px; }
  .prose table { font-size: 14px; }
  .lm-box, .cta-box { padding: 22px 18px; }
}

/* 13. Mobile readability + overflow hardening 2026-10-26 (Levente, iPhone report on /magazin/ai-automation/)
   Cause-first: media/tables/pre are bounded, long tokens wrap, the rovat strip scrolls inside itself.
   html/body overflow-x:clip in §12 stays only as a last-resort guard (clip, not hidden: no scroll container). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, video, iframe, embed, object, canvas, svg, table, pre { max-width: 100%; }
img, video { height: auto; }
.prose pre { overflow-x: auto; white-space: pre; -webkit-overflow-scrolling: touch; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.prose a, .prose code, .sources, .sources a, .crumbs, .breadcrumbs, .card-title, .card-lead { overflow-wrap: anywhere; word-break: normal; }
.mag-nav { max-width: 100%; overflow: hidden; }
.mag-nav-in { max-width: 100%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; }
.mag-nav-in::-webkit-scrollbar { display: none; }
.mag-nav-in a { flex: none; }
.card-title { line-height: 1.25; }

@media (max-width: 600px) {
  .wrap { padding-left: 18px; padding-right: 18px; }
  body { font-size: 17px; line-height: 1.6; }
  .prose { font-size: 18px; line-height: 1.65; }
  .prose p, .prose li { line-height: 1.65; }
  .prose p, .prose ul, .prose ol, .prose blockquote { margin-top: 0; margin-bottom: 1em; }
  .prose li { margin-bottom: .4em; }

  .prose h2 { line-height: 1.25; margin: 1.6em 0 .55em; }

  .prose h3 { line-height: 1.3; margin: 1.4em 0 .5em; }

  .article-head h1 { line-height: 1.18; }
  .article-head .lead { font-size: 18px; line-height: 1.6; }

  .listing-head h1, .mag-masthead h1 { line-height: 1.15; }
  .listing-head p, .mag-masthead p { font-size: 17px; line-height: 1.6; }
  .card-lead, .lead-story .card-lead { font-size: 16.5px; line-height: 1.6; }
  .story-card h2.card-title { font-size: 1.3rem; }
  .story-card h3.card-title { font-size: 1.18rem; }
  .lead-story h2.card-title { font-size: 1.6rem; line-height: 1.2; }
  .for-whom p, .sources { font-size: 16px; line-height: 1.6; }
  .prose table { font-size: 15px; }
}
