/*
Theme Name: Toto IM
Theme URI: https://toto-im.com/
Author: toto-im
Description: Custom magazine theme matching the 2023 toto-im.com ColorMag colorway and layout. Not a ColorMag child or fork.
Version: 1.0.2
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 8.0
Text Domain: toto-im
*/

:root {
  --toto-accent: #cf2e2e;
  --toto-accent-dark: #b32525;
  --toto-text: #444;
  --toto-heading: #333;
  --toto-muted: #888;
  --toto-border: #eaeaea;
  --toto-bg: #fff;
  --toto-topbar: #f4f4f4;
  --toto-footer: #2c2c2c;
  --toto-footer-bar: #1b1b1b;
  --toto-container: 1200px;
  --toto-font: "Nanum Gothic", "Open Sans", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--toto-text);
  background: var(--toto-bg);
  font-family: var(--toto-font);
  font-size: 15px;
  line-height: 1.6;
}

body,
h1, h2, h3, h4, h5, h6,
li, a, textarea, p, span, dl, dt, dd, td, th,
button, strong, label, input {
  font-family: var(--toto-font);
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: var(--toto-heading);
  text-decoration: none;
}

a:hover {
  color: var(--toto-accent);
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--toto-heading);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.5em;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

.cm-container {
  width: 100%;
  max-width: var(--toto-container);
  margin: 0 auto;
  padding: 0 15px;
}

.cm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.cm-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

/* ----- header ----- */
.cm-top-bar {
  background: var(--toto-topbar);
  border-bottom: 1px solid var(--toto-border);
  font-size: 13px;
  color: #555;
  min-height: 36px;
}

.cm-top-bar .cm-row {
  min-height: 36px;
}

.cm-top-bar__1 {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  padding: 6px 0;
}

.date-in-header {
  white-space: nowrap;
  color: #666;
}

.breaking-news {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.breaking-news-latest {
  color: var(--toto-accent);
  margin-right: 10px;
  white-space: nowrap;
}

.newsticker {
  position: relative;
  height: 20px;
  overflow: hidden;
  flex: 1;
}

.newsticker li {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.newsticker li.is-active {
  opacity: 1;
  transform: translateY(0);
}

.cm-header-1 {
  padding: 18px 0;
  background: #fff;
}

.cm-header-1 .cm-row {
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.cm-site-branding img.custom-logo {
  width: 265px;
  height: 90px;
  object-fit: contain;
}

.cm-header-col-2 {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.advertisement_728x90 img {
  width: 728px;
  max-width: 100%;
  height: auto;
}

.cm-primary-nav {
  background: var(--toto-accent);
  position: relative;
}

.cm-primary-nav .cm-row {
  flex-wrap: nowrap;
  align-items: stretch;
}

.cm-home-icon {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.cm-home-icon a {
  color: #fff;
  display: flex;
  align-items: center;
}

.cm-home-icon .cm-icon--home {
  width: 20px;
  height: 16px;
}

.cm-menu-primary-container {
  flex: 1;
  min-width: 0;
}

.cm-menu-primary-container > ul {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.cm-menu-primary-container > ul > li {
  position: relative;
}

.cm-menu-primary-container > ul > li > a {
  display: block;
  color: #fff;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.cm-menu-primary-container > ul > li:hover > a,
.cm-menu-primary-container > ul > li.current-menu-item > a,
.cm-menu-primary-container > ul > li.current-menu-ancestor > a {
  background: var(--toto-accent-dark);
}

.sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 6px 0;
}

.sub-menu .sub-menu {
  left: 100%;
  top: 0;
}

.menu-item-has-children:hover > .sub-menu {
  display: block;
}

.sub-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: #333;
}

.sub-menu a:hover {
  color: var(--toto-accent);
  background: #fafafa;
}

.cm-submenu-toggle {
  display: none;
}

.cm-header-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.cm-random-post a,
.cm-top-search {
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 100%;
  min-height: 46px;
  cursor: pointer;
}

.cm-random-post a:hover,
.cm-top-search:hover,
.cm-top-search.is-open {
  background: var(--toto-accent-dark);
  color: #fff;
}

.cm-top-search {
  position: relative;
}

.search-form-top {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 120;
}

.cm-top-search.is-open .search-form-top {
  display: block;
}

.search-wrap {
  display: flex;
}

.search-wrap .s {
  border: 1px solid #ddd;
  padding: 8px 10px;
  width: 220px;
  font-size: 14px;
}

.search-wrap .search-icon {
  background: var(--toto-accent);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  cursor: pointer;
}

.cm-menu-toggle {
  display: none;
  margin: 0;
  padding: 12px 14px;
  color: #fff;
  cursor: pointer;
}

.cm-menu-toggle .cm-icon--x-mark {
  display: none;
}

.cm-menu-toggle.is-open .cm-icon--bars {
  display: none;
}

.cm-menu-toggle.is-open .cm-icon--x-mark {
  display: inline-block;
}

/* ----- layout ----- */
.cm-content {
  padding: 24px 0 40px;
}

.cm-front-page-top-section {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
}

.cm-slider-area,
.cm-beside-slider-widget {
  width: calc(50% - 8px);
}

.cm-single-slide {
  position: relative;
  display: none;
  overflow: hidden;
}

.cm-single-slide.is-active,
.cm-single-slide.displayblock {
  display: block;
}

.cm-single-slide img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}

.cm-slide-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 16px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  color: #fff;
}

.cm-slide-content .cm-entry-title a,
.cm-slide-content .cm-below-entry-meta,
.cm-slide-content .cm-below-entry-meta a {
  color: #fff;
}

.cm-highlighted-posts .cm-posts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cm-highlighted-posts .cm-post {
  position: relative;
  overflow: hidden;
}

.cm-highlighted-posts .cm-post img {
  width: 100%;
  height: 196px;
  object-fit: cover;
  display: block;
}

.cm-highlighted-posts .cm-post-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  color: #fff;
}

.cm-highlighted-posts .cm-entry-title {
  font-size: 14px;
  margin: 4px 0;
}

.cm-highlighted-posts .cm-entry-title a,
.cm-highlighted-posts .cm-below-entry-meta,
.cm-highlighted-posts .cm-below-entry-meta a {
  color: #fff;
}

.cm-below-entry-meta {
  font-size: 12px;
  color: var(--toto-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cm-below-entry-meta a {
  color: var(--toto-muted);
}

.cm-post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.cm-post-categories a {
  display: inline-block;
  background: var(--toto-accent);
  color: #fff !important;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  line-height: 1.6;
}

.cm-entry-title {
  font-size: 18px;
  margin: 0 0 6px;
}

.cm-entry-title a:hover {
  color: var(--toto-accent);
}

.cm-content > .cm-container > .cm-row {
  align-items: flex-start;
  gap: 30px;
}

.cm-primary {
  flex: 1;
  min-width: 0;
}

.cm-secondary {
  width: 300px;
  flex: 0 0 300px;
}

.cm-widget-title {
  border-bottom: 2px solid var(--toto-border);
  font-size: 18px;
  margin: 0 0 16px;
  padding: 0;
}

.cm-widget-title span {
  display: inline-block;
  border-bottom: 2px solid var(--toto-accent);
  padding-bottom: 6px;
  margin-bottom: -2px;
}

.cm-featured-posts {
  margin-bottom: 28px;
}

.cm-first-post .cm-post img {
  width: 100%;
  height: 205px;
  object-fit: cover;
  display: block;
  margin-bottom: 10px;
}

.cm-first-post .cm-entry-summary {
  font-size: 14px;
  color: #666;
  margin-top: 8px;
}

.cm-featured-posts .cm-posts .cm-post {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--toto-border);
}

.cm-featured-posts .cm-posts .cm-post img {
  width: 130px;
  height: 90px;
  object-fit: cover;
  flex: 0 0 130px;
}

.cm-featured-posts .cm-posts .cm-entry-title {
  font-size: 15px;
}

.cm-column-half {
  display: flex;
  gap: 24px;
  margin-bottom: 8px;
}

.cm-one-half {
  width: calc(50% - 12px);
}

/* ----- lists / singles ----- */
.toto-loop .cm-post {
  display: flex;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--toto-border);
}

.toto-loop .cm-post img {
  width: 240px;
  height: 150px;
  object-fit: cover;
  flex: 0 0 240px;
}

.toto-loop .cm-entry-title {
  font-size: 20px;
}

.single .cm-entry-header .cm-entry-title {
  font-size: 28px;
  margin: 8px 0 12px;
}

.cm-entry-content {
  font-size: 16px;
  line-height: 1.8;
}

.cm-entry-content p,
.cm-entry-content ul,
.cm-entry-content ol,
.cm-entry-content table,
.cm-entry-content blockquote {
  margin: 0 0 1.2em;
}

.cm-entry-content ul,
.cm-entry-content ol {
  padding-left: 1.4em;
  list-style: disc;
}

.cm-entry-content ol {
  list-style: decimal;
}

.cm-entry-content h2,
.cm-entry-content h3 {
  margin: 1.4em 0 0.6em;
}

.cm-entry-content img.aligncenter,
.cm-entry-content .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.cm-entry-content img.alignleft,
.alignleft {
  float: left;
  margin: 0 1.2em 1em 0;
}

.cm-entry-content img.alignright,
.alignright {
  float: right;
  margin: 0 0 1em 1.2em;
}

.cm-featured-image {
  margin: 0 0 20px;
}

.cm-featured-image img {
  width: 100%;
  height: auto;
}

.page-title {
  font-size: 24px;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--toto-border);
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0;
  font-weight: 700;
}

.comments-area {
  margin-top: 36px;
}

.comment-list {
  list-style: none;
}

.comment-body {
  padding: 14px 0;
  border-bottom: 1px solid var(--toto-border);
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  margin-bottom: 10px;
}

.comment-form .submit {
  background: var(--toto-accent);
  color: #fff;
  border: 0;
  padding: 10px 18px;
  cursor: pointer;
  width: auto;
}

/* ----- sidebar / ads ----- */
.cm-secondary .widget {
  margin-bottom: 22px;
}

.advertisement_300x250 img {
  width: 100%;
  height: auto;
}

.searchform .search-wrap {
  width: 100%;
}

.searchform .s {
  flex: 1;
  width: auto;
}

/* ----- footer ----- */
.cm-footer {
  background: var(--toto-footer);
  color: #bbb;
  margin-top: 20px;
}

.cm-footer a {
  color: #ddd;
}

.cm-footer a:hover {
  color: #fff;
}

.cm-footer .cm-widget-title {
  color: #fff;
  border-bottom-color: #444;
}

.cm-footer-cols {
  padding: 36px 0 20px;
}

.cm-lower-footer-cols {
  display: flex;
  gap: 30px;
  width: 100%;
}

.cm-lower-footer-col {
  flex: 1;
}

.cm-footer-bar {
  background: var(--toto-footer-bar);
  padding: 14px 0;
  font-size: 13px;
  color: #999;
}

.cm-footer-bar a {
  color: #ccc;
}

.copyright {
  text-align: right;
  width: 100%;
}

#scroll-up {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  background: var(--toto-accent);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  font-size: 18px;
}

#scroll-up.is-visible {
  display: flex;
}

.no-thumb {
  background: var(--toto-accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  overflow: hidden;
}

.no-thumb__logo {
  max-width: 68%;
  max-height: 52%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.no-thumb__label {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 0 10px;
  line-height: 1.3;
}

.no-thumb--sm .no-thumb__label {
  font-size: 11px;
  padding: 0 6px;
}

.cm-single-slide .no-thumb {
  width: 100%;
  height: 400px;
}

.cm-highlighted-posts .cm-post .no-thumb {
  width: 100%;
  height: 196px;
}

.cm-first-post .cm-post .no-thumb {
  width: 100%;
  height: 205px;
  margin-bottom: 10px;
}

.cm-featured-posts .cm-posts .cm-post .no-thumb {
  width: 130px;
  height: 90px;
  flex: 0 0 130px;
}

.toto-loop .cm-post .no-thumb {
  width: 240px;
  height: 150px;
  flex: 0 0 240px;
}

/* ----- responsive ----- */
@media (max-width: 1024px) {
  .cm-front-page-top-section {
    flex-direction: column;
  }

  .cm-slider-area,
  .cm-beside-slider-widget {
    width: 100%;
  }

  .cm-single-slide img,
  .cm-single-slide .no-thumb {
    height: 320px;
  }

  .advertisement_728x90 img {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .cm-content > .cm-container > .cm-row {
    flex-direction: column;
  }

  .cm-secondary {
    width: 100%;
    flex: none;
  }

  .cm-column-half {
    flex-direction: column;
  }

  .cm-one-half {
    width: 100%;
  }

  .cm-header-1 .cm-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .cm-menu-toggle {
    display: flex;
    align-items: center;
    margin-left: auto;
  }

  .cm-menu-primary-container {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--toto-accent);
    z-index: 200;
  }

  .cm-menu-primary-container.is-open {
    display: block;
  }

  .cm-menu-primary-container > ul {
    flex-direction: column;
  }

  .menu-item-has-children:hover > .sub-menu {
    display: none;
  }

  .sub-menu {
    position: static;
    box-shadow: none;
    background: var(--toto-accent-dark);
    display: none;
    min-width: 0;
  }

  .sub-menu.is-open {
    display: block;
  }

  .sub-menu a {
    color: #fff;
    padding-left: 28px;
  }

  .cm-submenu-toggle {
    display: inline-flex;
    position: absolute;
    right: 8px;
    top: 10px;
    color: #fff;
    cursor: pointer;
    padding: 4px;
  }

  .menu-item-has-children {
    position: relative;
  }

  .toto-loop .cm-post {
    flex-direction: column;
  }

  .toto-loop .cm-post img,
  .toto-loop .cm-post .no-thumb {
    width: 100%;
    height: 180px;
    flex: none;
  }

  .cm-highlighted-posts .cm-posts {
    grid-template-columns: 1fr;
  }

  .breaking-news {
    display: none;
  }

  .copyright {
    text-align: left;
  }

  .cm-lower-footer-cols {
    flex-direction: column;
  }
}
