/* Grey's Wiki — Material 3 Inspired Theme (Light) */
/* Reference: codewiki.google */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary: #0b57d0;
  --on-primary: #ffffff;
  --primary-container: #d3e3fd;
  --on-primary-container: #0842a0;

  --surface: #ffffff;
  --surface-container: #f0f4f9;
  --surface-container-high: #e9eef6;
  --surface-container-low: #f8fafd;
  --on-surface: #1f1f1f;
  --on-surface-variant: #444746;

  --outline-variant: #c4c7c5;

  --sidebar-bg: #f8fafd;
  --sidebar-text: #1f1f1f;
  --sidebar-active: #0b57d0;

  --code-bg: #f6f8fa;
  --border: #e0e3e5;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
}

::selection {
  background-color: var(--primary);
  color: var(--on-primary);
}

/* Base */
* { box-sizing: border-box; }

body {
  font-family: Pretendard, -apple-system, 'Segoe UI', sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  line-height: 1.4;
}

h1 {
  font-size: 2em;
  border-bottom: none;
  margin-bottom: 0.5em;
  font-weight: 700;
}

h2 {
  font-size: 1.5em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
  font-weight: 600;
  margin-top: 2em;
}

h3 {
  font-size: 1.2em;
  font-weight: 600;
  margin-top: 1.5em;
}

/* Links */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.markdown-section a {
  color: var(--primary);
  font-weight: 500;
  transition: all .15s;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  font-size: 14px;
  width: 280px;
}

.sidebar > h1 {
  padding: 20px 24px 8px;
  margin: 0;
}

.sidebar > h1 a {
  font-family: Pretendard, sans-serif;
  font-size: 1.2em;
  font-weight: 700;
  color: var(--on-surface);
  letter-spacing: -0.3px;
}

.sidebar .search {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar .search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--outline-variant);
  border-radius: 24px;
  background: var(--surface-container);
  font-family: Pretendard, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--on-surface);
  outline: none;
  transition: border-color .2s, background .2s;
}

.sidebar .search input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.12);
}

.sidebar .search input::placeholder { color: var(--on-surface-variant); }
.sidebar .search .clear-search-button { display: none; }

/* Sidebar nav */
.sidebar-nav {
  padding: 0 0 24px;
}

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

.sidebar ul li {
  margin: 0;
}

.sidebar ul li a {
  display: block;
  padding: 6px 24px;
  color: var(--sidebar-text);
  font-weight: 400;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .15s;
  text-decoration: none;
}

.sidebar ul li a:hover {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-left-color: var(--primary);
  text-decoration: none;
}

.sidebar ul li.active > a {
  color: var(--sidebar-active);
  font-weight: 600;
  border-left-color: var(--sidebar-active);
  background: var(--primary-container);
  text-decoration: none;
}

/* Sidebar category headers (bold items) */
.sidebar ul li > strong,
.sidebar-nav > ul > li > p > strong {
  display: block;
  padding: 16px 24px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--on-surface-variant);
}

/* Sidebar sub-items indent */
.sidebar ul li ul li a {
  padding-left: 40px;
  font-size: 13px;
}

/* Sidebar 3rd depth indent */
.sidebar ul li ul li ul li a {
  padding-left: 56px;
  font-size: 12px;
}

.sidebar ul li ul li ul li.active > a {
  border-left-color: var(--sidebar-active);
  font-weight: 600;
}

/* Content */
.content {
  padding-top: 24px;
}

.markdown-section {
  max-width: 860px;
  padding: 0 40px;
}

.markdown-section p {
  font-weight: 400;
  margin: 1.2em 0;
}

.markdown-section blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-container);
  padding: 16px 20px;
  margin: 1.5em 0;
  border-radius: 0 8px 8px 0;
  color: var(--on-primary-container);
  font-size: 0.95em;
}

/* Tables */
.markdown-section table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
  margin: 1.5em 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.markdown-section table thead {
  background: var(--surface-container);
}

.markdown-section table th {
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  color: var(--on-surface);
  border-bottom: 2px solid var(--border);
  font-size: 0.9em;
}

.markdown-section table td {
  padding: 10px 16px;
  font-weight: 400;
  border-bottom: 1px solid var(--border);
}

.markdown-section table tbody tr {
  background: var(--surface);
  transition: background .15s;
}

.markdown-section table tbody tr:nth-child(even) {
  background: var(--surface-container-low);
}

.markdown-section table tbody tr:hover {
  background: var(--surface-container-high);
}

.markdown-section table tbody tr:last-child td {
  border-bottom: none;
}

/* Code blocks */
.markdown-section pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  line-height: 1.6;
  margin: 1.5em 0;
  overflow-x: auto;
}

.markdown-section code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85em;
}

.markdown-section pre code {
  background: transparent;
  color: var(--on-surface);
}

.markdown-section p > code,
.markdown-section li > code {
  background: var(--primary-container);
  color: var(--on-primary-container);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* Syntax highlighting */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #6e7781; }

.token.punctuation { color: var(--on-surface); }

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #0550ae; }

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #0a3069; }

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #0550ae; }

.token.atrule,
.token.attr-value,
.token.keyword { color: #cf222e; }

.token.function,
.token.class-name { color: #8250df; }

.token.regex,
.token.important,
.token.variable { color: #953800; }

/* Breadcrumb */
.markdown-section > nav:first-child {
  font-size: 0.8em !important;
  color: var(--on-surface-variant) !important;
  margin-bottom: 1.2em !important;
  padding-bottom: 0.5em !important;
  border-bottom: 1px solid var(--border) !important;
}

.markdown-section > nav:first-child a {
  color: var(--primary) !important;
  text-decoration: none !important;
}

.markdown-section > nav:first-child a:hover {
  text-decoration: underline !important;
}

/* Edit on GitHub */
.markdown-section > p:last-child a[target="_blank"] {
  color: var(--on-surface-variant);
  font-size: 0.8em;
}

.markdown-section > p:last-child a[target="_blank"]:hover {
  color: var(--primary);
}

/* Blog posts */
#blog-posts ul {
  list-style: none;
  padding: 0;
}

#blog-posts ul li {
  padding: 12px 0 !important;
  border-bottom: 1px solid var(--border);
}

#blog-posts ul li:last-child { border-bottom: none; }

#blog-posts ul li a {
  font-weight: 500;
  color: var(--primary);
}

#blog-posts ul li span {
  color: var(--on-surface-variant) !important;
  font-size: 0.8em !important;
}

/* Dividers */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* Lists */
.markdown-section ul {
  padding-left: 1.5em;
  list-style: disc;
}

.markdown-section ul li { font-weight: 400; }

/* Copy code button */
.docsify-copy-code-button {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--on-surface-variant) !important;
  font-family: Pretendard, sans-serif !important;
  font-size: 12px !important;
  padding: 4px 10px !important;
  cursor: pointer !important;
  transition: all .2s !important;
}

.docsify-copy-code-button:hover {
  background: var(--surface-container) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.docsify-copy-code-button.copied {
  background: var(--primary-container) !important;
  border-color: var(--primary) !important;
  color: var(--on-primary-container) !important;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pagination-item { flex: 1; }
.pagination-item:last-child { text-align: right; }

.pagination-item a {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all .2s;
  text-decoration: none;
}

.pagination-item a:hover {
  border-color: var(--primary);
  background: var(--surface-container);
  text-decoration: none;
}

.pagination-item .pagination-item-label {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-bottom: 4px;
}

.pagination-item .pagination-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

/* External link icon */
.markdown-section a[href^="http"]:not([href*="wiki.giljae.com"]):not([href*="github.com/giljae/wiki"]):after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.5;
}

.markdown-section a[href^="http"]:not([href*="wiki.giljae.com"]):not([href*="github.com/giljae/wiki"]):hover:after {
  opacity: 1;
}
