:root {
  color-scheme: light;
  --fg: #111;
  --fg-muted: #666;
  --bg: #fff;
  --bg-soft: #f5f5f5;
  --line: #e5e5e5;
  --accent: #111;
  --max-width: 1100px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --fg: #f0f0f0;
  --fg-muted: #8a8a8a;
  --bg: #0d0d0d;
  --bg-soft: #1a1a1a;
  --line: #262626;
  --accent: #f0f0f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body > nav,
article,
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3rem;
}

.topnav a {
  color: var(--fg);
  text-decoration: none;
}

.topnav a:hover { text-decoration: underline; }

.topnav .brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.topnav .links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.95rem;
  align-items: center;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--fg);
  width: 2rem;
  height: 2rem;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}

.theme-toggle:hover { border-color: var(--fg); }
.theme-toggle::before { content: "\263E"; }
[data-theme="dark"] .theme-toggle::before { content: "\2600"; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9rem; color: var(--fg-muted); font-weight: 400; }

p { margin-bottom: 1rem; }

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

article > header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

article > header h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
article > header h4 { font-size: 1.1rem; color: var(--fg-muted); font-weight: 400; }
article > header h5 { font-size: 0.85rem; color: var(--fg-muted); margin-top: 0.5rem; }

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.product {
  display: block;
}

.product a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.product img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-soft);
  margin-bottom: 0.75rem;
  transition: opacity 0.15s ease;
}

.product a:hover img { opacity: 0.85; }

.product h4 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.product h3 {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--fg-muted);
  margin-bottom: 0;
}

article > p,
article > nav,
article > div,
article > section {
  margin-bottom: 1.5rem;
}

article nav {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

button,
input[type="submit"],
input[type="button"] {
  font: inherit;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--bg);
  color: var(--fg);
}

iframe {
  max-width: 100%;
  margin: 1rem 0;
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

footer a { color: var(--fg-muted); }
footer a:hover { color: var(--fg); }

@media (max-width: 600px) {
  body > nav,
  article,
  footer { padding-left: 1rem; padding-right: 1rem; }
  h1 { font-size: 1.6rem; }
  .products { gap: 1.25rem; }
}
