/* ---------------------------------------------------------------
   mylesgoins.com — Flexoki-inspired palette (https://stephango.com/flexoki)
   Light and dark themes driven by html[data-theme].
   --------------------------------------------------------------- */

:root {
  /* Flexoki light */
  --bg:          #FFFCF0;  /* paper */
  --bg-2:        #F2F0E5;  /* base-50 */
  --ui:          #E6E4D9;  /* base-100 — hairlines */
  --ui-2:        #DAD8CE;  /* base-150 */
  --tx-3:        #B7B5AC;  /* faint */
  --tx-2:        #6F6E69;  /* muted */
  --tx:          #100F0F;  /* ink */
  --accent:      #205EA6;  /* blue-600 */
  --accent-2:    #24837B;  /* cyan-600 */
  --highlight:   #AD8301;  /* yellow-600 */

  --font-sans: "Avenir Next", Avenir, Seravek, "Segoe UI", ui-sans-serif,
               system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  /* Flexoki dark */
  --bg:          #100F0F;
  --bg-2:        #1C1B1A;
  --ui:          #282726;
  --ui-2:        #343331;
  --tx-3:        #575653;
  --tx-2:        #878580;
  --tx:          #CECDC3;
  --accent:      #4385BE;  /* blue-400 */
  --accent-2:    #3AA99F;  /* cyan-400 */
  --highlight:   #D0A215;  /* yellow-400 */
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.25rem 0 0.5rem;
}

.site-name {
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--tx);
  font-size: 1.0625rem;
}
.site-name:hover { color: var(--accent); }

nav.site-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
nav.site-nav a {
  color: var(--tx-2);
  text-decoration: none;
  font-size: 0.95rem;
}
nav.site-nav a:hover,
nav.site-nav a[aria-current="page"] { color: var(--tx); }

/* Theme toggle */
#theme-toggle {
  appearance: none;
  border: 1px solid var(--ui-2);
  background: transparent;
  color: var(--tx-2);
  border-radius: 99px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.3s ease;
}
#theme-toggle:hover { color: var(--tx); border-color: var(--tx-3); transform: rotate(20deg); }
#theme-toggle svg { width: 1rem; height: 1rem; }
#theme-toggle .moon { display: none; }
[data-theme="dark"] #theme-toggle .sun { display: none; }
[data-theme="dark"] #theme-toggle .moon { display: block; }

/* ---- Main ---- */

main { padding: 2.5rem 0 3rem; }

h1, h2, h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 650;
}
h1 { font-size: 1.75rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.2rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 2rem 0 0.5rem; }

p { margin: 0 0 1.1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

hr {
  border: none;
  border-top: 1px solid var(--ui);
  margin: 2.5rem 0;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 1.1rem;
  border-left: 3px solid var(--ui-2);
  color: var(--tx-2);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-2);
  border: 1px solid var(--ui);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--bg-2);
  border: 1px solid var(--ui);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.5rem 0;
}
pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }

img { max-width: 100%; border-radius: 6px; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--ui);
}
th { color: var(--tx-2); font-weight: 600; }

ul, ol { padding-left: 1.4rem; margin: 0 0 1.1rem; }
li { margin-bottom: 0.35rem; }

::selection { background: var(--highlight); color: #100F0F; }

/* ---- Homepage ---- */

.intro h1 { margin-bottom: 0.75rem; }
.intro .lede { color: var(--tx-2); }

.post-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--ui);
  margin: 0;
}
.post-list li:first-child { border-top: 1px solid var(--ui); }
.post-list a { color: var(--tx); flex: 1; }
.post-list a:hover { color: var(--accent); text-decoration: none; }
.post-list time {
  color: var(--tx-3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.year-label {
  color: var(--tx-3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2.25rem 0 0.25rem;
}
.year-label:first-of-type { margin-top: 0.5rem; }

.more-link { font-size: 0.95rem; }

/* ---- Posts ---- */

.post-meta {
  color: var(--tx-3);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: -0.75rem 0 2rem;
  display: block;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ui);
  font-size: 0.95rem;
  color: var(--tx-2);
}

/* ---- Footer ---- */

footer.site {
  border-top: 1px solid var(--ui);
  padding: 1.25rem 0 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--tx-3);
  font-size: 0.875rem;
}
footer.site a { color: var(--tx-2); }
footer.site a:hover { color: var(--tx); }

@media (max-width: 480px) {
  body { font-size: 1rem; }
  h1 { font-size: 1.5rem; }
  .post-list li { flex-direction: column; gap: 0.05rem; }
}

/* ---- Pixel scene (homepage art) ---- */

.pixel-scene {
  margin: 2.25rem 0 0.5rem;
  width: 13rem;
  max-width: 60%;
}
.pixel-scene svg { display: block; width: 100%; height: auto; }
.pixel-scene .scene-dark { display: none; }
[data-theme="dark"] .pixel-scene .scene-light { display: none; }
[data-theme="dark"] .pixel-scene .scene-dark { display: block; }

/* gentle motion */
@media (prefers-reduced-motion: no-preference) {
  .pixel-scene .star  { animation: twinkle 3.2s ease-in-out infinite; }
  .pixel-scene .star:nth-of-type(odd)  { animation-delay: 1.1s; }
  .pixel-scene .star:nth-of-type(3n)   { animation-delay: 2.2s; animation-duration: 4.1s; }
  .pixel-scene .glint { animation: twinkle 2.6s ease-in-out infinite; }
  .pixel-scene .glint:nth-of-type(odd) { animation-delay: 1.3s; }
  .pixel-scene .ray   { animation: twinkle 3.8s ease-in-out infinite; }
  .pixel-scene .ray:nth-of-type(even)  { animation-delay: 1.9s; }
}
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
