/* idlewatts.dev — one stylesheet, no build step, no web fonts. */

/* ---------- tokens ---------- */

:root {
  /* Declaring color-scheme keeps the browser from applying its own auto-dark
     transform over the palette, and themes scrollbars + form controls to match. */
  color-scheme: light;
  --bg: #fcf8ff;
  --bg-soft: #f4ecfb;
  --surface: #ffffff;
  --border: #e7dbf4;
  --border-strong: #c4aedd;
  --text: #1b1233;
  --text-dim: #473a63;
  --muted: #655481;
  --accent: #b01a72;
  --accent-hover: #8c1259;
  --accent-2: #0d6b8c;
  --accent-wash: #fdeef8;
  --code-bg: #f7f1fb;
  --shadow: 0 1px 2px rgb(40 15 60 / 7%), 0 6px 20px -12px rgb(40 15 60 / 25%);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --wide: 62rem;
  --prose: 44rem;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0a1a;
    --bg-soft: #141029;
    --surface: #171130;
    --border: #2a2050;
    --border-strong: #40317a;
    --text: #ece8fa;
    --text-dim: #c5bce4;
    --muted: #9c92c4;
    --accent: #ff6ec7;
    --accent-hover: #ff9bd8;
    --accent-2: #4de3ff;
    --accent-wash: #1e1440;
    --code-bg: #0b0817;
    --shadow: 0 1px 2px rgb(0 0 0 / 45%), 0 8px 24px -14px rgb(120 40 160 / 60%);
  }
}

:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0a1a;
  --bg-soft: #141029;
  --surface: #171130;
  --border: #2a2050;
  --border-strong: #40317a;
  --text: #ece8fa;
  --text-dim: #c5bce4;
  --muted: #9c92c4;
  --accent: #ff6ec7;
  --accent-hover: #ff9bd8;
  --accent-2: #4de3ff;
  --accent-wash: #1e1440;
  --code-bg: #0b0817;
  --shadow: 0 1px 2px rgb(0 0 0 / 45%), 0 8px 24px -14px rgb(120 40 160 / 60%);
}

/* ---------- base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 3px;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: .6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0; }

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

.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: min(100% - 2.5rem, var(--wide));
  margin: 0 auto;
  padding: 1.4rem 0 1.1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand .mark { color: var(--accent-2); flex: none; }
.brand b { font-weight: 600; color: var(--accent); }
.brand .tld { color: var(--muted); font-weight: 400; }

.site-nav {
  display: flex;
  gap: 1.1rem;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .88rem;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.theme-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent-2); border-color: var(--border-strong); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

/* ---------- shell ---------- */

main {
  flex: 1;
  width: min(100% - 2.5rem, var(--wide));
  margin: 0 auto;
  padding: 3rem 0 5rem;
}

.site-footer {
  width: min(100% - 2.5rem, var(--wide));
  margin: 0 auto;
  padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
}
.site-footer p { margin: .2rem 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.colophon { color: var(--muted); }

/* ---------- headings & hero ---------- */

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -.02em;
  font-weight: 650;
  margin: 0;
}

.hero { max-width: var(--prose); padding: 1rem 0 2.5rem; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 2.9rem); }
.lede {
  color: var(--text-dim);
  font-size: 1.06rem;
  margin: .9rem 0 0;
  max-width: 40rem;
}

/* The one line on the site that changes often. Kept deliberately small. */
.now {
  font-size: .88rem;
  color: var(--muted);
  margin: 1.5rem 0 0;
  padding-left: .9rem;
  border-left: 2px solid var(--accent-2);
  max-width: 38rem;
}

.hero-links { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.8rem 0 0; }

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .85rem;
  padding: .5rem .95rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--bg-soft); color: var(--text); border-color: var(--accent-2); }

.page-head { max-width: var(--prose); margin-bottom: 2.5rem; }
.page-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }

.section-head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .7rem;
  margin-bottom: 1.4rem;
}
/* Cyan-to-magenta rule, fading out. The one overtly vaporwave flourish. */
.section-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent) 45%, var(--border) 85%);
}
.section-head h2 { font-size: .82rem; font-family: var(--font-mono); font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.section-head a { font-family: var(--font-mono); font-size: .8rem; text-decoration: none; }

.stack + .stack { margin-top: 3.5rem; }
.empty { color: var(--muted); font-style: italic; }

/* ---------- blog entries ---------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entry { border-bottom: 1px solid var(--border); }
.entry:first-child { border-top: 1px solid var(--border); }

.entry-link {
  display: block;
  padding: 1.15rem 0;
  text-decoration: none;
  color: inherit;
}
.entry-link time {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.entry-link h3 { font-size: 1.13rem; margin: .25rem 0 0; color: var(--text); }
.entry-link:hover h3 { color: var(--accent); }
.entry-link p { margin: .35rem 0 0; color: var(--text-dim); font-size: .95rem; }
.entry .tags { padding-bottom: 1rem; margin-top: -.45rem; }

/* ---------- project cards ---------- */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--accent-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-link { display: block; padding: 1.1rem 1.15rem .4rem; text-decoration: none; color: inherit; flex: 1; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: .6rem; }
.card-link h3 { font-size: 1.05rem; }
.card:hover .card-link h3 { color: var(--accent); }
.card-link p { margin: .5rem 0 0; color: var(--text-dim); font-size: .92rem; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .5rem 1.15rem 1rem;
}
.card-foot .ext { font-family: var(--font-mono); font-size: .76rem; text-decoration: none; }
.card-foot .ext::after { content: " ↗"; }

.status {
  flex: none;
  font-family: var(--font-mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .18rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  white-space: nowrap;
}
.status-active, .status-shipped { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

/* ---------- tags ---------- */

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 0; padding: 0; }
.tags a {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--muted);
  text-decoration: none;
  padding: .12rem .42rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
}
.tags a:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* ---------- prose ---------- */

.prose { max-width: var(--prose); }
.post-head { margin-bottom: 2.4rem; }
.post-head h1 { font-size: clamp(1.75rem, 4.5vw, 2.4rem); margin-top: .3rem; }

.kicker {
  font-family: var(--font-mono);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 0;
}
.kicker a { text-decoration: none; }
.kicker a::before { content: "← "; }

.meta {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  gap: .5rem;
  margin: .7rem 0 0;
}

.prose h2 { font-size: 1.42rem; margin: 2.6rem 0 .8rem; }
.prose h3 { font-size: 1.14rem; margin: 2rem 0 .6rem; }
.prose h4 { font-size: 1rem; margin: 1.6rem 0 .5rem; color: var(--text-dim); }
.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { margin: 0 0 1.15rem; padding-left: 1.35rem; }
.prose li { margin: .3rem 0; }
.prose li::marker { color: var(--accent-2); }
.prose ul.task-list { list-style: none; padding-left: .2rem; }
.prose li.task input { margin-right: .5rem; accent-color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose img { border-radius: var(--radius); border: 1px solid var(--border); display: block; margin: 1.5rem 0; }

/* ---------- images ---------- */

/* Lead image under the title of a project or post. */
.lead-media {
  margin: 0 0 2.2rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.lead-media img { display: block; width: 100%; height: auto; }

/* `![alt](/img/x.jpg "Caption")` on its own line becomes a captioned figure. */
.fig { margin: 1.8rem 0; }
.fig img { margin: 0; width: 100%; }
.fig figcaption {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--muted);
  margin-top: .55rem;
  padding-left: .1rem;
  line-height: 1.5;
}

/* Thumbnail on a project card. Fixed ratio so a mixed grid stays tidy. */
.card-media {
  margin: -1.1rem -1.15rem .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card.has-media:hover .card-media img { opacity: .93; }

.anchor {
  margin-left: .4rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity .12s ease;
}
h1:hover > .anchor, h2:hover > .anchor, h3:hover > .anchor, .anchor:focus-visible { opacity: 1; }

blockquote {
  margin: 1.6rem 0;
  padding: .1rem 0 .1rem 1.1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-dim);
}
blockquote p:last-child { margin-bottom: 0; }

.callout {
  border-left-color: var(--accent-2);
  background: var(--accent-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .9rem 1.1rem;
}
.callout-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin: 0 0 .35rem !important;
}

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

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .32em;
  word-break: break-word;
}

figure.code {
  position: relative;
  margin: 1.5rem 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
figure.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: .5rem;
  left: .9rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-2);
}
figure.code[data-lang] pre { padding-top: 2rem; }

figure.code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}
figure.code code {
  background: none;
  border: 0;
  padding: 0;
  font-size: .855rem;
  line-height: 1.6;
  color: var(--text-dim);
  word-break: normal;
}

.copy {
  position: absolute;
  top: .45rem;
  right: .5rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  padding: .18rem .45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease;
}
figure.code:hover .copy, .copy:focus { opacity: 1; }
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copy[data-done] { color: var(--accent); border-color: var(--accent); opacity: 1; }
/* Touch devices never hover, so the button would otherwise never be reachable. */
@media (hover: none) { .copy { opacity: 1; } }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td {
  text-align: left;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: var(--font-mono);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 600;
  border-bottom-color: var(--border-strong);
}
tbody tr:hover { background: var(--bg-soft); }

/* ---------- facts & files ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .1rem 1.5rem;
  margin: 0 0 2.2rem;
  padding: 1rem 1.15rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.facts dt {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.facts dd { margin: 0 0 .55rem; font-size: .93rem; word-break: break-word; }


/* ---------- 404 ---------- */

.notfound { padding-top: 3rem; }
.notfound .kicker { color: var(--accent); }

/* ---------- small screens ---------- */

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .site-header { flex-wrap: wrap; gap: .75rem 1rem; }
  .site-nav { width: 100%; order: 3; margin-left: 0; gap: .95rem; }
  main { padding-top: 2.2rem; }
  .facts { grid-template-columns: 1fr; }

  /* Hard caps, because the clamp() maximums are sized for a desktop measure. */
  .hero h1 { font-size: 2rem; }
  .post-head h1 { font-size: 1.8rem; }
  .page-head h1 { font-size: 1.65rem; }
}
