/* ========================================================================
   AsciiMark Documentation - styles.css
   ======================================================================== */

/* --- Reset & Base --- */

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

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
    monospace;

  /* Light mode (default) */
  --color-bg: #ffffff;
  --color-bg-alt: #f4f6f9;
  --color-bg-code: #f0f2f5;
  --color-bg-kbd: #eef1f5;
  --color-bg-card: #ffffff;
  --color-border: #d0d7de;
  --color-border-light: #e1e6eb;
  --color-text: #1f2937;
  --color-text-muted: #57606a;
  --color-text-heading: #111827;
  --color-link: #2563eb;
  --color-link-hover: #1d4ed8;
  --color-accent: #3b82f6;
  --color-accent-light: #dbeafe;
  --color-accent-dark: #1e40af;
  --color-shadow: rgba(0, 0, 0, 0.06);
  --color-shadow-lg: rgba(0, 0, 0, 0.1);
  --color-table-stripe: #f8fafc;
  --color-nav-active: #eff6ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0d1117;
    --color-bg-alt: #161b22;
    --color-bg-code: #1c2128;
    --color-bg-kbd: #21262d;
    --color-bg-card: #161b22;
    --color-border: #30363d;
    --color-border-light: #21262d;
    --color-text: #c9d1d9;
    --color-text-muted: #8b949e;
    --color-text-heading: #e6edf3;
    --color-link: #58a6ff;
    --color-link-hover: #79c0ff;
    --color-accent: #58a6ff;
    --color-accent-light: #0d1f3c;
    --color-accent-dark: #79c0ff;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-lg: rgba(0, 0, 0, 0.4);
    --color-table-stripe: #1c2128;
    --color-nav-active: #0d1f3c;
  }
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

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

/* --- Typography --- */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--color-border-light);
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

/* --- Layout --- */

.site-header {
  background-color: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-heading);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.site-logo:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.site-logo .logo-icon {
  font-size: 1.4rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  background-color: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}

.site-nav a.active {
  background-color: var(--color-nav-active);
  color: var(--color-accent);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
}

.site-footer {
  background-color: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: auto;
}

.site-footer a {
  color: var(--color-text-muted);
  font-weight: 500;
}

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

/* --- Lists --- */

ul,
ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

li > ul,
li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

/* --- Code --- */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--color-bg-code);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  word-break: break-word;
}

pre {
  background-color: var(--color-bg-code);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  border-radius: 0;
}

/* --- Keyboard Shortcuts --- */

kbd {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background-color: var(--color-bg-kbd);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.15em 0.45em;
  white-space: nowrap;
  color: var(--color-text);
}

/* --- Tables --- */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-border-light);
}

th {
  background-color: var(--color-bg-alt);
  font-weight: 600;
  color: var(--color-text-heading);
}

tbody tr:nth-child(even) {
  background-color: var(--color-table-stripe);
}

/* --- Cards --- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px var(--color-shadow);
}

.card-icon {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  display: block;
}

.card h3 {
  font-size: 1.05rem;
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* --- Hero Section (Landing Page) --- */

.hero {
  text-align: center;
  padding: 3rem 0 2.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero .tagline {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  max-width: 540px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-accent-dark);
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-bg-code);
  text-decoration: none;
}

/* --- Section --- */

.section {
  margin-bottom: 2.5rem;
}

.section:last-child {
  margin-bottom: 0;
}

/* --- Page Title --- */

.page-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* --- Navigation Links (prev/next) --- */

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-light);
}

.page-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  min-width: 0;
}

.page-nav a:hover {
  border-color: var(--color-accent);
  background-color: var(--color-bg-alt);
  text-decoration: none;
}

.page-nav .nav-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.page-nav .nav-next {
  text-align: right;
  margin-left: auto;
}

/* --- Notice / Callout --- */

.notice {
  background-color: var(--color-accent-light);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.notice p {
  margin-bottom: 0;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .header-inner {
    padding: 0.6rem 1rem;
  }

  .site-nav a {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero .tagline {
    font-size: 1.05rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav .nav-next {
    text-align: left;
  }

  table {
    font-size: 0.85rem;
  }

  th,
  td {
    padding: 0.5rem 0.65rem;
  }
}

@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.25rem;
  }
}
