/* ===========================================================
   Schneider Electric — Calculators & Tools
   Light + Dark themes. All 5 tools in one view.
   No frameworks. Strict-CSP friendly (no inline styles).
   =========================================================== */

/* ---------- Theme tokens ---------- */
:root {
  --se-green: #3dcd58;
  --se-green-dark: #23973c;

  --ink: #17211b;
  --muted: #5e6962;
  --surface: #ffffff;
  --surface-subtle: #f4f6f4;
  --border: #dfe5e1;
  --border-hover: #c9d3cd;
  --header: #0c2f25;
  --header-2: #123c30;
  --header-3: #18513f;
  --action: #17211b;
  --action-hover: #26352d;
  --action-text: #ffffff;
  --focus: #111111;
  --icon-bg: #eaf9ed;
  --icon-fg: #237936;
  --radius: 12px;
  --shadow: 0 12px 28px rgba(15, 45, 35, 0.08);
  --card-shadow: 0 1px 1px rgba(20, 45, 35, 0.02);
}

[data-theme="dark"] {
  --ink: #e8ede9;
  --muted: #98a49c;
  --surface: #17201b;
  --surface-subtle: #0e1411;
  --border: #26312a;
  --border-hover: #3a4a40;
  --header: #0a1a13;
  --header-2: #0e2419;
  --header-3: #123424;
  --action: #3dcd58;
  --action-hover: #58da70;
  --action-text: #06230d;
  --focus: #3dcd58;
  --icon-bg: #12301c;
  --icon-fg: #4fdd6a;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  --card-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* Per-tool icon accents (light) */
.accent-xr { --icon-bg: #eaf9ed; --icon-fg: #237936; }
.accent-ez { --icon-bg: #e8f2fb; --icon-fg: #1d5f9e; }
.accent-fc { --icon-bg: #fdf1e4; --icon-fg: #a05a12; }
.accent-tx { --icon-bg: #f2ecfa; --icon-fg: #6a3fa0; }
.accent-wd { --icon-bg: #e9f6f6; --icon-fg: #147a7a; }

[data-theme="dark"] .accent-xr { --icon-bg: #12301c; --icon-fg: #4fdd6a; }
[data-theme="dark"] .accent-ez { --icon-bg: #102938; --icon-fg: #5cb3f0; }
[data-theme="dark"] .accent-fc { --icon-bg: #33240f; --icon-fg: #f0a95c; }
[data-theme="dark"] .accent-tx { --icon-bg: #251a35; --icon-fg: #b48ae8; }
[data-theme="dark"] .accent-wd { --icon-bg: #0e2c2c; --icon-fg: #4fd0d0; }

* { box-sizing: border-box; }

html {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--surface-subtle);
  color: var(--ink);
}
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface-subtle);
  color: var(--ink);
  transition: background 200ms ease, color 200ms ease;
}

a { color: inherit; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.content-width,
.header-inner {
  width: min(1180px, calc(100% - 36px));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: inline-flex; align-items: center; }
.brand img { display: block; width: 168px; height: auto; }

.header-controls { display: flex; align-items: center; gap: 12px; }

.language-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 12px;
}
.language-nav a,
.language-active {
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
}
.language-active { background: #ffffff; color: var(--header); font-weight: 750; }
.language-nav a { color: rgba(255, 255, 255, 0.86); }
.language-nav a:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* Theme toggle */
.theme-toggle {
  appearance: none;
  width: 38px; height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.1); }
.theme-toggle:focus-visible { outline: 2px solid var(--se-green); outline-offset: 2px; }

.icon-sun, .icon-moon { width: 16px; height: 16px; position: relative; }
/* sun: circle + rays via box-shadow */
.icon-sun {
  border-radius: 50%;
  background: #ffd75e;
  box-shadow:
    0 -7px 0 -5px #ffd75e, 0 7px 0 -5px #ffd75e,
    -7px 0 0 -5px #ffd75e, 7px 0 0 -5px #ffd75e,
    -5px -5px 0 -5px #ffd75e, 5px -5px 0 -5px #ffd75e,
    -5px 5px 0 -5px #ffd75e, 5px 5px 0 -5px #ffd75e;
  transform: scale(.8);
}
/* moon: crescent via inset circle */
.icon-moon {
  border-radius: 50%;
  box-shadow: inset -5px -3px 0 0 #cfe3ff;
  transform: scale(.95);
}
/* show the icon of the theme you'd switch TO */
.icon-moon { display: block; }
.icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(112deg, var(--header) 0%, var(--header-2) 72%, var(--header-3) 100%);
  color: #ffffff;
}
.hero::after {
  content: "";
  position: absolute;
  right: -76px;
  top: -145px;
  width: 300px;
  height: 300px;
  border: 48px solid rgba(61, 205, 88, 0.12);
  border-radius: 50%;
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr);
  align-items: end;
  gap: 34px;
  padding-block: 22px 24px;
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--se-green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-size: clamp(31px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 760;
  white-space: nowrap;
}
.hero-copy {
  max-width: 610px;
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- Tool grid: 3 + 2, one view ---------- */
.tools-section { padding-block: 22px 30px; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.tool-card {
  grid-column: span 2;
  min-height: 224px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 200ms ease;
}
.tool-card:nth-child(4),
.tool-card:nth-child(5) { grid-column: span 3; }

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
}

.tool-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  background: var(--icon-bg);
  color: var(--icon-fg);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.tag {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  white-space: nowrap;
}

.card-content { flex: 1; padding: 13px 16px 14px; }
.card-content h3 {
  margin: 0 0 7px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.018em;
}
.card-content p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- Card actions ---------- */
.card-actions {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--border);
}

.primary-action,
.secondary-action {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
}

.primary-action {
  flex: 1;
  justify-content: space-between;
  background: var(--action);
  color: var(--action-text);
}
.primary-action:hover { background: var(--action-hover); }
.primary-action .arrow { transition: transform 160ms ease; }
.primary-action:hover .arrow { transform: translateX(3px); }

.secondary-action {
  min-width: 86px;
  background: var(--surface);
  color: var(--ink);
  border-left: 1px solid var(--border);
}
.secondary-action:hover { background: var(--surface-subtle); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-inner {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 11px;
}
.footer-inner p { margin: 0; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .tool-card,
  .tool-card:nth-child(4),
  .tool-card:nth-child(5) { grid-column: span 3; }
  .hero h1 { white-space: normal; }
}

@media (max-width: 640px) {
  .tool-card,
  .tool-card:nth-child(4),
  .tool-card:nth-child(5) { grid-column: span 6; min-height: 0; }
  .hero-inner { grid-template-columns: 1fr; gap: 12px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
