/* InterWebMarket — global styles (public_html/style.css)
   NOTE: colors come from /assets/tokens.css (do not redeclare :root here)
*/

/* -------------------- Base & Resets -------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Respect prefers-reduced-motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Links & misc */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); }

/* Layout container */
.container {
  max-width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 1.25rem;
}
@supports(padding:max(0px)) {
  .container { padding-left: max(1rem, env(safe-area-inset-left));
               padding-right: max(1rem, env(safe-area-inset-right)); }
}

/* -------------------- Cards -------------------- */
.card{
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.muted { color: var(--muted); }

/* -------------------- Buttons -------------------- */
.btn {
  display: inline-block;
  padding: .65rem 1rem;
  border-radius: .6rem;
  /* subtle elev surface by default */
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.btn:active { transform: translateY(0) scale(.98); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-primary {
  /* Brand gradient driven by tokens */
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-gold));
  color: var(--accent-contrast);
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.05); }

/* -------------------- Header / Nav -------------------- */
header,
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg-elev), #fff 6%); /* graceful in both themes */
  backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid var(--border);
}
header .inner,
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: .6rem; font-weight: 800; }
.logo img { height: 32px; display: block; }

/* Base nav */
.nav, .nav-desktop {
  display: flex;
  gap: .75rem;
  align-items: center;
}
.nav a, .nav-desktop a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  /* padding: .45rem .75rem; */
  border-radius: .5rem;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover, .nav-desktop a:hover { background: color-mix(in oklab, var(--bg-elev), #000 6%); }
.nav a.active, .nav-desktop a.active { color: var(--accent); }

/* Active highlight option (subtle) */
.nav a.active {
  outline: 2px solid color-mix(in oklab, var(--text), transparent 90%);
  background: color-mix(in oklab, var(--bg-elev), #000 4%);
}


/* -------------------- Hamburger (single, deduped) -------------------- */
.hamburger {
  display: none;
  position: relative;
  width: 44px; height: 44px;
  border: 1px solid color-mix(in oklab, var(--text), transparent 92%);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  position: absolute; left: 10px; right: 10px; height: 2px;
  background: var(--text);
  transition: transform .2s ease, top .2s ease, opacity .2s ease;
}
.hamburger span:nth-child(1){ top: 14px; }
.hamburger span:nth-child(2){ top: 21px; }
.hamburger span:nth-child(3){ top: 28px; }
.nav-open .hamburger span:nth-child(1){ top: 21px; transform: rotate(45deg); }
.nav-open .hamburger span:nth-child(2){ opacity: 0; }
.nav-open .hamburger span:nth-child(3){ top: 21px; transform: rotate(-45deg); }

/* -------------------- Mobile menu (off-canvas) -------------------- */
.nav-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30;
}

@media (max-width: 900px){
  .hamburger { display: inline-block; }
  .nav {
    position: fixed; z-index: 50;
    top: 64px; right: 0; bottom: 0;
    width: min(80vw, 320px);
    background: var(--bg-elev);
    border-left: 1px solid var(--border);
    flex-direction: column; align-items: stretch; padding: 1rem;
    transform: translateX(100%); transition: transform .2s ease;
  }
  .nav a { padding: .75rem .9rem; }
  .nav--open { transform: translateX(0); }
}
@media (min-width: 901px){
  .nav-backdrop { display: none !important; }
}

/* -------------------- Fullscreen overlay nav (alternative mobile) -------------------- */
.nav-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in oklab, var(--bg), #fff 8%);
  backdrop-filter: blur(10px) saturate(120%);
  display: none;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}
.nav-overlay.is-open { display: block; opacity: 1; transform: translateY(0); }
.nav-overlay__inner {
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px;
  max-width: 640px; margin: 72px auto 0; /* leave room for sticky header */
}
.nav-overlay__inner a {
  display: block;
  text-decoration: none;
  font-weight: 800;
  font-size: clamp(24px, 4.5vw, 36px);
  line-height: 1.15;
  color: var(--text);
  padding: .25rem .25rem;
}
.nav-overlay__inner a:active, .nav-overlay__inner a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Prevent page scroll behind menu */
.nav-open { overflow: hidden; }

/* Responsive switch: show hamburger on mobile, hide inline nav */
@media (max-width: 900px){
  .nav-desktop { display: none; }
}
/* Desktop: always hide overlay */
@media (min-width: 901px){
  .nav-overlay { display: none !important; }
}

/* -------------------- Hero -------------------- */
.hero {
  min-height: 60vh;
  display: grid; place-items: center;
  /* brandy tint that adapts to theme */
  background:
    linear-gradient(
      135deg,
      color-mix(in oklab, var(--bg), var(--brand-orange) 8%),
      color-mix(in oklab, var(--bg), var(--brand-green) 8%)
    );
  background-repeat: no-repeat; background-size: cover; background-position: center;
  text-align: center; padding: clamp(2rem, 6vw, 4rem) 1rem;
}
.hero-card { max-width: 720px; }

/* -------------------- Responsive helpers -------------------- */
@media (max-width: 768px){
  .container { padding: 1rem; }
  .btn { padding: .6rem .9rem; }
}

/* Optional: better focus visibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* Added on 2025-10-19 17:47:03 to adjust to IOS toggle light / dark mode */
/* --- Header placement helpers --- */
.site-header .inner { position: relative; }
.header-right {
  margin-left: auto;                  /* pushes to the far right */
  display: flex; align-items: center; gap: .75rem;
}

/* === iOS-style theme switch, text only, pinned top-left === */
.theme-switch {
  --w: 88px;  /* space for 'Light' */
  --h: 34px;
  --p: 3px;
  position: absolute;      /* <- pin */
  top: 8px; left: 10px;    /* far upper-left */
  z-index: 45;             /* above header background */
  line-height: 0;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.theme-switch label {
  position: relative;
  display: flex; align-items: center;
  width: var(--w); height: var(--h);

  /* Keep text away from knob: default (unchecked = Light mode), knob LEFT */
  padding-left: calc(var(--h) + .4rem);
  padding-right: .6rem;

  font-size: 13px; font-weight: 700;
  background: color-mix(in oklab, var(--bg-elev), #000 8%);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9999px;
  cursor: pointer;
  user-select: none;
  transition: background .2s ease, border-color .2s ease, color .2s ease, padding .2s ease;
}

.theme-switch label::before {
  content: "";
  position: absolute;
  top: var(--p); left: var(--p);
  width: calc(var(--h) - (var(--p) * 2));
  height: calc(var(--h) - (var(--p) * 2));
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .2s ease, background .2s ease;
}

/* Checked = Dark mode, knob RIGHT, text aligned away from it */
.theme-switch input:checked + label {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-contrast);
  padding-left: .6rem;
  padding-right: calc(var(--h) + .4rem);
}
.theme-switch input:checked + label::before {
  transform: translateX(calc(var(--w) - var(--h)));
  background: var(--accent-contrast);
}

.theme-switch__label {
  position: relative; z-index: 2; width: 100%;
  pointer-events: none;
}

/* Dark theme track tune */
:root[data-theme="dark"] .theme-switch label {
  background: color-mix(in oklab, var(--bg-elev), #000 18%);
  border-color: var(--border);
}

/* === Reserve room for the pinned switch === */
.site-header .inner { position: relative; }
/* Always leave enough left padding so the centered logo/nav don't collide */
/* .site-header .inner { padding-left: calc(10px + var(--w, 88px) + 12px); } */

/* === Mobile header: put hamburger on the RIGHT so it doesn't collide with the switch === */
@media (max-width: 900px){
  .hamburger {
    position: absolute;
    right: 10px; left: auto;
    top: 50%; transform: translateY(-50%);
    display: inline-block;
  }
  /* Center logo in mobile while switch/hamburger float at edges */
  .logo { margin: 0 auto; text-align: center; position: relative; }
  .logo img { margin: 0 auto; display: block; }
}

/* Desktop tidy: normal flow for hamburger/nav; switch stays pinned top-left */
@media (min-width: 901px){
  .hamburger { position: static; transform: none; }
}


/* ==========================================================
   InterWebMarket — text logo styling
   ========================================================== */

/* Base logo wrapper */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

/* Text styling for "InterWebMarket" */
.siteTitle {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: clamp(1.25rem, 4vw, 1.6rem); /* scales nicely on mobile */
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-green));
  /* -webkit-background-clip: text; */
  -webkit-text-fill-color: transparent;
  text-transform: none;
  line-height: 1.1;
}

/* Hover / focus states */
.logo:hover,
.logo:focus-visible {
  transform: translateY(-1px);
}
.logo:hover .siteTitle {
  filter: brightness(1.05);
}

/* On dark theme, subtly adjust the gradient for better contrast */
:root[data-theme="dark"] .siteTitle {
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-green));
}

/* Layout alignment — ensures centering on tablet & mobile */
@media (max-width: 900px) {
  .logo {
    justify-content: center;
    text-align: center;
    margin: 0 auto;
  }
  .siteTitle {
    font-size: clamp(1.3rem, 5vw, 1.6rem);
  }
  .site-header .inner { padding-left: calc(0px + var(--w, 0px) + 0px); }

}

/* Slightly larger on big screens */
@media (min-width: 901px) {
  .siteTitle {
    font-size: 1.75rem;
  }
}

/* ---------- Robust gradient text for the site title ---------- */
.siteTitle {
  display: inline-block;               /* ensure gradient bounds to glyph box */
  background-image: linear-gradient(135deg, var(--brand-orange), var(--brand-green));
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: 0 0;

  /* text as a mask */
  color: transparent;                  /* standard fallback */
  -webkit-text-fill-color: transparent;/* Safari/iOS */
  background-clip: text;               /* standard */
  -webkit-background-clip: text;       /* Safari/iOS */

  /* avoid odd blending with header/backdrop */
  mix-blend-mode: normal;
}

/* Better contrast in dark theme (same clipping kept) */
:root[data-theme="dark"] .siteTitle {
  background-image: linear-gradient(135deg, var(--brand-gold), var(--brand-green));
}

/* If a browser can't clip background to text, fall back to solid color */
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .siteTitle {
    background: none !important;
    color: var(--text) !important;
  }
}

/* High-contrast / forced-colors environments: use readable solid color */
@media (forced-colors: active) {
  .siteTitle {
    background: none !important;
    color: CanvasText !important;
  }
}

/* ===== Simple text logo (solid color, theme-aware) ===== */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  transition: transform .2s ease;
  user-select: none;
  white-space: nowrap;
}

.siteTitle {
  /* clean, solid text color */
  color: var(--brand-orange);                 /* light theme default */
  -webkit-text-fill-color: currentColor;      /* ensure Safari uses the text color */
  background: none !important;                /* kill any old gradient */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  line-height: 1.1;
  font-size: clamp(1.25rem, 4vw, 1.6rem);     /* responsive */
  display: inline-block;                      /* helps with vertical rhythm */
}

:root[data-theme="dark"] .siteTitle {
  color: var(--brand-gold);                   /* gold in dark mode for contrast */
  -webkit-text-fill-color: currentColor;
}

.logo:hover,
.logo:focus-visible {
  transform: translateY(-1px);
}

/* Center the title on tablet & mobile */
@media (max-width: 900px) {
  .logo {
    justify-content: center;
    text-align: center;
    margin: 0 auto;
  }
  .siteTitle {
    font-size: clamp(1.3rem, 5vw, 1.6rem);
  }
  .site-header .inner { padding-left: calc(0px + var(--w, 0px) + 0px); }
}

/* Slight bump on larger screens */
@media (min-width: 901px) {
  .siteTitle { font-size: 1.75rem; }
  .site-header .inner { padding-left: calc(10px + var(--w, 88px) + 12px) !important; }
}
.site-header .inner { position: relative; }
/* Reserve room for the pinned switch */
/* .site-header .inner { padding-left: calc(10px + var(--w, 88px) + 12px); } */


/* 2025-10-19 19:11:22 */

/* ===== Theme switch visibility hardening ===== */

/* Ensure header always leaves room for the pinned top-left switch */


/* Keep the switch above any header/backdrop layers */
.site-header, .site-header .inner { isolation: isolate; }
.theme-switch { z-index: 45; }

/* Put the knob UNDER the text; keep text on top */
.theme-switch label::before { z-index: 1; }
.theme-switch__label        { z-index: 2; position: relative; }

/* ---- Dark mode: unchecked (track is dark, text should be light) ---- */
:root[data-theme="dark"] .theme-switch label {
  background: #1b2230;                  /* darker, higher contrast track */
  border-color: #2a3345;
  color: #e5e7eb;                        /* light text on dark track */
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

/* Knob on dark track should be bright */
:root[data-theme="dark"] .theme-switch label::before {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* ---- Dark mode: checked (track = brand gold, text should be dark) ---- */
:root[data-theme="dark"] .theme-switch input:checked + label {
  background: var(--brand-gold);
  border-color: transparent;
  color: #0b0f14;                        /* high-contrast text */
}

/* Knob over gold track should be dark to stand out */
:root[data-theme="dark"] .theme-switch input:checked + label::before {
  background: #0b0f14;
}

/* ---- Light mode small tweaks: stronger outline so it doesn't disappear on bright headers ---- */
:root:not([data-theme="dark"]) .theme-switch label {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
