/* Theme and layout for NeuroTrainHub Revision 10.
   This stylesheet builds on the BoostYourBio aesthetic but adapts it to a dark, modern, neuroscience-inspired palette.
   Everything is mobile friendly and uses CSS variables for easy customization. */

:root {
  --bg: #f7fafc;
  --card: #ffffff;
  --text: #102a43;
  --muted: #59687c;
  --brand: #007acc;
  --accent: #1db991;
  --line: #e2e8f0;
  --max: 1000px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.75;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  opacity: 0.92;
  text-decoration: underline;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px;
}

/* Header and navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

.brand img {
  width: 200px;
  height: auto;
}

.nav-desktop ul {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-desktop li {
  position: relative;
}

.nav-desktop a {
  color: var(--text);
  opacity: 0.85;
}

.nav-desktop a:hover {
  opacity: 1;
}

.has-sub .sub-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
}

.sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 12px;
  display: none;
  min-width: 240px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 20;
}

.has-sub:hover .sub-menu {
  display: block;
}

.search-input {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
}

.search-list li a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
}

.search-list li a:hover {
  background: var(--line);
}

/* Hero section */
.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
  padding: 50px 0 30px;
}

.hero .intro {
  flex: 1 1 300px;
}

.hero .intro h1 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 0 0 14px;
}

.hero .intro p {
  color: var(--muted);
  max-width: 600px;
  margin: 0 0 16px;
}

.hero .intro .actions {
  display: flex;
  gap: 16px;
}

.hero .chart {
  flex: 1 1 260px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero svg {
  width: 100%;
  max-width: 360px;
  height: auto;
}

/* Featured grid */
.featured {
  margin-top: 40px;
}

.featured h2 {
  font-size: clamp(24px, 3vw, 32px);
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.card h3 {
  font-size: 1.2rem;
  margin: 0 0 10px;
  color: var(--text);
}

.card p {
  color: var(--muted);
  margin: 0 0 12px;
}

.card .read-more {
  margin-top: auto;
  color: var(--brand);
  font-weight: 600;
}

/* Article & content layout */
.content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-top: 30px;
}

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

.article-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}

.article-content h1 {
  font-size: clamp(26px, 4vw, 40px);
  margin: 0 0 14px;
  color: var(--text);
}

.article-content p {
  margin: 0 0 18px;
  color: var(--muted);
}

.article-content h2 {
  margin: 24px 0 12px;
  font-size: clamp(20px, 3vw, 28px);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
  color: var(--text);
}

.article-content h3 {
  margin: 20px 0 10px;
  font-size: 1.2rem;
  color: var(--text);
}

.article-content ul, .article-content ol {
  padding-left: 20px;
  margin: 12px 0;
  color: var(--muted);
}

.article-content li {
  margin-bottom: 8px;
}

.article-content a {
  color: var(--brand);
}

aside {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

aside h3 {
  margin: 0 0 14px;
  color: var(--text);
}

/* Footer */
.site-footer {
  margin-top: 50px;
  border-top: 1px solid var(--line);
  padding: 20px 0;
  background: var(--card);
  color: var(--muted);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
}

.site-footer h4 {
  margin: 0 0 10px;
  color: var(--text);
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer ul li {
  margin: 4px 0;
}

.site-footer a {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

/* Cookie consent */
.cookie-consent {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 99;
}

.cookie-consent.show {
  display: block;
}

.cookie-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.cookie-actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: var(--brand);
  color: var(--bg);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}


/* Article page search bar */
.article-search {
  margin-bottom: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.article-search .search-input {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.article-search .search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.article-search .search-list li a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
}

.article-search .search-list li a:hover {
  background: var(--line);
}

.sub-menu a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
}
.sub-menu a:hover {
  background: var(--line);
}

/* Tool pages */
.tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-top: 30px;
}
.tool h1 {
  margin-top: 0;
  font-size: 1.8rem;
  color: var(--text);
}
.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.tool-controls label, .tool-controls input, .tool-controls button {
  font-size: 1rem;
}
.tool-controls input {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.tool-controls button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  cursor: pointer;
}
.tool-controls button:hover {
  opacity: 0.9;
}
.timer-display {
  font-size: 2.5rem;
  font-weight: 600;
}


/* Mobile navigation styles */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
}
.nav-mobile {
  display: none;
  flex-direction: column;
  position: absolute;
  right: 20px;
  top: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  width: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.nav-mobile ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-mobile li {
  margin-bottom: 8px;
}
.nav-mobile a {
  color: var(--text);
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
}
.nav-mobile a:hover {
  background: var(--line);
}
@media (max-width: 860px) {
  .nav-desktop { display: none; }
  .hamburger { display: flex; }
  /* Show mobile menu when toggled via JS (style set via inline) */
}
