/* Shared Calder Thorn visual identity for the public root pages. */
:root, :root[data-theme="light"] {
 --ct-bg:#f4f7fa;--ct-surface:#ffffff;--ct-raised:#edf3f8;--ct-text:#162738;--ct-muted:#475c6f;
 --ct-border:#ccd9e5;--ct-primary:#265f9d;--ct-primary-hover:#1c4c82;--ct-focus:#0a65be;
 --ct-shadow:0 22px 65px rgba(19,42,67,.09);--ct-navy:#0a1c32;--ct-sky:#6bc4f7;
}
:root[data-theme="dark"] {
 --ct-bg:#06162b;--ct-surface:#122237;--ct-raised:#1b2c40;--ct-text:#f0f5fa;--ct-muted:#adc0d3;
 --ct-border:#31475e;--ct-primary:#83c8f4;--ct-primary-hover:#adddff;--ct-focus:#88ceff;
 --ct-shadow:0 23px 65px rgba(0,0,0,.22);--ct-navy:#0a1c32;--ct-sky:#79caf4;
}
.ct-brand-mark { background:#091d32;border:1px solid rgba(123,182,221,.28);display:grid;place-items:center;overflow:hidden;flex:none; }
.ct-brand-mark img { display:block;object-fit:contain;width:100%;height:100%; }
.ct-theme-toggle { appearance:none;border:1px solid var(--ct-border);background:var(--ct-surface);color:var(--ct-text);font:600 .82rem/1.2 ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;border-radius:999px;display:inline-flex;justify-content:center;align-items:center;gap:.45rem;padding:.55rem .82rem;min-height:40px;cursor:pointer;white-space:nowrap;box-shadow:none;transition:background .15s,border-color .15s; }
.ct-theme-toggle:hover { background:var(--ct-raised);border-color:var(--ct-primary); }
.ct-theme-toggle:focus-visible { outline:3px solid var(--ct-focus);outline-offset:3px; }
.ct-theme-toggle .theme-toggle-icon { font-size:1.05rem;line-height:1; }
@media(prefers-reduced-motion:reduce){.ct-theme-toggle{transition:none}}

/* CT shared public UI refinement — matches KB compact lower-right theme toggle. */
.ct-theme-toggle{
  position:fixed;
  right:max(14px,env(safe-area-inset-right));
  bottom:max(14px,env(safe-area-inset-bottom));
  z-index:300;
  padding:7px 10px;
  gap:7px;
  min-height:40px;
  border-radius:8px;
  font-size:12px;
  border:1px solid var(--ct-border);
  background:var(--ct-surface);
  box-shadow:0 4px 16px rgba(15,23,42,.12);
}
:root[data-theme="dark"] .ct-theme-toggle{
  background:#111a25;
  border-color:#34475b;
  color:#e8eef6;
  box-shadow:0 4px 16px rgba(0,0,0,.32);
}
.ct-theme-toggle .theme-toggle-icon{
  display:grid;place-items:center;
  width:24px;height:24px;border-radius:6px;
  background:#2b619b;color:#fff;font-size:15px;
}
:root[data-theme="dark"] .ct-theme-toggle .theme-toggle-icon{
  background:#284d73;color:#eef6ff;
}
@media(max-width:767px){
  .ct-theme-toggle{
    right:max(12px,env(safe-area-inset-right));
    bottom:max(4px,env(safe-area-inset-bottom));
  }
}
/* No decorative outer tile: artwork stays identical across surfaces.
   Light mode's logo asset carries its *own* flat navy background for contrast. */
.ct-brand-mark{
  background:transparent;
  border:0;
  box-shadow:none;
  overflow:visible;
}
.ct-brand-mark img{width:100%;height:100%;object-fit:contain;}
/* The paired assets are toggled solely by data-theme; theme JS is unchanged. */
.ct-brand-mark .brand-logo-for-light,.sunlogo .brand-logo-for-light{display:block;}
.ct-brand-mark .brand-logo-for-dark,.sunlogo .brand-logo-for-dark{display:none;}
:root[data-theme="dark"] .ct-brand-mark .brand-logo-for-light,
:root[data-theme="dark"] .sunlogo .brand-logo-for-light{display:none;}
:root[data-theme="dark"] .ct-brand-mark .brand-logo-for-dark,
:root[data-theme="dark"] .sunlogo .brand-logo-for-dark{display:block;}

/* Calder Thorn mobile theme control: same sun/moon artwork and icon-only
   40px control as the KB. The desktop control is deliberately untouched.
   The icon indicates the ACTIVE theme (moon = dark, sun = light).
   Accessibility remains with the existing dynamic aria-label/title. */
@media (max-width:767px) {
  .ct-theme-toggle {
    width:40px;
    height:40px;
    min-width:40px;
    min-height:40px;
    padding:7px;
    gap:0;
    border-radius:8px;
  }
  .ct-theme-toggle .theme-toggle-label { display:none; }
  .ct-theme-toggle .theme-toggle-icon {
    font-size:0;
    line-height:0;
    flex:0 0 24px;
  }
  .ct-theme-toggle .theme-toggle-icon::before {
    content:"";
    display:block;
    width:15px;
    height:15px;
    background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22white%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22true%22%3E%3Cpath%20d%3D%22M6.76%204.84l-1.8-1.79-1.41%201.41%201.79%201.8%201.42-1.42zm10.48%200l1.79-1.8%201.41%201.41-1.8%201.79-1.4-1.4zM12%204V1h-0v3h0zm0%2019v-3h0v3h0zM4%2013H1v-0h3v0zm22%200h-3v0h3v0zM6.76%2019.16l-1.42%201.42-1.79-1.8%201.41-1.41%201.8%201.79zm10.48%200l1.4%201.4%201.8-1.79-1.41-1.41-1.79%201.8zM12%208a4%204%200%20100%208%204%204%200%20000-8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat:no-repeat;
    background-position:center;
    background-size:15px 15px;
  }
  :root[data-theme="dark"] .ct-theme-toggle .theme-toggle-icon::before {
    background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22white%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22true%22%3E%3Cpath%20d%3D%22M12.74%202.01a1%201%200%2001.9%201.45A8%208%200%201019%2015.86a1%201%200%20011.45.9A10%2010%200%201112.74%202.01z%22%2F%3E%3C%2Fsvg%3E");
  }
}


/* FINAL Calder Thorn mobile cleanup for public root pages.
   1) Construction homepage only: remove the inner panel/card look on small screens.
   2) Theme toggle on mobile: keep KB-style icon-only control, but nudge the glyph
      slightly lower so it visually centers better in Safari. */
@media (max-width:540px) {
  .page > main {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

@media (max-width:767px) {
  .ct-theme-toggle .theme-toggle-icon {
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .ct-theme-toggle .theme-toggle-icon::before {
    margin:auto;
    transform:translateY(1px);
  }
}

/* Light-mode CT readability without double frames or extra shadows. */
:root[data-theme="light"] .ct-brand-mark img.brand-logo-for-light { border-radius:18%; }
:root[data-theme="light"] .sunlogo img.brand-logo-for-light { border-radius:20%; }
