/* ============================================================
   my-portfolio docs — shared stylesheet
   ============================================================ */

/* -- reset & custom properties ------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #ffffff;
  --bg-soft:       #f6f8fa;
  --bg-inset:      #eaeef2;
  --border:        #d0d7de;
  --text:          #1f2328;
  --text-muted:    #57606a;
  --accent:        #0969da;
  --accent-bg:     #ddf4ff;
  --accent-border: #54aeff;
  --code-bg:       #f6f8fa;
  --radius:        6px;
  --font-sans:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono:     "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow-sm:     0 1px 0 rgba(27,31,36,.04);
  --shadow-md:     0 3px 6px rgba(140,149,159,.15);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* -- site header --------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 56px;
}

.site-header__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__title:hover { color: var(--accent); }

.site-header__sep {
  color: var(--border);
  font-size: 1.1rem;
  user-select: none;
}

.site-header__section {
  font-size: 0.9375rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.site-header__spacer { flex: 1; }

.site-header__nav {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.site-header__nav a {
  display: inline-block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  transition: background .12s, color .12s;
}
.site-header__nav a:hover {
  color: var(--text);
  background: var(--bg-soft);
}
.site-header__nav a.active {
  color: var(--accent);
  background: var(--accent-bg);
}

/* -- hub (landing page) -------------------------------------------- */
.hub {
  max-width: 960px;
  margin: 4rem auto;
  padding: 0 1.5rem 4rem;
}

.hub__hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hub__hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 0.6rem;
}

.hub__hero p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

.hub__section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  margin-top: 2.5rem;
}

.hub__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.875rem;
}

/* -- card ---------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.125rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-bg), var(--shadow-md);
  transform: translateY(-1px);
}
.card:active { transform: translateY(0); }

.card__icon {
  font-size: 1.375rem;
  line-height: 1;
  margin-bottom: 0.125rem;
}

.card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.card__desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* -- doc layout (sidebar + article) -------------------------------- */
.doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

@media (max-width: 760px) {
  .doc-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1rem 3rem;
  }
  .doc-toc { display: none; }
}

/* -- TOC sidebar --------------------------------------------------- */
.doc-toc {
  position: sticky;
  top: 72px;
  align-self: start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-bottom: 2rem;
}

.doc-toc__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.doc-toc__list {
  list-style: none;
  border-left: 2px solid var(--border);
  padding-left: 0;
}

.doc-toc__list li {
  display: block;
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.doc-toc__list li.active {
  border-left-color: var(--accent);
}

.doc-toc__list a {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0 0.2rem 0.875rem;
  line-height: 1.4;
  transition: color .12s;
}
.doc-toc__list a:hover { color: var(--text); }
.doc-toc__list li.active > a { color: var(--accent); font-weight: 500; }

.doc-toc__list .toc-h3 > a {
  padding-left: 1.625rem;
  font-size: 0.75rem;
}

/* -- article (rendered markdown) ----------------------------------- */
.article { min-width: 0; }

.article h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.article h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.875rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.article h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.article h1:first-child { margin-top: 0; }

.article p { margin-bottom: 1rem; }

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

.article strong { font-weight: 600; }
.article em { font-style: italic; }

.article ul,
.article ol {
  margin: 0 0 1rem 1.5rem;
  padding: 0;
}
.article li { margin-bottom: 0.3rem; line-height: 1.55; }
.article li > ul,
.article li > ol { margin-top: 0.3rem; margin-bottom: 0.1rem; }

/* tables */
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  display: block;
  overflow-x: auto;
}
.article th {
  background: var(--bg-soft);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.article td {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  vertical-align: top;
}
.article tr:nth-child(even) td { background: var(--bg-soft); }

/* inline code */
.article code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.4em;
}

/* code blocks */
.article pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  position: relative;
}
.article pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text);
}

/* block quotes */
.article blockquote {
  border-left: 4px solid var(--border);
  padding: 0.5rem 1.25rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  background: var(--bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.article blockquote p { margin-bottom: 0; }

.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* -- mermaid diagrams ---------------------------------------------- */
.mermaid-wrapper {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.mermaid-wrapper pre.mermaid,
.mermaid-wrapper div.mermaid {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  max-width: 100%;
}

/* -- site footer --------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2rem;
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--accent); }

/* -- responsive ---------------------------------------------------- */
@media (max-width: 520px) {
  .hub__grid { grid-template-columns: 1fr; }
  .hub__hero h1 { font-size: 1.5rem; }
  .site-header__nav { display: none; }
}
