/* ————— Kami design system ————— */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F5F4ED;
  --surface: #FAF9F5;
  --sand: #E8E6DC;
  --border: #E3E1D6;
  --ink: #141413;
  --body: #3D3D3A;
  --olive: #504E49;
  --stone: #6B6A64;
  --accent: #1B365D;
  --accent-dark-surface: #2D5A8A;
  --tag: #E4ECF5;
  --tag-quiet: #EEF2F7;
  --serif: Charter, "Iowan Old Style", "Charter CO", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* ————— Base ————— */
html { color-scheme: light; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}

.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ————— Navigation ————— */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}
.nav-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.nav-links a {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
}
.nav-links a:hover,
.nav-links a.is-active,
.nav-links a[aria-current="page"] { color: var(--accent); text-decoration: none; }

/* ————— Layout ————— */
.container {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 4.5rem 2rem 5.5rem;
}

.hero {
  max-width: 52rem;
  padding: 2rem 0 4rem;
  border-bottom: 1px solid var(--border);
}
.kicker {
  margin-bottom: 1rem;
  color: var(--stone);
}
.hero h1 {
  max-width: 22ch;
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.lead {
  max-width: 44ch;
  margin-top: 1.25rem;
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--olive);
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* ————— Buttons ————— */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.375rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-transform: uppercase;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.button:hover { text-decoration: none; }
.button-sm {
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
}
.button-primary {
  background: var(--accent);
  color: var(--surface);
}
.button-primary:hover { background: #244572; color: var(--surface); }
.button-secondary {
  background: var(--sand);
  color: var(--body);
}
.button-secondary:hover { background: #DFDCD0; color: var(--ink); }
.button-ghost {
  background: transparent;
  color: var(--accent);
}
.button-ghost:hover { text-decoration: underline; }

/* ————— Sections ————— */
.section-title {
  margin: 3.5rem 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
}
.page-title {
  max-width: 24ch;
  margin-bottom: 3rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
}

/* ————— Project cards ————— */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
}
.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}
.card:hover {
  border-color: var(--accent);
}
.card-content {
  display: flex;
  flex-direction: column;
}
.card-thumb {
  width: calc(100% + 3rem);
  height: auto;
  aspect-ratio: 16 / 10;
  margin: -1.5rem -1.5rem 1.25rem;
  object-fit: cover;
  object-position: top center;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: var(--sand);
  transition: filter 0.15s;
}
.card:hover .card-thumb { filter: saturate(1.05); }
.card h3 {
  font-size: 1.25rem;
}
.card p {
  margin-top: 0.625rem;
  color: var(--olive);
}
.card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}
.tag {
  background: var(--tag);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.4;
}
.tag-quiet { background: var(--tag-quiet); }

/* ————— Post list ————— */
.post-list {
  display: flex;
  flex-direction: column;
  max-width: 52rem;
}
.post-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.post-row:first-child { padding-top: 0; }
.post-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--stone);
}
.post-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
}
.post-row:hover { text-decoration: none; }
.post-row:hover .post-title { color: var(--accent); }
.post-desc {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.375rem;
  max-width: 65ch;
  font-size: 1rem;
  color: var(--olive);
}

/* ————— Pagination ————— */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 52rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--stone);
}

/* ————— Article ————— */
.post { max-width: 65ch; }
.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.post-header .post-date { display: block; margin-bottom: 1rem; }
.post-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.post-header .post-desc {
  display: block;
  overflow: visible;
  margin-top: 1rem;
  max-width: 60ch;
  color: var(--olive);
}

.post-body h2 { margin: 3rem 0 1rem; font-size: 1.75rem; line-height: 1.25; }
.post-body h3 { margin: 2.5rem 0 0.875rem; font-size: 1.375rem; line-height: 1.3; }
.post-body h4 { margin: 2rem 0 0.75rem; font-size: 1.125rem; line-height: 1.35; }
.post-body p,
.post-body ul,
.post-body ol { margin-bottom: 1.125rem; }
.post-body ul,
.post-body ol { padding-left: 1.5rem; }
.post-body li { margin-bottom: 0.4rem; line-height: 1.45; }
.post-body blockquote {
  margin: 2rem 0;
  color: var(--olive);
  font-style: italic;
}

.post-body code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--sand);
  border-radius: 4px;
  padding: 0.15em 0.35em;
  color: var(--body);
}
.post-body pre {
  margin: 1.75rem 0;
  padding: 1.25rem;
  overflow-x: auto;
  background: var(--surface);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.post-body pre code {
  background: transparent;
  padding: 0;
  color: var(--body);
}

/* Syntect classes mapped to Kami ink tones. */
.code { color: #3D3D3A; background: #FAF9F5; }
.z-source { color: #3D3D3A; }
.z-keyword,
.z-storage { color: #1B365D; }
.z-string { color: #504E49; }
.z-comment { color: #6B6A64; font-style: italic; }
.z-constant,
.z-numeric { color: #504E49; }
.z-entity,
.z-variable,
.z-support { color: #3D3D3A; }
.z-meta { color: #504E49; }
.z-punctuation { color: #504E49; }

/* ————— Article navigation ————— */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: 65ch;
  margin-top: 4rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}
.post-nav-link {
  max-width: 48%;
  color: var(--stone);
}
.post-nav-link:hover { color: var(--accent); }

/* ————— 404 ————— */
.not-found {
  max-width: 40rem;
  padding: 4rem 0;
  text-align: center;
}
.not-found h1 {
  font-size: clamp(3.5rem, 9vw, 6rem);
  line-height: 1.1;
  color: var(--stone);
}
.not-found p {
  margin-top: 1rem;
  color: var(--olive);
}

/* ————— Footer ————— */
.footer {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--stone);
}
.footer-top { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.footer a { color: var(--stone); text-transform: uppercase; }
.footer a:hover { color: var(--accent); }
.footer-icons {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.footer-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--stone);
  transition: color 0.15s, transform 0.15s;
}
.footer-icons a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}
.footer-stack {
  width: 100%;
  margin-top: -0.25rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
}
.footer-stack a {
  color: inherit;
}
.footer-stack a:hover {
  color: var(--accent);
  text-decoration: none;
}


/* ————— Dark theme ————— */
:root {
  --dark-bg: #141413;
  --dark-surface: #30302E;
  --dark-sand: #3D3C38;
  --dark-border: #45443F;
  --dark-ink: #F5F4ED;
  --dark-body: #D6D4C8;
  --dark-olive: #C0BEB2;
  --dark-stone: #A9A79E;
  --dark-accent: #2D5A8A;
  --dark-tag: #454540;
  --dark-tag-quiet: #3D3C38;
}

html[data-theme="dark"] {
  --bg: var(--dark-bg);
  --surface: var(--dark-surface);
  --sand: var(--dark-sand);
  --border: var(--dark-border);
  --ink: var(--dark-ink);
  --body: var(--dark-body);
  --olive: var(--dark-olive);
  --stone: var(--dark-stone);
  --accent: var(--dark-accent);
  --tag: var(--dark-tag);
  --tag-quiet: var(--dark-tag-quiet);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--dark-bg);
    --surface: var(--dark-surface);
    --sand: var(--dark-sand);
    --border: var(--dark-border);
    --ink: var(--dark-ink);
    --body: var(--dark-body);
    --olive: var(--dark-olive);
    --stone: var(--dark-stone);
    --accent: var(--dark-accent);
    --tag: var(--dark-tag);
    --tag-quiet: var(--dark-tag-quiet);
    color-scheme: dark;
  }
}


html[data-theme="light"] {
  --bg: #F5F4ED;
  --surface: #FAF9F5;
  --sand: #E8E6DC;
  --border: #E3E1D6;
  --ink: #141413;
  --body: #3D3D3A;
  --olive: #504E49;
  --stone: #6B6A64;
  --accent: #1B365D;
  --tag: #E4ECF5;
  --tag-quiet: #EEF2F7;
  color-scheme: light;
}

html[data-theme="dark"] .button-primary { color: #F5F4ED; }
html[data-theme="dark"] .button-primary:hover { background: #386899; color: #F5F4ED; }
html[data-theme="dark"] .button-secondary { color: #F5F4ED; }
html[data-theme="dark"] .button-secondary:hover { color: #F5F4ED; }
html[data-theme="dark"] .post-body code { color: #F5F4ED; }
html[data-theme="dark"] .post-body pre { background: #30302E; }
html[data-theme="dark"] .post-body pre code { color: #F5F4ED; }

html[data-theme="dark"] .code { color: #F5F4ED; background: #30302E; }
html[data-theme="dark"] .z-source { color: #F5F4ED; }
html[data-theme="dark"] .z-keyword,
html[data-theme="dark"] .z-storage { color: #D6D4C8; }
html[data-theme="dark"] .z-string { color: #C0BEB2; }
html[data-theme="dark"] .z-comment { color: #A9A79E; font-style: italic; }
html[data-theme="dark"] .z-constant,
html[data-theme="dark"] .z-numeric { color: #D6D4C8; }
html[data-theme="dark"] .z-entity,
html[data-theme="dark"] .z-variable,
html[data-theme="dark"] .z-support { color: #F5F4ED; }
html[data-theme="dark"] .z-meta,
html[data-theme="dark"] .z-punctuation { color: #D6D4C8; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .button-primary { color: #F5F4ED; }
  :root:not([data-theme="light"]) .button-primary:hover { background: #386899; color: #F5F4ED; }
  :root:not([data-theme="light"]) .button-secondary { color: #F5F4ED; }
  :root:not([data-theme="light"]) .button-secondary:hover { color: #F5F4ED; }
  :root:not([data-theme="light"]) .post-body code { color: #F5F4ED; }
  :root:not([data-theme="light"]) .post-body pre { background: #30302E; }
  :root:not([data-theme="light"]) .post-body pre code { color: #F5F4ED; }

  :root:not([data-theme="light"]) .code { color: #F5F4ED; background: #30302E; }
  :root:not([data-theme="light"]) .z-source { color: #F5F4ED; }
  :root:not([data-theme="light"]) .z-keyword,
  :root:not([data-theme="light"]) .z-storage { color: #D6D4C8; }
  :root:not([data-theme="light"]) .z-string { color: #C0BEB2; }
  :root:not([data-theme="light"]) .z-comment { color: #A9A79E; font-style: italic; }
  :root:not([data-theme="light"]) .z-constant,
  :root:not([data-theme="light"]) .z-numeric { color: #D6D4C8; }
  :root:not([data-theme="light"]) .z-entity,
  :root:not([data-theme="light"]) .z-variable,
  :root:not([data-theme="light"]) .z-support { color: #F5F4ED; }
  :root:not([data-theme="light"]) .z-meta,
  :root:not([data-theme="light"]) .z-punctuation { color: #D6D4C8; }
}

/* ————— Manual theme toggle ————— */
.theme-toggle {
  padding: 0.4rem 0.65rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  text-transform: uppercase;
  transition: background-color 0.15s;
}
.theme-toggle:hover {
  background: var(--sand);
}
.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
/* The palette follows the system preference until a theme is stored, so the
   icon has to as well. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* ————— Small screens ————— */
@media (max-width: 640px) {
  .nav,
  .container,
  .footer { padding-left: 1.25rem; padding-right: 1.25rem; }
  .container { padding-top: 2.5rem; padding-bottom: 3.5rem; }
  .hero { padding-bottom: 3rem; }
  .post-row { grid-template-columns: 1fr; gap: 0.375rem; }
  .post-nav { flex-direction: column; }
  .post-nav-link { max-width: 100%; }
}

/* ————— About: info cards ————— */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
}
.info-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.info-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.info-arrow {
  color: var(--stone);
  font-size: 0.75rem;
  transition: color 0.15s, transform 0.15s;
}
a.info-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
a.info-card:hover .info-value { color: var(--accent); }
a.info-card:hover .info-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}
.info-label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
}
.info-value {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.35;
  color: var(--ink);
}

/* ————— About: experience timeline ————— */
.timeline {
  display: flex;
  flex-direction: column;
  max-width: 52rem;
  list-style: none;
}
.timeline-item {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:first-child { padding-top: 0; }
.timeline-period {
  font-size: 0.75rem;
  color: var(--stone);
}
.timeline-role {
  font-size: 1.25rem;
  font-weight: 500;
}
.timeline-company {
  margin-top: 0.25rem;
  color: var(--olive);
}

/* ————— About: stack ————— */
.stack-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1.5rem;
}
.stack-group {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.stack-name {
  margin-bottom: 1rem;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
}
.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}
.stack-items li {
  padding: 0.25rem 0.5rem;
  background: var(--tag-quiet);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.4;
}
.stack-items a { color: var(--accent); }
.stack-items span { color: var(--olive); }

/* ————— About: links ————— */
.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: 52rem;
}
.link-chip {
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.link-chip:hover {
  border-color: var(--accent);
  text-decoration: none;
}

@media (max-width: 640px) {
  .timeline-item { grid-template-columns: 1fr; gap: 0.375rem; }
}
/* ————— Page subtitle ————— */
.page-sub {
  max-width: 60ch;
  margin: -2rem 0 2.5rem;
  color: var(--olive);
}

/* ————— Games: profile ————— */
.profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 3.5rem;
}
.profile-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 5rem;
  height: 5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}
.profile-name { font-size: 1.5rem; }
.steam-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  background: var(--sand);
  border-radius: 6px;
  color: var(--accent);
  transition: background-color 0.15s, transform 0.15s;
}
.steam-icon-btn:hover {
  background: var(--tag);
  transform: translateY(-1px);
}
.profile-real { color: var(--stone); font-size: 0.8125rem; }
.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.chip {
  padding: 0.3rem 0.6rem;
  background: var(--tag-quiet);
  border-radius: 4px;
  color: var(--olive);
  font-size: 0.6875rem;
  line-height: 1.4;
  text-transform: uppercase;
}

/* ————— Games: Hall of Fame Highlights ————— */
.highlight-card {
  padding: 1.25rem;
}
.highlight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.platform-badge {
  padding: 0.2rem 0.5rem;
  background: var(--accent);
  color: var(--surface);
  border-radius: 4px;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.highlight-stats {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--stone);
}
.highlight-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--olive);
  font-style: italic;
}
.profile-link {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ————— Games: contribution heatmap ————— */
.section-note {
  margin: -1rem 0 1.5rem;
  color: var(--stone);
}
.heatmap {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.heatmap-months,
.heatmap-grid {
  display: flex;
  gap: 3px;
  min-width: max-content;
}
.heatmap-months { margin-bottom: 0.5rem; }
.heatmap-month {
  width: 13px;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--stone);
  white-space: nowrap;
  overflow: visible;
}
.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
/* A trailing partial week sits at the bottom, like GitHub's graph. */
.heatmap-week:last-child { justify-content: flex-end; }
/* Intensity ramp mixed from the brand accent, the same way Kami derives its
   other tints, so it follows every theme automatically. */
.heat-cell {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--sand);
}
.heat-cell[data-level="1"] {
  background: color-mix(in srgb, var(--accent) 25%, var(--sand));
}
.heat-cell[data-level="2"] {
  background: color-mix(in srgb, var(--accent) 50%, var(--sand));
}
.heat-cell[data-level="3"] {
  background: color-mix(in srgb, var(--accent) 75%, var(--sand));
}
.heat-cell[data-level="4"] { background: var(--accent); }
.heat-cell.is-empty { background: transparent; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1rem;
  color: var(--stone);
  font-size: 0.75rem;
}
.heatmap-legend .heat-cell { display: inline-block; }
.heatmap-legend span:first-child { margin-right: 0.25rem; }
.heatmap-legend span:last-child { margin-left: 0.25rem; }

/* ————— Games: achievement progress ————— */
.progress-list {
  display: flex;
  flex-direction: column;
  max-width: 52rem;
}
.progress-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto 7rem auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.progress-icon { width: 2rem; height: 2rem; border-radius: 4px; }
.progress-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-count,
.progress-pct {
  color: var(--stone);
  font-size: 0.6875rem;
}
.progress-bar {
  height: 6px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* ————— Games: library cards ————— */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 0.75rem;
}
.game-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--body);
}
.game-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.game-icon { width: 2.5rem; height: 2.5rem; border-radius: 4px; }
.game-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.game-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-time {
  color: var(--stone);
  font-size: 0.6875rem;
}

@media (max-width: 640px) {
  .progress-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    row-gap: 0.4rem;
  }
  .progress-bar { grid-column: 2 / -1; }
  .progress-pct { display: none; }
}