/* --------------------------------------------------------------------------
   CSS Custom Properties (Dark Theme)
   -------------------------------------------------------------------------- */

:root {
  /* Colors - Base */
  --color-bg: #0f0f0f;
  --color-bg-secondary: #1a1a1a;
  --color-text: #f0f0f0;
  --color-text-secondary: #d0d0d0;
  --color-text-muted: #888888;
  --color-text-light: #666666;

  /* Colors - Accent (Rust Red) */
  --color-accent: #c44;
  --color-accent-hover: #a33;
  --color-accent-light: rgba(204, 68, 68, 0.08);

  /* Colors - UI */
  --color-border: #2a2a2a;
  --color-border-dark: #666666;
  --color-link: var(--color-text-muted);
  --color-link-hover: var(--color-accent);

  /* Colors - Code */
  --color-code-bg: transparent;
  --color-code-text: #b0b0b0;

  /* Syntax Highlighting - subtle but colorful */
  --syn-comment: #6a737d;
  --syn-keyword: #c792ea;
  --syn-string: #c3e88d;
  --syn-number: #f78c6c;
  --syn-function: #82aaff;
  --syn-operator: #89ddff;
  --syn-variable: #f07178;

  /* Typography */
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-hero: 4.5rem;

  /* Spacing */
  --content-width: 36em;
  --content-width-wide: 42em;
  --container-width: 50em;

  /* Transitions */
  --transition: 200ms ease;
}

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

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 100%;
  color: var(--color-text);
  background-color: var(--color-bg);
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
}

h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 500;
  line-height: 1.3;
}

h1 {
  font-size: var(--text-4xl);
  margin: 0 auto 0.25em;
  width: var(--content-width);
}

h2 {
  font-size: var(--text-3xl);
  margin: 2em auto 0.75em;
  width: var(--content-width);
  position: relative;
}

h3 {
  font-size: var(--text-2xl);
  margin: 1.75em auto 0.5em;
  width: var(--content-width);
}

h4 {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 auto 2em;
  width: var(--content-width);
}

p {
  line-height: 1.7;
}

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

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

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto;
  border-radius: 4px;
}

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

#container {
  margin: 5em auto 0;
  max-width: var(--container-width);
  padding: 0 1.5em;
}

/* --------------------------------------------------------------------------
   Header / Logo
   -------------------------------------------------------------------------- */

#header {
  position: absolute;
  left: 0.5em;
  top: 0.5em;
  padding-top: 0.5em;
  display: flex;
  align-items: center;
  gap: 0.75em;
}

#logo {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-muted);
  display: inline-block;
  padding: 0.25em 0.5em;
  transition: color var(--transition);
}

#logo:hover {
  color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   Homepage - Grid Design
   -------------------------------------------------------------------------- */

#grid-home {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Grid lines */
.grid-line {
  position: absolute;
  background: var(--color-border);
  pointer-events: none;
}

.grid-line-v {
  width: 1px;
  height: 100vh;
  right: 25%;
}

.grid-line-h {
  height: 1px;
  width: 100%;
  top: 45%;
}

/* Intersection marker */
.grid-marker {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--color-accent);
  border-radius: 50%;
  right: calc(25% - 4px);
  top: calc(45% - 4px);
}

/* Content positioning */
.grid-content {
  position: relative;
  margin-right: 30%;
  margin-top: -5%;
}

.name-block {
  position: relative;
}

.grid-name {
  font-family: var(--font-heading);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.02em;
  line-height: 1;
  margin: 0;
  width: auto;
}

/* Coordinates */
.coord {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-light);
  letter-spacing: 0.05em;
  position: absolute;
  right: 0;
}

.coord-top {
  top: -1.5em;
}

.coord-bottom {
  bottom: -1.5em;
}

/* Navigation */
.grid-nav {
  margin-top: 3rem;
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
}

.grid-nav a {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: text-decoration var(--transition);
}

.grid-nav a:hover {
  text-decoration: underline;
}

/* Connection line from name to intersection */
.name-block::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: calc(30vw - 25%);
  height: 1px;
  background: linear-gradient(90deg, var(--color-border) 0%, transparent 100%);
  margin-left: 1.5rem;
}

/* --------------------------------------------------------------------------
   Article Pages
   -------------------------------------------------------------------------- */

#article {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: 1.75;
  color: var(--color-text-secondary);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

#article h1 {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.25em;
  line-height: 1.15;
}

#article h2 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--color-text);
  margin: 2.5em 0 0.75em;
  padding-top: 0.75em;
  position: relative;
}

/* Accent line above h2 */
#article h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 2em;
  height: 3px;
  background: var(--color-accent);
  pointer-events: none;
}

#article h3 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text);
  margin: 2em 0 0.5em;
}

#article h4 {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 2.5em;
}

#article p {
  margin: 1.5em 0;
}

#article a {
  color: var(--color-accent);
  transition: border-color var(--transition);
  border-bottom: 1px solid transparent;
}

#article a:hover {
  border-bottom-color: var(--color-accent);
}

#article ul,
#article ol {
  margin: 1.5em 0;
  padding-left: 1.5em;
}

#article li {
  margin-bottom: 0.5em;
  line-height: 1.7;
}

#article li::marker {
  color: var(--color-accent);
}

#article ol {
  list-style-type: decimal;
}

/* Footer */
#footer {
  margin: 4em auto 6em;
}

#more-words {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  padding: 0.5em 1em;
  margin: 0 auto;
  transition: color var(--transition);
  display: inline-block;
  position: relative;
}

#more-words:hover {
  color: var(--color-accent);
}

#more-words::before {
  content: '\2190';
  margin-right: 0.5em;
  transition: transform var(--transition);
  display: inline-block;
}

#more-words:hover::before {
  transform: translateX(-0.25em);
}

/* Center the footer link container */
#footer {
  text-align: center;
}

/* --------------------------------------------------------------------------
   Word List (Blog Index)
   -------------------------------------------------------------------------- */

#word-list {
  margin-top: 2em;
  width: var(--content-width-wide);
  margin-left: auto;
  margin-right: auto;
}

#word-list a {
  color: var(--color-text);
  display: block;
}

#word-list a:hover {
  color: var(--color-text);
}

#word-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  padding-bottom: 1em;
  margin-bottom: 1em;
  position: relative;
}

#word-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3em;
  height: 3px;
  background: var(--color-accent);
  pointer-events: none;
}

.post {
  padding: 1.5em 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
  transition: padding-left var(--transition);
}

.post:hover {
  padding-left: 1em;
}

.post-name {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  transition: color var(--transition);
}

.post:hover .post-name {
  color: var(--color-accent);
}

.post-date {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  float: right;
  margin-top: 0.35em;
}

/* --------------------------------------------------------------------------
   Code Blocks & Syntax Highlighting
   -------------------------------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--color-text-muted);
}

pre {
  display: block;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-code-text);
  line-height: 1.6;
}

pre code {
  color: inherit;
}

.codehilite {
  font-family: var(--font-mono);
  color: var(--color-code-text);
  line-height: 1.6;
  margin: 1.5em 0;
  padding-left: 1.5em;
  border-left: 2px solid var(--color-border);
}

.codehilite pre {
  margin: 0;
  overflow-x: auto;
}

p code,
li code {
  color: var(--color-text-muted);
}

/* Syntax highlighting */
.codehilite .c,
.codehilite .cm,
.codehilite .cp,
.codehilite .c1,
.codehilite .cs { color: var(--syn-comment); font-style: italic; }

.codehilite .k,
.codehilite .kc,
.codehilite .kd,
.codehilite .kn,
.codehilite .kp,
.codehilite .kr,
.codehilite .kt { color: var(--syn-keyword); }

.codehilite .s,
.codehilite .sb,
.codehilite .sc,
.codehilite .sd,
.codehilite .s2,
.codehilite .se,
.codehilite .sh,
.codehilite .si,
.codehilite .sx,
.codehilite .sr,
.codehilite .s1,
.codehilite .ss { color: var(--syn-string); }

.codehilite .m,
.codehilite .mf,
.codehilite .mh,
.codehilite .mi,
.codehilite .mo,
.codehilite .il { color: var(--syn-number); }

.codehilite .na,
.codehilite .nc,
.codehilite .nd,
.codehilite .ne,
.codehilite .nf,
.codehilite .ni { color: var(--syn-function); }

.codehilite .o,
.codehilite .ow { color: var(--syn-operator); }

.codehilite .n,
.codehilite .nv,
.codehilite .vc,
.codehilite .vg,
.codehilite .vi { color: var(--syn-variable); }

.codehilite .nt { color: var(--syn-keyword); }
.codehilite .nb { color: var(--syn-function); }
.codehilite .bp { color: var(--syn-variable); }

.codehilite .ge { font-style: italic; }
.codehilite .gs { font-weight: bold; }

/* --------------------------------------------------------------------------
   Blockquotes
   -------------------------------------------------------------------------- */

blockquote {
  margin: 2em 0;
  padding: 0;
  background: none;
  border: none;
  border-left: 3px solid var(--color-accent);
  width: 100%;
}

blockquote p {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  padding-left: 1.5em;
  margin: 0;
  line-height: 1.6;
}

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

@media (max-width: 768px) {
  :root {
    --content-width: 100%;
    --content-width-wide: 100%;
    --container-width: 100%;
    --text-hero: 3rem;
  }

  body {
    font-size: 100%;
  }

  #header {
    position: relative;
    padding: 0.75em;
    justify-content: space-between;
    width: 100%;
  }

  #logo {
    font-size: var(--text-lg);
  }

  #container {
    margin-top: 1em;
    padding: 0 1.25em;
  }

  /* Homepage - Grid */
  .grid-content {
    margin-right: 0;
    margin-top: 0;
    text-align: center;
  }

  .grid-name {
    font-size: 2.5rem;
  }

  .grid-line-v {
    right: 10%;
  }

  .grid-marker {
    right: calc(10% - 4px);
  }

  .name-block::after {
    display: none;
  }

  .coord {
    position: static;
    display: block;
    margin: 0.75em 0;
  }

  .grid-nav {
    justify-content: center;
  }

  /* Articles */
  #article {
    font-size: var(--text-base);
  }

  #article h1 {
    font-size: var(--text-3xl);
  }

  #article h2 {
    font-size: var(--text-2xl);
  }

  #article h3 {
    font-size: var(--text-xl);
  }

  h1, h2, h3, h4 {
    width: 100%;
  }


  pre {
    overflow-x: auto;
  }

  blockquote p {
    padding-left: 1em;
  }

  #more-words {
    font-size: var(--text-lg);
  }

  /* Word List */
  #word-list {
    width: 100%;
  }

  #word-title {
    font-size: var(--text-2xl);
  }

  .post {
    padding: 1.25em 0;
  }

  .post-name {
    font-size: var(--text-lg);
  }

  .post-date {
    float: none;
    display: block;
    margin-top: 0.5em;
  }
}

@media (max-width: 480px) {
  :root {
    --text-hero: 2.5rem;
  }

  .grid-name {
    font-size: 2rem;
  }

  .grid-nav {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  #article h1 {
    font-size: var(--text-2xl);
  }
}
