/*
 * Mobile redesign 2026-11 ("magazine" direction). Everything here applies below 768px only:
 * the stylesheet is enqueued with a media attribute and the rules are wrapped in the same query,
 * so the desktop and tablet layouts of main.css stay untouched. Loaded after main.css.
 * Visual reference: redesign/mobile-mockups/index.html (classes under .dB).
 *
 * Step 1: fonts, header, search, menu.
 */
@media (max-width: 767.98px) {

  /* ---------- Tokens ---------- */
  body {
    --tb-display: "Commissioner", "Inter", system-ui, sans-serif;
    --tb-read: "Literata", Georgia, "Times New Roman", serif;
    --tb-accent-text: #ad4a00; /* orange that passes AA as text on the light background */
    --tb-on-navy-muted: #aeb7c4;
    --tb-navy-line: #2a3344;
    font-family: var(--tb-display);
  }

  [data-theme="dark"] body {
    --tb-accent-text: #ff9a47;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: var(--tb-display);
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  /* Running text of the article in the reading face; tables, captions and cards keep the UI face */
  .article-content p,
  .article-content li,
  .article-content blockquote {
    font-family: var(--tb-read);
  }

  .article-content .nl-cta-card p,
  .article-content .tb-ad p {
    font-family: var(--tb-display);
  }

  /* ---------- Header ---------- */
  header .top-bar {
    max-width: none;
    width: 100%;
    margin-inline: 0;
    padding: 8px 6px 8px 16px;
    border-radius: 0;
  }

  header .top-bar > .row,
  .megamenu .container > .row {
    --bs-gutter-x: 0;
    margin-inline: 0;
  }

  header .top-bar .logo,
  .megamenu .logo {
    display: block;
    line-height: 0;
  }

  header .top-bar .logo img,
  .megamenu .logo img {
    width: 136px;
    height: auto;
  }

  header .header-tools,
  .megamenu .header-tools {
    gap: 0;
  }

  /* 40px tap targets instead of the bare 18px icons */
  .header-tools li .search-toggle,
  .header-tools li .theme-toggle,
  .header-tools li .megamenu-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
  }

  [data-theme="dark"] .theme-toggle {
    transform: rotate(180deg);
  }

  /* Search drops down as a full-width strip under the header */
  .top-bar .sform {
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    border-radius: 0;
    background: var(--blue);
    padding: 4px 16px 14px;
  }

  .top-bar .sform #searchform {
    border-radius: 0;
  }

  .top-bar .sform #searchform input {
    border-radius: 0;
    font-family: var(--tb-display);
  }

  /* ---------- Menu ---------- */
  .megamenu {
    padding: 0 0 28px;
    overflow-y: auto;
    font-family: var(--tb-display);
  }

  .megamenu.open {
    justify-content: flex-start;
    gap: 28px;
  }

  .megamenu > .container:first-child > .row:first-child {
    padding: 8px 6px 8px 16px;
  }

  /* The search field is always visible in the menu, so its toggle is not needed here */
  .megamenu .header-tools li:has(.mgmn) {
    display: none;
  }

  .megamenu-search {
    margin: 8px 16px 0;
    border-bottom: 2px solid var(--always-white);
  }

  .megamenu-search:focus-within {
    border-bottom-color: var(--orange);
  }

  .megamenu-search form {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
  }

  .megamenu-search svg {
    flex: none;
  }

  .megamenu-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--always-white);
    font-family: inherit;
    font-size: 18px;
    outline: 0;
    -webkit-appearance: none;
    appearance: none;
  }

  .megamenu-search input::placeholder {
    color: var(--tb-on-navy-muted);
    opacity: 1;
  }

  .megamenu-trending {
    padding: 26px 16px 0;
  }

  .megamenu-trending strong,
  .megamenu-menu > li.menu-item-has-children::before {
    display: block;
    color: var(--tb-on-navy-muted);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .megamenu .trending-tags {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .megamenu .trending-tags a {
    padding: 7px 11px;
    border: 1px solid #3a4558;
    font-size: 14px;
    font-weight: 700;
  }

  .megamenu .trending-tags a .icon {
    display: none;
  }

  .megamenu nav {
    width: 100%;
    padding: 0;
  }

  .megamenu-menu {
    display: block;
    max-height: none;
    overflow: visible;
    padding: 18px 0 0;
  }

  .megamenu-menu > li {
    width: 100%;
  }

  .megamenu-menu > li > a {
    justify-content: space-between;
    align-items: center;
    padding: 9px 16px;
    color: var(--always-white);
    font-size: 26px;
    font-weight: 850;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  .megamenu-menu > li:not(.menu-item-has-children) > a::after {
    content: "";
    flex: none;
    width: 22px;
    height: 22px;
    background: var(--orange);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* The parent of the second group ("More", href="#") stays hidden; a label takes its place */
  .megamenu-menu > li.menu-item-has-children::before {
    content: "Περισσότερα";
    padding: 26px 16px 6px;
  }

  .megamenu-menu .sub-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    padding: 0 16px;
    list-style: none;
  }

  .megamenu-menu .sub-menu li {
    width: auto;
  }

  .megamenu-menu .sub-menu li a {
    display: block;
    padding: 11px 0;
    border-bottom: 1px solid var(--tb-navy-line);
    color: var(--always-white);
    font-size: 16px;
    font-weight: 700;
  }

  .megamenu > .container:last-child {
    padding: 0 16px;
  }

  .megamenu > .container:last-child p {
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 0;
    color: var(--tb-on-navy-muted);
    font-weight: 600;
  }

  .megamenu > .container:last-child p a {
    color: var(--tb-on-navy-muted);
  }

  .megamenu-socials {
    margin: 8px 0 0;
    padding: 0;
  }
}
