/* Honour the hidden attribute even when a class sets display. */
[hidden] { display: none !important; }

/* IDWISID Tools — styles
   Change colours, fonts, radius and card style with CSS variables below,
   or pick a built-in theme in site.config.js and run generate.py.
*/

/* ---------- Fonts (self-hosted, no request to Google) ---------- */
@font-face {
  font-family: "Syne";
  src: url("../assets/fonts/syne-700.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Syne";
  src: url("../assets/fonts/syne-800.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-400.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-500.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-600.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Base tokens (IDWISID theme is the default) ---------- */
:root {
  --font-heading: "Syne", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --radius: 16px;
  --radius-pill: 999px;
  --space: 1rem;
  --max-width: 68rem;
  --header-height: 4.5rem;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  --card-style: raised;

  --color-bg: #060a14;
  --color-surface: #0e1626;
  --color-surface-2: #161f33;
  --color-text: #f4f4f2;
  --color-muted: #b7b9c2;
  --color-border: rgba(255, 255, 255, 0.15);
  --color-accent-start: #f86814;
  --color-accent-mid: #f04050;
  --color-accent-end: #e80078;
  --color-link: #e80078;
  --color-on-accent: #ffffff;
  --color-badge-new-bg: transparent;
  --color-glow: rgba(232, 0, 120, 0.28);
  --gradient: linear-gradient(90deg, var(--color-accent-start) 0%, var(--color-accent-mid) 50%, var(--color-accent-end) 100%);
  --focus: var(--color-accent-start);
}

/* Built-in themes — selected with data-theme on <html> */
[data-theme="idwisid"] {
  --color-bg: #060a14;
  --color-surface: #0e1626;
  --color-surface-2: #161f33;
  --color-text: #f4f4f2;
  --color-muted: #b7b9c2;
  --color-border: rgba(255, 255, 255, 0.15);
  --color-accent-start: #f86814;
  --color-accent-mid: #f04050;
  --color-accent-end: #e80078;
  --color-link: #ff4da0;
  --color-on-accent: #ffffff;
  --color-glow: rgba(232, 0, 120, 0.28);
  --focus: var(--color-accent-start);
}

[data-theme="dark"] {
  --color-bg: #0c0d10;
  --color-surface: #16181e;
  --color-surface-2: #1e2129;
  --color-text: #f2f3f5;
  --color-muted: #a8adb8;
  --color-border: rgba(255, 255, 255, 0.12);
  --color-accent-start: #e8eaed;
  --color-accent-mid: #c9cdd4;
  --color-accent-end: #e8eaed;
  --color-link: #f2f3f5;
  --color-on-accent: #0c0d10;
  --color-glow: rgba(255, 255, 255, 0.08);
  --focus: #ffffff;
}

[data-theme="light"] {
  --color-bg: #f7f4f2;
  --color-surface: #ffffff;
  --color-surface-2: #f1ece8;
  --color-text: #12141a;
  --color-muted: #4a4e5a;
  --color-border: rgba(18, 20, 26, 0.12);
  --color-accent-start: #f86814;
  --color-accent-mid: #f04050;
  --color-accent-end: #e80078;
  --color-link: #c40068;
  --color-on-accent: #ffffff;
  --color-glow: rgba(232, 0, 120, 0.16);
  --focus: #f86814;
  --shadow: 0 10px 28px rgba(18, 20, 26, 0.08);
}

[data-theme="purple"] {
  --color-bg: #0b0614;
  --color-surface: #160b24;
  --color-surface-2: #201033;
  --color-text: #f6f3fb;
  --color-muted: #c4b8d6;
  --color-border: rgba(255, 255, 255, 0.14);
  --color-accent-start: #7c3aed;
  --color-accent-mid: #a21caf;
  --color-accent-end: #c026d3;
  --color-link: #e879f9;
  --color-on-accent: #ffffff;
  --color-glow: rgba(192, 38, 211, 0.3);
  --focus: #c084fc;
}

/* ---------- Reset and base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, .site-title {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0 0 1rem;
}

:focus {
  outline: none;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: auto;
  height: 2.7rem;
  object-fit: contain;
  flex-shrink: 0;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-tagline {
  display: none;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin: 0;
}

@media (min-width: 720px) {
  .header-tagline {
    display: block;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 3.25rem 0 2.25rem;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  left: 10%;
  right: 10%;
  top: -6rem;
  height: 18rem;
  background:
    radial-gradient(ellipse at 30% 40%, color-mix(in srgb, var(--color-accent-start) 32%, transparent), transparent 60%),
    radial-gradient(ellipse at 75% 40%, color-mix(in srgb, var(--color-accent-end) 28%, transparent), transparent 65%);
  pointer-events: none;
  filter: blur(8px);
  z-index: 0;
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.85rem;
}

.eyebrow::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--gradient);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.35rem);
  max-width: 16ch;
  margin-bottom: 0.85rem;
}

.hero-lead {
  max-width: 38rem;
  color: var(--color-muted);
  font-size: 1.125rem;
  margin-bottom: 0;
}

/* ---------- Tools ---------- */
.tools-section {
  padding: 0.5rem 0 4rem;
}

.tools-heading {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
}

/* Grid layout */
[data-layout="grid"] .tool-list {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  [data-layout="grid"] .tool-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  [data-layout="grid"] .tool-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* List layout */
[data-layout="list"] .tool-list {
  grid-template-columns: 1fr;
}

[data-layout="list"] .tool-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.2rem 1.25rem;
}

[data-layout="list"] .tool-card .tool-icon {
  margin-bottom: 0;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.35rem 1.3rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--gradient);
}

[data-card-style="raised"] .tool-card {
  box-shadow: var(--shadow);
}

[data-card-style="flat"] .tool-card {
  box-shadow: none;
  border-color: transparent;
}

[data-card-style="outline"] .tool-card {
  background: transparent;
  box-shadow: none;
}

.tool-card.is-link:hover,
.tool-card.is-link:focus-visible {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--color-accent-end) 55%, var(--color-border));
  box-shadow: 0 8px 24px var(--color-glow);
  transform: translateY(-3px);
}

.tool-card.is-soon {
  opacity: 0.82;
  cursor: default;
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.tool-card-top h2 {
  margin: 0;
}

.tool-icon {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: contain;
  flex-shrink: 0;
  margin-bottom: 0.85rem;
}

.tool-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

[data-layout="list"] .tool-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 0;
}

.tool-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
}

.tool-card p {
  color: var(--color-muted);
  font-size: 0.98rem;
  margin: 0;
  flex: 1;
}

.tool-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.tool-card.is-link .tool-cta {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tool-card.is-soon .tool-cta {
  color: var(--color-muted);
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-new {
  color: var(--color-on-accent);
  background: var(--gradient);
}

.badge-soon,
.badge-example {
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  background: transparent;
}

/* ---------- Tool page ---------- */
.page-main {
  padding: 2.5rem 0 4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  color: var(--color-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.back-link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.tool-page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 0.6rem;
}

.tool-page-header p {
  color: var(--color-muted);
  max-width: 40rem;
}

.example-note {
  margin: 0 0 1.5rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid transparent;
  border-image: var(--gradient) 1;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.95rem;
}

.tool-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.tool-panel label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.tool-panel textarea {
  width: 100%;
  min-height: 12rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}

.tool-panel textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.stat {
  background: var(--color-surface-2);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.85rem 0.9rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  color: var(--color-muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

@media (max-width: 520px) {
  .stats {
    grid-template-columns: 1fr;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0 2rem;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.site-footer p {
  margin: 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.15rem;
}

.footer-nav a {
  color: var(--color-muted);
  text-decoration: none;
  font-weight: 500;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--color-text);
  text-decoration: underline;
}

.legal-page {
  max-width: 42rem;
}

.legal-page h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin: 2rem 0 0.6rem;
}

.legal-page p,
.legal-page li {
  color: var(--color-muted);
  line-height: 1.65;
}

.legal-page ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal-page li + li {
  margin-top: 0.4rem;
}

.legal-placeholder {
  display: inline-block;
  margin: 0.1rem 0;
  padding: 0.1em 0.45em;
  border: 1px dashed var(--color-accent-start);
  border-radius: 4px;
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Buttons (used on tool pages) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--color-on-accent);
  background: var(--gradient);
  box-shadow: 0 8px 24px var(--color-glow);
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.06);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .tool-card,
  .btn {
    transition: none;
  }
  .tool-card.is-link:hover,
  .tool-card.is-link:focus-visible {
    transform: none;
  }
  .hero-glow {
    filter: none;
  }
}
