/* Light and dark mode for every page except the two map pages (the map is dark in both modes).
 *
 * The site's own stylesheets hold the dark colours. This file lays the light ones over the top
 * whenever the page is not set to dark, so light is what shows by default. assets/theme.js sets
 * <html data-theme="dark"> when the visitor's device asks for dark or they chose dark with the switch.
 *
 * Light mode is an editorial look: a warm off-white page, near-black text, thin rules in place of
 * filled boxes, headlines in a deep blue, and the highlight colours used as accents. The top bar,
 * the phone tab bar and the map keep dark colours, so they read as one frame around the reading area.
 * The second half of the file (Resort guides button, top bar order, the switch) applies in both modes.
 *
 * ":root:not([data-theme=dark])" outranks the plain ":root" and single-class rules in the other
 * stylesheets, so the order the files load in does not matter. */

:root:not([data-theme="dark"]),
:root:not([data-theme="dark"]) .injected-article{
  --bg:#FAF9F6;
  --bg-elevated:#FFFFFF;
  --line:#E3E0DA;
  --grey-mid:#6E727B;
  --grey-light:#3A3F48;
  --white:#2A2E36;
  --pz-head:#1F4A68;   /* headlines: a deep shade of the site's blue, not black */
  color-scheme:light;
}
/* Headlines in colour. */
:root:not([data-theme="dark"]) h1,
:root:not([data-theme="dark"]) h2,
:root:not([data-theme="dark"]) h3,
:root:not([data-theme="dark"]) .region-card-title,
:root:not([data-theme="dark"]) .aside-card.lp-ranks .lp-ranks-title{ color:var(--pz-head); }
:root[data-theme="dark"]{ color-scheme:dark; }

/* When the browser bounces past the top of the page, it shows the page's outer background. Make that
   the top bar's dark colour, so the bar seems to carry on upwards instead of a white gap opening
   above it. The page itself stays light, and fills at least the whole window, so a short page never
   shows the dark colour below its content. */
html:not([data-theme="dark"]){ background:#1D222B; }
html:not([data-theme="dark"]) body{ background:var(--bg); min-height:100vh; }

/* The parts that stay dark in light mode: they get the dark colours back. */
:root:not([data-theme="dark"]) .topbar,
:root:not([data-theme="dark"]) .mobile-tabbar,
:root:not([data-theme="dark"]) .map-frame,
:root:not([data-theme="dark"]) .leaflet-container,
:root:not([data-theme="dark"]) .region-card-map{
  --bg:#10131A;
  --bg-elevated:#171B24;
  --line:#262B36;
  --grey-mid:#7C8494;
  --grey-light:#C7CDD6;
  --white:#F3F5F7;
  color-scheme:dark;
}
/* The top bar a touch lighter than the dark mode background, so it is less heavy. */
:root:not([data-theme="dark"]) .topbar{ background:#1D222B; border-bottom-color:#1D222B; }
@media (max-width: 700px){
  :root:not([data-theme="dark"]) .mobile-tabbar{ background:rgba(29,34,43,0.97); }
}
:root:not([data-theme="dark"]) .map-frame{ background:#171B24; border-color:#171B24; color:#F3F5F7; }
/* The homepage tagline sits in the top bar on desktop. */
:root:not([data-theme="dark"]) .topbar .tagline{ color:#F3F5F7; border-left-color:#262B36; }

/* Colours typed straight into the other stylesheets, which assume a dark page. */
:root:not([data-theme="dark"]) .pzs-label{ color:#33373F; }
:root:not([data-theme="dark"]) .pzs-pill{ background:rgba(22,24,29,0.06); }
:root:not([data-theme="dark"]) .pzs-divider{ border-top-color:rgba(22,24,29,0.10); }
:root:not([data-theme="dark"]) .pzs-track{ background:rgba(22,24,29,0.08); }
:root:not([data-theme="dark"]) .card-image{ background:linear-gradient(135deg,#FFFFFF,#ECEAE5 60%,#E3E0DA); }
:root:not([data-theme="dark"]) .od-sources>li{ border-bottom-color:rgba(22,24,29,0.08); }

/* Buttons filled with a highlight colour keep their dark text. Pass labels set their own text colour (passes.css). */
:root:not([data-theme="dark"]) .explore-map-cta:hover,
:root:not([data-theme="dark"]) .article-stub-cta,
:root:not([data-theme="dark"]) .lp-card:hover .lp-cta,
:root:not([data-theme="dark"]) .lp-rank:not(.pz-pill),
:root:not([data-theme="dark"]) .od-card .lp-cta:hover{ color:#10131A; }

/* Side panels: no box, a rule in colour along the top, like a magazine sidebar (ember; Trip Advice
   purple; LIVE blue). */
:root:not([data-theme="dark"]) .aside-card{
  background:transparent; border:0; border-top:3px solid var(--ember); border-radius:0;
  padding:12px 0 6px;
}
:root:not([data-theme="dark"]) .aside-card.trip-advice-tile{ border-top-color:var(--c-tripqa); }
:root:not([data-theme="dark"]) .aside-card.aside-live{ border-top-color:var(--frost); }
:root:not([data-theme="dark"]) .aside-card .label{ color:#2A2E36 !important; }
:root:not([data-theme="dark"]) .aside-list a{ color:#3A3F48; }
:root:not([data-theme="dark"]) .aside-list a:hover{ color:#2A2E36; text-decoration:underline; text-decoration-color:var(--ember); text-underline-offset:3px; }
:root:not([data-theme="dark"]) .aside-card.lp-ranks .lp-ranks-links a{ color:#3A3F48; border-top-color:#E3E0DA; }

/* Newsletter: the whole panel in ember, a white box and a dark button. */
:root:not([data-theme="dark"]) .aside-card.newsletter{
  background:var(--ember); border:0; border-radius:10px; padding:18px;
}
:root:not([data-theme="dark"]) .aside-card.newsletter .label{ color:#10131A !important; }
:root:not([data-theme="dark"]) .aside-card.newsletter .newsletter-sub{ color:#3A3F48; }
:root:not([data-theme="dark"]) .newsletter-form input{ background:#FFFFFF; border-color:#FFFFFF; color:#10131A; }
/* !important because some pages set the button's colours in the page itself. */
:root:not([data-theme="dark"]) .newsletter-btn{ background:#10131A !important; color:#F3F5F7 !important; }

/* Resort guides, in both modes: a filled ember button, as prominent as Japan Trip Advice (purple) and
   Japan LIVE! (blue) beside it, and the same height. */
.topbar .guide-menu{ align-self:stretch; }
.topbar .guide-menu-toggle,
.topbar .guide-menu[open] .guide-menu-toggle{
  height:100%; padding:0 18px; border:0; border-radius:6px;
  background:var(--ember); color:#10131A;
}
.topbar .guide-menu-toggle:hover,
.topbar .guide-menu[open] .guide-menu-toggle:hover{ background:#ecb567; color:#10131A; }

/* Top bar order, both modes: Home first whenever a page has it, then the coloured buttons together
   (Resort guides, Trip Advice, LIVE!), then the two small square icons (search, light/dark). The page
   markup is unchanged; only the drawn order moves. The search panel is placed against the bar itself,
   so it opens in the same spot. */
.topbar-buttons .topbar-cta--home{ order:0; }
.topbar-buttons .guide-menu{ order:1; }
.topbar-buttons .topbar-cta--trip{ order:3; }
.topbar-buttons .topbar-cta--live{ order:4; }
.topbar-buttons .search-toggle{ order:5; }
.topbar-buttons .theme-switch{ order:6; }

/* The switch in the top bar (added by assets/theme.js). It always sits on the dark top bar. */
.theme-switch{
  display:flex; align-items:center; justify-content:center; flex:0 0 auto;
  width:38px; padding:0; margin:0; cursor:pointer;
  background:var(--bg-elevated); color:var(--white);
  border:1px solid var(--line); border-radius:6px;
}
.theme-switch:hover{ border-color:var(--frost); color:var(--frost); }
.theme-switch svg{ width:18px; height:18px; display:block; }
.theme-switch .icon-sun{ display:none; }
:root[data-theme="dark"] .theme-switch .icon-sun{ display:block; }
:root[data-theme="dark"] .theme-switch .icon-moon{ display:none; }
