/* =============================================================
   stremio.stream — main.css
   Clean stylesheet. No WordPress bloat. Only what this site uses.
   ============================================================= */

/* ── 1. CSS Variables (site theme) ─────────────────────────── */
:root {
  --color-main:       #39487d;
  --color-secondary:  #333333;
  --color-text:       #444444;
  --color-bg:         #eeeeee;
  --color-link:       #1063a3;
  --color-white:      #ffffff;

  --header-bg:        #ffffff;
  --header-border:    #39487d;

  --footer-bg:        #333333;
  --footer-text:      #bbbbbb;

  --h1-size:          1.7em;
  --h2-size:          1.2em;
  --h3-size:          1.17em;

  --h2-bg:            #d1d1d1;

  --sidebar-width:    30%;
  --section-max:      62rem;
  --radius:           0.5rem;
  --radius-sm:        0.3rem;

  --shadow:           0 1px 5px -1px rgba(0,0,0,.25);
  --shadow-lg:        0 3px 7px -1px rgba(0,0,0,.25);
}

/* ── 2. Reset (minimal — no normalize bloat) ────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body  { min-height: 100vh; width: 100%; margin: 0; overflow-x: clip; }
img, svg    { max-width: 100%; height: auto; display: block; }
ol, ul      { padding: 0; margin: 0; }
a           { color: var(--color-link); text-decoration: none; }
a:hover     { opacity: .9; }

/* ── 3. Base typography ─────────────────────────────────────── */
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  line-height: 1.2;
  clear: both;
  margin: 0 0 20px;
}
h1 {
  color: var(--color-main);
  font-size: var(--h1-size);
  font-weight: 600;
  margin: 1em 0 .8em;
  text-align: center;
}
h2 {
  background: var(--h2-bg);
  color: var(--color-secondary);
  font-size: var(--h2-size);
  font-weight: 600;
  padding: .6em .85em;
  text-align: center;
  border-radius: var(--radius-sm);
}
h3 {
  font-size: var(--h3-size);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-text);
  padding-bottom: 5px;
}
p { margin: 0 0 20px; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; }
strong, b { font-weight: 600; }

ul li { list-style: none; padding-bottom: .5em; }
ol li { list-style: none; padding-bottom: .5em; }
article ul li { list-style: disc; }
article ol li { list-style: decimal; }
article ul, article ol { margin: 0 0 20px 15px; padding-left: 1em; }

blockquote {
  border-left: 4px solid #dedede;
  font-style: italic;
  margin: 0 0 20px 20px;
  padding: 20px;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  margin: 0 0 1.5em;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
}
table th, table td { padding: 1em 1.3em; line-height: 1.4; }
table th { font-weight: 600; text-align: left; background: #e8e8e8; }
table td { border-left: 1px solid #dedede; background: #fff; }
table tr:nth-child(even) td { background: #fafbfb; }

/* ── 4. Layout — page structure ─────────────────────────────── */
#page { min-height: 100vh; display: flex; flex-direction: column; }

main {
  background: var(--color-bg);
  flex: 1;
  min-height: 24em;
}

.section {
  margin: 0 auto;
  max-width: var(--section-max);
  padding: 1em;
  width: 100%;
}

/* Sidebar layout — activated on posts only */
.main-section {
  display: flex;
  flex-direction: column;
}

@media (min-width: 860px) {
  .has-sidebar .main-section {
    flex-direction: row;
    align-items: flex-start;
  }
  .has-sidebar .main-section > article {
    flex: 1 1;
    min-width: 0;
  }
  .has-sidebar .main-section > aside {
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    position: -webkit-sticky;
    position: sticky;
    top: 2em;
    align-self: start;
    height: fit-content;
  }
  .has-sidebar .main-section > aside .widget {
    margin-left: 2em;
  }
}

/* ── 5. Header ──────────────────────────────────────────────── */
.top-bar {
  background: var(--header-bg);
  position: relative;
  z-index: 99;
  width: 100%;
}
.top-bar .section {
  display: flex;
  align-items: center;
  height: 2.8em;
  padding-top: 0;
  padding-bottom: 0;
}
.logo-container {
  flex: 1 1;
  display: flex;
  align-items: center;
  height: 100%;
  overflow: hidden;
}
.logo-container a { display: flex; align-items: center; height: 100%; }
.logo-container img { display: inline-block; max-height: 60%; width: auto; margin: auto 0; border-radius: 0; }

/* Hamburger button — only shown on mobile */
#js-subheader-menu-opener {
  display: none; /* hidden on desktop, shown below 860px */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 32px;
  flex: 0 0 32px;
  margin-right: 12px;
}
#js-subheader-menu-opener svg { display: block; fill: var(--color-main); }
#js-subheader-menu-opener .close { display: none; }
body.menu-open #js-subheader-menu-opener .open  { display: none; }
body.menu-open #js-subheader-menu-opener .close { display: block; }



svg.main-color * { fill: var(--color-main); }

/* Right side nav area */
.top-bar .right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: auto;
}

/* ── 6. Navigation menus ────────────────────────────────────── */
nav.top-menu > ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}
nav.top-menu > ul > li {
  list-style: none;
  padding: 0;
  position: relative;
}

/* Top-level links */
nav.top-menu > ul > li > a {
  color: var(--color-main);
  display: flex;
  align-items: center;
  gap: .3em;
  font-size: .9em;
  font-weight: 500;
  padding: .5em .75em;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
nav.top-menu > ul > li > a:hover {
  background: rgba(57, 72, 125, .08);
  opacity: 1;
}

/* Dropdown arrow on items with children */
nav.top-menu > ul > li.menu-item-has-children > a::after {
  content: "▾";
  font-size: 1.1em;
  line-height: 1;
  color: var(--color-main);
  transition: transform .2s;
  display: inline-block;
  margin-left: 8px;
}
nav.top-menu > ul > li.menu-item-has-children:hover > a::after,
nav.top-menu > ul > li.menu-item-has-children.mobile-open > a::after {
  transform: rotate(180deg);
}

/* Sub-menu panel */
nav.top-menu ul li ul.sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin: 0;
  background: var(--color-white);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  border-radius: var(--radius);
  border-top: 3px solid var(--color-main);
  min-width: 220px;
  z-index: 100;
  flex-direction: column;
  padding: .4em 0;
  animation: fadeDown .15s ease;
}
nav.top-menu ul li ul.sub-menu::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  height: 15px;
}
@keyframes fadeDown {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (min-width: 860px) {
  nav.top-menu ul li:hover > ul.sub-menu { display: flex; }
}

/* Mobile specific menu overrides */
@media (max-width: 859px) {
  #js-subheader-menu-opener { display: block; }
  
  .top-bar .right {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    box-shadow: var(--shadow-lg);
    border-top: 1px solid #eee;
    display: none !important; /* Force hide by default on mobile */
  }
  
  body.menu-open .top-bar .right {
    display: block !important;
    animation: fadeDown .15s ease;
  }

  nav.top-menu ul { flex-direction: column; width: 100%; }
  
  nav.top-menu > ul > li { width: 100%; }
  
  nav.top-menu > ul > li > a { 
    display: flex;
    width: 100%;
    padding: 1.2em; 
    border-bottom: 1px solid #f0f0f0; 
    border-radius: 0;
    justify-content: space-between; 
    text-align: left;
    box-sizing: border-box;
  }
  
  nav.top-menu ul li ul.sub-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-top: 1px solid #f0f0f0;
    border-left: 4px solid var(--color-main);
    background: #fafafa;
    border-radius: 0;
    padding: 0;
    width: 100%;
    animation: none;
    box-sizing: border-box;
  }
  
  nav.top-menu ul li.menu-item-has-children.mobile-open > ul.sub-menu { 
    display: flex; 
  }
}

nav.top-menu ul li ul.sub-menu li a {
  color: var(--color-secondary);
  display: block;
  font-size: .88em;
  padding: .6em 1.2em;
  white-space: normal;
  line-height: 1.3;
  transition: background .12s, color .12s;
}
nav.top-menu ul li ul.sub-menu li a:hover {
  background: rgba(57, 72, 125, .07);
  color: var(--color-main);
  opacity: 1;
}

/* Overlay mask for mobile menu */
#js-overlay-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.36);
  z-index: 98;
}
body.menu-open #js-overlay-mask { display: block; }


/* ── 7. Article content ─────────────────────────────────────── */
article header { text-align: center; }

.content > :first-child { margin-top: 0; }
.content > :last-child  { margin-bottom: 0; }

/* Images centered inside content */
.content img,
.content figure,
.content .wp-block-image,
.content p img,
.aligncenter,
figure.aligncenter,
img[src*="stremio-icon.png"] {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.content p:has(> img),
.wp-block-image figure { text-align: center; }

/* Center first 2 paragraphs on landing pages */
article.page  .content > p:nth-of-type(1),
article.page  .content > p:nth-of-type(2),
article.home  .content > p:nth-of-type(1),
article.home  .content > p:nth-of-type(2),
.content p:has(+ p a[href*="stremio.com/download"]),
.content p:has(a[href*="stremio.com/download"]),
p.has-text-align-center,
.has-text-align-center { text-align: center; }

/* WP block images */
.wp-block-image figure,
.wp-block-image img { border-radius: var(--radius); }
.wp-block-image > figure,
.wp-caption { margin-bottom: 1.5em; max-width: 100%; }
.wp-block-image > figure figcaption,
.wp-caption-text { color: #666; font-size: 90%; padding: 5px; text-align: left; }

/* WP block columns */
.wp-block-columns { display: flex; gap: 1em; flex-wrap: wrap; }
.wp-block-column  { flex: 1 1 250px; }

.ad-container {
  margin: 1.5em auto;
  text-align: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.ad-container ins.adsbygoogle,
.ad-container ins.adsbygoogle iframe {
  max-width: 100% !important;
  box-sizing: border-box !important;
}


/* ── 9. Sidebar widget ──────────────────────────────────────── */
aside .widget {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1em;
  margin: 0 0 1em;
}
aside .widget .title {
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: .5em;
}

/* ── 10. Related posts grid ─────────────────────────────────── */
.related-posts {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 2px solid #e0e0e0;
}
.related-posts > .as-h2 {
  display: block;
  width: 100%;
  background: var(--color-main);
  color: #fff;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .7em 1.2em;
  text-align: left;
  border-radius: var(--radius);
  margin-bottom: 1em;
}
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}
.post-grid-item {
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--color-text);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.post-grid-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
}
.post-grid-item .thumb {
  position: relative;
  padding-top: 60%;
  overflow: hidden;
  background: #ddd;
}
.post-grid-item .thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.post-grid-item:hover .thumb img {
  transform: scale(1.05);
}
.post-grid-item .title {
  padding: .85em 1em;
  font-size: .88em;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-main);
  border-top: 3px solid var(--h2-bg);
}

/* ── 11. Footer ─────────────────────────────────────────────── */
.main-footer {
  background: var(--footer-bg);
  border-top: .1em solid var(--footer-bg);
  color: var(--footer-text);
  margin-top: 1em;
  padding: 2em 1em;
  text-align: center;
  width: 100%;
}
.main-footer a { color: var(--footer-text); }
.copyright { text-align: center; margin: 0; }
