/* =================================================================
   Aware Design — Component Styles
   Shared layout and component classes for the paradigm site.
   ================================================================= */

/* ---------------------------------------------------------------
   Layout
   --------------------------------------------------------------- */

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container-narrow {
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container-wide {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-16) 0;
}
.section-alt {
  padding: var(--space-16) 0;
  background: var(--bg-elevated);
}

/* ---------------------------------------------------------------
   Cards
   --------------------------------------------------------------- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.card-link:hover {
  text-decoration: none;
}
.card-link:hover .card {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-large {
  padding: var(--space-3) var(--space-8);
  font-size: var(--text-base);
}

/* ---------------------------------------------------------------
   Navigation
   --------------------------------------------------------------- */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  max-width: var(--content-wide);
  margin: 0 auto;
  border-bottom: 1px solid var(--border-subtle);
}

.site-nav .logo {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--text-primary);
  letter-spacing: var(--tracking-wide);
  text-decoration: none;
}
.site-nav .logo:hover {
  text-decoration: none;
}
.site-nav .logo .accent {
  color: var(--accent);
}

.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}
.site-nav .nav-links a {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}
.site-nav .nav-links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */

.site-footer {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.site-footer p {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-4);
  list-style: none;
}
.site-footer .footer-links a {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ---------------------------------------------------------------
   Tags / Badges
   --------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.reading-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------
   Article layout — two-column with sticky sidebar TOC
   --------------------------------------------------------------- */

.article-layout {
  display: grid;
  grid-template-columns: minmax(220px, 240px) minmax(0, 760px);
  gap: var(--space-12);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
  align-items: start;
}
.article-layout.no-toc {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.article-toc {
  position: sticky;
  top: var(--space-6);
  font-size: var(--text-sm);
  border-left: 1px solid var(--border-subtle);
  padding-left: var(--space-5);
}
.article-toc h4 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-tertiary);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-3);
}
.article-toc ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.article-toc a {
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  padding: var(--space-1) 0;
  line-height: var(--leading-snug);
  transition: color var(--duration-fast) var(--ease-out);
}
.article-toc a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---------------------------------------------------------------
   Article typography — applied to markdown-rendered content
   --------------------------------------------------------------- */

.article {
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.article > * + * {
  margin-top: var(--space-5);
}

.article h1 {
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
}
.article h2 {
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  letter-spacing: var(--tracking-tight);
}
.article h2:first-of-type {
  margin-top: var(--space-8);
  padding-top: 0;
  border-top: none;
}
.article h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-8);
  color: var(--text-primary);
}
.article h4 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-6);
  color: var(--text-secondary);
}

.article p {
  color: var(--text-secondary);
}
.article p strong {
  color: var(--text-primary);
}

.article ul, .article ol {
  padding-left: var(--space-6);
  color: var(--text-secondary);
}
.article li {
  margin-bottom: var(--space-2);
  line-height: var(--leading-relaxed);
}
.article li > strong:first-child {
  color: var(--text-primary);
}

.article a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border-accent);
  text-underline-offset: 3px;
}
.article a:hover {
  text-decoration-color: var(--accent);
}

/* Article tables — richer than default */
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin: var(--space-6) 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.article table th {
  background: var(--bg-elevated);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--weight-semibold);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  text-align: left;
}
.article table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}
.article table tr:last-child td {
  border-bottom: none;
}
.article table td strong {
  color: var(--text-primary);
}

/* Pull quotes */
.article blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
  color: var(--text-primary);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  font-style: italic;
  background: var(--accent-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.article blockquote p {
  color: var(--text-primary);
  margin: 0;
}
.article blockquote p + p {
  margin-top: var(--space-3);
}
.article blockquote em {
  color: var(--text-secondary);
  font-style: normal;
  font-size: var(--text-sm);
  display: block;
}

/* Code & diagram blocks */
.article pre {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  padding: var(--space-5);
  margin: var(--space-6) 0;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.article :not(pre) > code {
  background: var(--accent-subtle);
  color: var(--accent);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

/* Horizontal rule — accent gradient */
.article hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border-default), transparent);
  margin: var(--space-12) 0;
}

/* Heading anchor on hover */
.article h2, .article h3 {
  scroll-margin-top: var(--space-6);
}

/* Figures (diagrams, screenshots) */
.article figure {
  margin: var(--space-8) 0;
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
}
.article figure.diagram {
  background: var(--bg-base);
  padding: var(--space-4) var(--space-3) var(--space-2);
}
.article figure img {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}
.article figure figcaption {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: var(--tracking-wide);
  text-align: center;
  font-style: normal;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */

@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: minmax(0, 760px);
    justify-content: center;
  }
  .article-toc {
    display: none;
  }
}

@media (max-width: 768px) {
  .site-nav {
    padding: var(--space-3) var(--space-4);
  }
  .site-nav .nav-links {
    gap: var(--space-3);
    flex-wrap: wrap;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .series-nav {
    grid-template-columns: 1fr;
  }
  .article h1 {
    font-size: var(--text-3xl);
  }
  .article h2 {
    font-size: var(--text-xl);
  }
  .article-layout {
    padding: var(--space-6) var(--space-4);
  }
}
