/* niftyexcel.com — Excel green + ink/slate brand */
:root,
[data-theme="light"] {
  --bg: #f4f7f5;
  --bg-elevated: #ffffff;
  --text: #1a2420;
  --text-muted: #4d5c55;
  --border: #d4ddd7;
  --primary: #217346;
  --primary-hover: #185c38;
  --primary-soft: #2e9b5e;
  --accent: #c9a227;
  --ink: #1b2838;
  --hero-grad: linear-gradient(135deg, #185c38 0%, #217346 40%, #1b2838 100%);
  --shadow: 0 8px 24px rgba(26, 36, 32, 0.08);
  --focus: #217346;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --max: 1100px;
  --header-h: 4rem;
  --code-bg: #eef3ef;
}

[data-theme="dark"] {
  --bg: #0e1411;
  --bg-elevated: #161e1a;
  --text: #e6eee9;
  --text-muted: #9aada2;
  --border: #2a3830;
  --primary: #3db870;
  --primary-hover: #5dca8a;
  --primary-soft: #2e9b5e;
  --accent: #e0b84a;
  --ink: #c5d4e0;
  --hero-grad: linear-gradient(135deg, #0f2e1e 0%, #164a2e 42%, #0c1418 100%);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  --focus: #3db870;
  --code-bg: #1a2620;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--primary-hover); }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
  border-radius: 6px;
}
.skip-link:focus { left: 0.5rem; }

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

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

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

.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.logo-mark {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}
.logo span { color: var(--primary); }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.nav-wrap {
  display: none;
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
}

.nav-wrap.is-open { display: block; }

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-weight: 500;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.theme-toggle:hover { border-color: var(--primary); }

@media (min-width: 800px) {
  .nav-toggle { display: none; }
  .nav-wrap {
    display: block !important;
    position: static;
    border: 0;
    padding: 0;
    background: transparent;
  }
  .site-nav {
    flex-direction: row;
    align-items: center;
    gap: 0.15rem;
  }
  .header-inner { gap: 2rem; }
  .site-nav { margin-left: auto; }
}

/* Hero */
.hero {
  background: var(--hero-grad);
  color: #f0faf4;
  padding: 3.5rem 0 3.75rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% 40%;
  height: 80%;
  background: radial-gradient(circle, rgba(61, 184, 112, 0.28), transparent 60%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  max-width: 18ch;
}
.hero .lead {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  max-width: 46ch;
  opacity: 0.92;
  line-height: 1.7;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.chip {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.85rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: #fff;
  color: #185c38;
}
.btn-primary:hover { background: #e8f5ee; color: #185c38; }
.btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.btn-solid {
  background: var(--primary);
  color: #fff;
}
.btn-solid:hover { background: var(--primary-hover); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

/* Sections */
main { flex: 1; }
.section { padding: 3rem 0; }
.section-alt { background: var(--bg-elevated); border-block: 1px solid var(--border); }
.section h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  letter-spacing: -0.02em;
}
.section .section-intro {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  max-width: 55ch;
}

.grid-2 {
  display: grid;
  gap: 1.25rem;
}
.grid-3 {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.card .card-link {
  display: inline-block;
  margin-top: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.card .icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  font-weight: 700;
  font-size: 0.75rem;
}

.prose { max-width: 68ch; }
.prose h2, .prose h3 { margin-top: 1.75rem; }
.prose p, .prose li { color: var(--text); }
.prose .muted { color: var(--text-muted); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }
.prose code,
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

/* Technique / tip blocks */
.tip-list {
  display: grid;
  gap: 1.25rem;
}
.tip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.tip h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}
.tip p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.tip .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.85rem;
}
.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-weight: 600;
}
.tag-accent {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 70%, var(--text));
}

/* CTA band */
.cta-band {
  background: color-mix(in srgb, var(--primary) 10%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  border-radius: var(--radius);
  padding: 1.75rem;
  display: grid;
  gap: 1rem;
}
@media (min-width: 700px) {
  .cta-band {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}
.cta-band h2 { margin: 0 0 0.35rem; font-size: 1.25rem; }
.cta-band p { margin: 0; color: var(--text-muted); max-width: 48ch; }

/* Anchor targets under sticky header */
[id] { scroll-margin-top: calc(var(--header-h) + 0.75rem); }

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.footer-inner a { color: var(--text-muted); }
.footer-inner a:hover { color: var(--primary); }
@media (min-width: 700px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.page-hero {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
}
.page-hero p {
  margin: 0;
  color: var(--text-muted);
  max-width: 52ch;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.hero .badge { color: #d4e8c8; }

.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.resource-list li {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.resource-list a {
  font-weight: 600;
  text-decoration: none;
}
.resource-list p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.toc a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.toc a:hover {
  border-color: var(--primary);
  color: var(--primary);
}
