/* ---------------------------------------------------------------------------
   base.css — reset, typography, layout, footer
   Gwern-inspired: serif body, generous whitespace, clean reading experience.
   More modern: tighter than gwern, subtle color accents, crisp contrast.
   --------------------------------------------------------------------------- */

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

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Source Serif 4", "Charter", "Bitstream Charter", Cambria, serif;
  line-height: 1.7;
  color: #1a1a1a;
  background: #fcfcfc;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */

main {
  max-width: 660px;
  margin: 2.5rem auto 4rem;
  padding: 0 1.5rem;
}

/* --- Typography --- */

h1, h2, h3, h4 {
  font-family: "Inter", -apple-system, sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: #111;
}

h1 {
  font-size: 1.65rem;
  margin-top: 0;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.25rem;
  margin-top: 2.2rem;
  margin-bottom: 0.6rem;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1.1em;
}

ul, ol {
  margin-bottom: 1.1em;
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.3em;
}

blockquote {
  border-left: 3px solid #c0c0c0;
  margin: 1.5em 0;
  padding: 0.3em 0 0.3em 1.2em;
  color: #444;
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 2.5rem 0;
}

/* --- Links --- */

a {
  color: #1a6fb5;
  text-decoration: underline;
  text-decoration-color: #b0d0e8;
  text-underline-offset: 2px;
}

/* --- Inline code --- */

p code, li code {
  font-family: "Hack", "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.88em;
  background: #f0f0f0;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: #333;
}

/* --- Images --- */

img {
  max-width: 100%;
  height: auto;
}

/* --- Tables --- */

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

th, td {
  border-bottom: 1px solid #ddd;
  padding: 0.5em 0.75em;
  text-align: left;
}

th {
  font-family: "Inter", -apple-system, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
}

/* --- Footer --- */

footer {
  max-width: 660px;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid #e0e0e0;
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 0.8rem;
  color: #999;
}

footer a {
  color: #999;
  text-decoration-color: #ccc;
}

footer a:hover {
  color: #666;
}

/* --- Responsive --- */

@media (max-width: 540px) {
  html { font-size: 16px; }
  main { padding: 0 1rem; margin-top: 1.5rem; }
  h1 { font-size: 1.45rem; }
}

/* ---------------------------------------------------------------------------
   nav.css — site navigation
   --------------------------------------------------------------------------- */

nav {
  max-width: 660px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem 1rem;
  display: flex;
  gap: 1.5rem;
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 0.85rem;
}

nav a {
  color: #666;
  text-decoration: none;
  letter-spacing: 0.02em;
}

nav a:hover {
  color: #111;
}

@media (max-width: 540px) {
  nav { padding: 1rem; gap: 1rem; }
}

/* ---------------------------------------------------------------------------
   writing.css — post list, article headers, tags
   --------------------------------------------------------------------------- */

/* --- Post list (writing index) --- */

.post-list {
  list-style: none;
  padding-left: 0;
}

.post-list li {
  margin-bottom: 0.6em;
  display: flex;
  align-items: baseline;
  gap: 0.75em;
}

.post-list time {
  font-family: "Hack", "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.82rem;
  color: #888;
  flex-shrink: 0;
}

.post-list a {
  color: #1a1a1a;
}

/* --- Article header --- */

article header {
  margin-bottom: 2.5rem;
}

article header h1 {
  margin-bottom: 0.3rem;
}

article header time {
  font-family: "Hack", "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.82rem;
  color: #888;
}

/* --- Tags --- */

.tags {
  list-style: none;
  display: flex;
  gap: 0.4em;
  margin-top: 0.5em;
  padding-left: 0;
}

.tags li {
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 0.75rem;
  color: #666;
  background: #f0f0f0;
  padding: 0.15em 0.55em;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   projects.css — project listing and project pages
   --------------------------------------------------------------------------- */

.project-list {
  list-style: none;
  padding-left: 0;
}

.project-list li {
  margin-bottom: 0.8em;
}

.project-list a {
  color: #1a1a1a;
  font-weight: 500;
}

.project-list .description {
  color: #666;
  font-size: 0.92rem;
}

article .description {
  color: #555;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

/* ---------------------------------------------------------------------------
   gallery.css — gallery listing, album grids, image pages
   --------------------------------------------------------------------------- */

.gallery-list {
  list-style: none;
  padding-left: 0;
}

.gallery-list li {
  margin-bottom: 0.8em;
}

.gallery-list a {
  color: #1a1a1a;
  font-weight: 500;
}

.gallery-list .description {
  color: #666;
  font-size: 0.92rem;
}

/* --- Album grid --- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.gallery a {
  display: block;
  line-height: 0;
}

.gallery img {
  width: 100%;
  height: auto;
  border-radius: 2px;
  transition: opacity 0.15s;
}

.gallery a:hover img {
  opacity: 0.85;
}

@media (max-width: 540px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
  }
}

/* ---------------------------------------------------------------------------
   code.css — syntax highlighting (monokai-inspired, light background)
   Generated from custom Pygments style. Regenerate with build script if needed.
   Palette: pink keywords, green strings, blue functions, purple numbers,
            orange constants/escapes, teal types, grey comments.
   --------------------------------------------------------------------------- */

pre {
  background: #f7f7f7;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin-bottom: 1.4em;
  line-height: 1.55;
}

pre code {
  font-family: "Hack", "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.85rem;
  background: none;
  padding: 0;
  border-radius: 0;
  color: #1a1a1a;
}

pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
pre code .hll { background-color: #ffffcc }
pre code { background: #f7f7f7; }
pre code .c { color: #7a7a7a; font-style: italic } /* Comment */
pre code .k { color: #d6336c } /* Keyword */
pre code .l { color: #b85c00 } /* Literal */
pre code .n { color: #1a1a1a } /* Name */
pre code .o { color: #d6336c } /* Operator */
pre code .p { color: #555555 } /* Punctuation */
pre code .ch { color: #7a7a7a; font-style: italic } /* Comment.Hashbang */
pre code .cm { color: #7a7a7a; font-style: italic } /* Comment.Multiline */
pre code .cp { color: #7a7a7a; font-weight: bold; font-style: italic } /* Comment.Preproc */
pre code .cpf { color: #7a7a7a; font-style: italic } /* Comment.PreprocFile */
pre code .c1 { color: #7a7a7a; font-style: italic } /* Comment.Single */
pre code .cs { color: #7a7a7a; font-weight: bold; font-style: italic } /* Comment.Special */
pre code .gd { color: #d6336c } /* Generic.Deleted */
pre code .ge { font-style: italic } /* Generic.Emph */
pre code .gr { color: #d6336c } /* Generic.Error */
pre code .gh { color: #1a1a1a; font-weight: bold } /* Generic.Heading */
pre code .gi { color: #298e41 } /* Generic.Inserted */
pre code .go { color: #555555 } /* Generic.Output */
pre code .gp { color: #555555; font-weight: bold } /* Generic.Prompt */
pre code .gs { font-weight: bold } /* Generic.Strong */
pre code .gu { color: #555555 } /* Generic.Subheading */
pre code .gt { color: #d6336c } /* Generic.Traceback */
pre code .kc { color: #d6336c } /* Keyword.Constant */
pre code .kd { color: #d6336c } /* Keyword.Declaration */
pre code .kn { color: #d6336c; font-weight: bold } /* Keyword.Namespace */
pre code .kp { color: #d6336c } /* Keyword.Pseudo */
pre code .kr { color: #d6336c } /* Keyword.Reserved */
pre code .kt { color: #2b8a8a } /* Keyword.Type */
pre code .ld { color: #b85c00 } /* Literal.Date */
pre code .m { color: #9b59b6 } /* Literal.Number */
pre code .s { color: #298e41 } /* Literal.String */
pre code .na { color: #2b7abf } /* Name.Attribute */
pre code .nb { color: #7c38bc } /* Name.Builtin */
pre code .nc { color: #2b8a8a; font-weight: bold } /* Name.Class */
pre code .no { color: #b85c00 } /* Name.Constant */
pre code .nd { color: #7c38bc } /* Name.Decorator */
pre code .ni { color: #1a1a1a } /* Name.Entity */
pre code .ne { color: #d6336c } /* Name.Exception */
pre code .nf { color: #2b7abf } /* Name.Function */
pre code .nl { color: #1a1a1a } /* Name.Label */
pre code .nn { color: #1a1a1a } /* Name.Namespace */
pre code .nx { color: #1a1a1a } /* Name.Other */
pre code .py { color: #1a1a1a } /* Name.Property */
pre code .nt { color: #d6336c } /* Name.Tag */
pre code .nv { color: #1a1a1a } /* Name.Variable */
pre code .ow { color: #d6336c } /* Operator.Word */
pre code .pm { color: #555555 } /* Punctuation.Marker */
pre code .mb { color: #9b59b6 } /* Literal.Number.Bin */
pre code .mf { color: #9b59b6 } /* Literal.Number.Float */
pre code .mh { color: #9b59b6 } /* Literal.Number.Hex */
pre code .mi { color: #9b59b6 } /* Literal.Number.Integer */
pre code .mo { color: #9b59b6 } /* Literal.Number.Oct */
pre code .sa { color: #298e41 } /* Literal.String.Affix */
pre code .sb { color: #298e41 } /* Literal.String.Backtick */
pre code .sc { color: #298e41 } /* Literal.String.Char */
pre code .dl { color: #298e41 } /* Literal.String.Delimiter */
pre code .sd { color: #7a7a7a; font-style: italic } /* Literal.String.Doc */
pre code .s2 { color: #298e41 } /* Literal.String.Double */
pre code .se { color: #b85c00 } /* Literal.String.Escape */
pre code .sh { color: #298e41 } /* Literal.String.Heredoc */
pre code .si { color: #b85c00 } /* Literal.String.Interpol */
pre code .sx { color: #298e41 } /* Literal.String.Other */
pre code .sr { color: #b85c00 } /* Literal.String.Regex */
pre code .s1 { color: #298e41 } /* Literal.String.Single */
pre code .ss { color: #b85c00 } /* Literal.String.Symbol */
pre code .bp { color: #7c38bc } /* Name.Builtin.Pseudo */
pre code .fm { color: #2b7abf } /* Name.Function.Magic */
pre code .vc { color: #1a1a1a } /* Name.Variable.Class */
pre code .vg { color: #1a1a1a } /* Name.Variable.Global */
pre code .vi { color: #1a1a1a } /* Name.Variable.Instance */
pre code .vm { color: #1a1a1a } /* Name.Variable.Magic */
pre code .il { color: #9b59b6 } /* Literal.Number.Integer.Long */
