/* Self-hosted IBM Plex Mono, Latin subset (from Google Fonts v20) */
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/plex-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/plex-mono-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/plex-mono-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/plex-mono-600.woff2') format('woff2'); }

:root {
  --bg: #f4efe0;
  --text: #4f493f;
  --muted: #6b6353;
  --border: #736e62;
  --accent: #0571b3;
  --font: 'IBM Plex Mono', monospace;
  --sidebar-w: 240px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131313;
    --text: #d6d2c9;
    --muted: #a8a29a;
    --border: #6b627b;
    --accent: #1480c2;
  }
}

:root[data-theme="dark"] {
  --bg: #131313;
  --text: #d6d2c9;
  --muted: #a8a29a;
  --border: #6b627b;
  --accent: #1480c2;
}

:root[data-theme="light"] {
  --bg: #f4efe0;
  --text: #4f493f;
  --muted: #6b6353;
  --border: #736e62;
  --accent: #0571b3;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding-top: 5rem;
}

site-sidebar, site-footer { display: block; }

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

/* ═══ Layout ═══ */

.layout {
  display: flex;
  max-width: 1100px;
  width: 100%;
}

/* ═══ Sidebar ═══ */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
  align-self: flex-start;
  padding: 1rem 2rem 2rem;
}

.sidebar-inner {
  position: relative;
  padding-right: 1.5rem;
}

.sidebar-inner::after {
  content: '';
  position: absolute;
  right: 0;
  top: 2.5rem;
  bottom: -350px;
  border-right: 4px double var(--border);
}

.photo-wrap {
  border-bottom: 4px double var(--border);
  padding-bottom: 1rem;
  margin-bottom: 0;
  margin-right: -4.5rem;
  padding-right: 4.5rem;
}

.photo-wrap img {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

nav {
  padding-top: 0.75rem;
}

a.photo-wrap, a.sidebar-name {
  display: block;
  text-decoration: none;
  color: inherit;
}

.sidebar-name {
  font-weight: 600;
  font-size: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0;
  font-size: 1rem;
  font-weight: 500;
}

nav a:hover { color: var(--accent); }
nav a.active { color: var(--accent); }

a.ext::after {
  content: '\2197';
  font-size: 0.65em;
  vertical-align: super;
  opacity: 0.5;
  margin-left: 0.15em;
}

.gear-body a[target="_blank"]::after {
  content: ' \2197';
  font-size: 0.65em;
  vertical-align: super;
  opacity: 0.5;
}

.theme-toggle {
  margin-top: 3rem;
  margin-bottom: -2rem;
  text-align: right;
  padding-right: 0;
}

.theme-toggle button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0;
}

.theme-toggle button:hover { color: var(--accent); }

.hamburger { display: none; }
.mobile-actions { display: none; }

/* ═══ Content ═══ */

.content {
  flex: 1;
  padding: 2rem 4rem;
  display: flex;
  flex-direction: column;
}

.content-inner {
  max-width: 700px;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 780px;
}

/* ═══ Sections ═══ */

.section-label {
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  margin-top: 2rem;
}

:root[data-theme="dark"] .section-label,
:root:not([data-theme="light"]) .section-label { color: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .section-label { color: var(--text); } }

.section-label:first-child { margin-top: 0; }

.intro-name {
  font-size: 4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.1;
}

.intro-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.bio { font-size: 0.9rem; }
.bio p + p { margin-top: 1rem; }

/* ═══ Post list ═══ */

.post-list {
  list-style: none;
  font-size: 0.9rem;
}

.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.15rem 0;
}

.post-date {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.post-list a { color: var(--text); }
.post-list a:hover { color: var(--accent); }

/* ═══ Timeline ═══ */

.timeline {
  font-size: 0.9rem;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  padding: 0.15rem 0;
}

.timeline-period {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
  min-width: 9ch;
}

/* ═══ Socials ═══ */

.socials {
  margin-top: 3rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.socials a {
  color: var(--muted);
  margin-right: 1.25rem;
}

.socials a:hover { color: var(--accent); }

.copyright {
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 0.75rem;
}

/* ═══ Uses / Gear ═══ */

.gear-category {
  margin-bottom: 2rem;
}

/* /uses gets a wider column than the other pages for the gear tables */
.content-inner:has(.gear-category) { max-width: 820px; }

.gear-category h2,
.gear-body h2,
.now-section h2,
#now-content h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.gear-category h2::after,
.gear-body h2::after,
.now-section h2::after,
#now-content h2::after {
  content: '';
  display: block;
  height: 1px;
  margin-top: 0.35rem;
  background: linear-gradient(to right, var(--border), transparent);
}

.gear-list {
  list-style: none;
  display: grid;
  /* Fixed state and rating widths so the columns line up across category lists */
  grid-template-columns: minmax(0, 1fr) 18rem 4.5rem;
}

.gear-list li {
  display: contents;
}

.gear-list li > span,
.gear-list .gear-link > * {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 25%, transparent);
}

.gear-list li:nth-child(even) > *,
.gear-list li:nth-child(even) .gear-link > * {
  background: color-mix(in srgb, var(--border) 6%, transparent);
}

.gear-list .gear-arrow { display: none; }

.gear-link {
  display: contents;
  color: inherit;
  text-decoration: none;
}

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

.gear-list .gear-name { font-weight: 500; font-size: 0.9rem; }

/* Items with x-personal-site-parent, listed under their parent */
.gear-list .gear-child .gear-name { padding-left: 1.25rem; font-weight: 400; }
.gear-list .gear-child .gear-name::before { content: '\2514\00a0'; color: var(--muted); }

/* The oneliner shows as a hover tooltip on desktop (js/gear.js) and under the name on mobile */
.gear-list .gear-desc { display: none; }

.gear-list .gear-states { gap: 0.3rem; }
.gear-list .gear-states .tag { white-space: nowrap; }

.gear-tip {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  max-width: 300px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.gear-tip.visible { opacity: 1; }

.gear-list .gear-rating {
  color: var(--accent);
  font-size: 0.8rem;
  justify-content: flex-end;
}

/* ═══ Gear detail ═══ */

.back-link {
  font-size: 1rem;
  color: var(--muted);
  display: inline-block;
  margin-bottom: 1.5rem;
}

.back-link:hover { color: var(--accent); }

.gear-cover {
  width: 300px;
  max-width: 100%;
  height: 220px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 10%, transparent);
  padding: 0.5rem;
}

.gear-detail h1 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.gear-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.gear-updated { color: var(--muted); margin-left: auto; }

.rating {
  color: var(--accent);
  font-weight: 600;
}

.tag {
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-size: 0.75rem;
}

.tag-red { color: #b71c1c; border-color: #b71c1c; }
.tag-green { color: #1b5e20; border-color: #1b5e20; }
.tag-yellow { color: #a67c00; border-color: #a67c00; }
.tag-blue { color: #0d47a1; border-color: #0d47a1; }
.tag-orange { color: #bf360c; border-color: #bf360c; }

:root[data-theme="dark"] .tag-red,
:root:not([data-theme="light"]) .tag-red { color: #ef5350; border-color: #ef5350; }
:root[data-theme="dark"] .tag-green,
:root:not([data-theme="light"]) .tag-green { color: #66bb6a; border-color: #66bb6a; }
:root[data-theme="dark"] .tag-yellow,
:root:not([data-theme="light"]) .tag-yellow { color: #fdd835; border-color: #fdd835; }
:root[data-theme="dark"] .tag-blue,
:root:not([data-theme="light"]) .tag-blue { color: #42a5f5; border-color: #42a5f5; }
:root[data-theme="dark"] .tag-orange,
:root:not([data-theme="light"]) .tag-orange { color: #ff7043; border-color: #ff7043; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .tag-red { color: #b71c1c; border-color: #b71c1c; }
  :root:not([data-theme="dark"]) .tag-green { color: #1b5e20; border-color: #1b5e20; }
  :root:not([data-theme="dark"]) .tag-yellow { color: #a67c00; border-color: #a67c00; }
  :root:not([data-theme="dark"]) .tag-blue { color: #0d47a1; border-color: #0d47a1; }
  :root:not([data-theme="dark"]) .tag-orange { color: #bf360c; border-color: #bf360c; }
}

.oneliner {
  font-style: italic;
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.gear-body {
  font-size: 0.9rem;
}

.gear-body h1 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.gear-body h2 { margin-top: 1.75rem; }
.gear-body h3 { font-size: 0.9rem; font-weight: 600; margin: 1rem 0 0.5rem; }

.gear-body table {
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
  width: 100%;
}

.gear-body th, .gear-body td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  text-align: left;
}

.gear-body th {
  font-weight: 600;
  background: color-mix(in srgb, var(--border) 15%, transparent);
}

.gear-body ul, .gear-body ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

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

.gear-body p { margin: 0.5rem 0; }

/* ═══ Projects ═══ */

.project-list { list-style: none; }

.project-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 30%, transparent);
}

.project-item:last-child { border-bottom: none; }
.project-item[data-status="archived"],
.project-item[data-status="inactive"] { opacity: 0.5; }

.project-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.project-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.project-status {
  font-size: 0.75rem;
  padding: 0.05rem 0.35rem;
  border-radius: 2px;
}

.project-status[data-status="active"] { color: #39936c; border: 1px solid #39936c; }
.project-status[data-status="inactive"] { color: #d50612; border: 1px solid #d50612; }
.project-status[data-status="archived"] { color: var(--muted); border: 1px solid var(--border); opacity: 0.6; }

.project-desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* ═══ Now page ═══ */

.now-date {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}

.now-section, #now-content {
  margin-bottom: 1.25rem;
}

.now-section h2, #now-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

.now-section h2:first-child, #now-content h2:first-child {
  margin-top: 0;
}

.now-section p, .now-section ul, #now-content p, #now-content ul {
  font-size: 0.9rem;
}

#now-content p + p { margin-top: 1rem; }

.now-section ul, #now-content ul {
  list-style: none;
  padding-left: 1rem;
}

.now-section li::before, #now-content li::before {
  content: '> ';
  color: var(--muted);
}

.bio blockquote, #now-content blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

/* ═══ Page header ═══ */

.page-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.page-desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* ═══ Muted helper ═══ */

.muted { color: var(--muted); }

/* ═══ Mobile ═══ */

@media (max-width: 768px) {
  body { padding-top: 0; }
  .desktop-only { display: none; }
  .layout { flex-direction: column; }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 1rem 1rem 0.75rem;
  }

  .sidebar-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding-right: 0;
    width: 100%;
    height: auto;
  }

  .sidebar-inner::after { display: none; }

  .photo-wrap {
    grid-column: 2;
    grid-row: 1;
    border-bottom: none;
    border-right: none;
    padding-bottom: 0;
    padding-right: 0;
    margin: 0;
  }

  .photo-wrap img { width: 56px; height: 56px; }

  .sidebar-name { grid-column: 1; grid-row: 1; font-size: 0.9rem; justify-self: start; }

  .mobile-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .mobile-actions .theme-toggle {
    display: block;
    margin: 0;
    text-align: right;
    width: auto;
  }

  .hamburger {
    display: block;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    font-family: var(--font);
    border-radius: 2px;
    line-height: 1;
  }

  .hamburger:hover { color: var(--accent); border-color: var(--accent); }

  nav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
  }

  .sidebar-inner.menu-open nav { display: flex; }

  nav a { font-size: 0.9rem; padding: 0.3rem 0; }

  .content {
    margin-left: 0;
    padding: 1rem;
  }

  .content-inner { min-height: auto; }

  .intro-name { font-size: 2.5rem; }
  .intro-sub { font-size: 0.7rem; white-space: nowrap; }

  .section-label { font-size: 1.3rem; }

  .post-list li { flex-direction: column; gap: 0; }
  .timeline-item { flex-direction: column; gap: 0; }

  .socials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
  }

  .socials a {
    margin-right: 0;
  }

  .socials a:nth-child(even) {
    text-align: right;
  }

  .copyright { grid-column: 1 / -1; text-align: center; }

  .gear-list {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
  }

  .gear-category { margin-bottom: 2.5rem; }
  .gear-category h2 { font-size: 1.25rem; margin-top: 1rem; margin-bottom: 0.75rem; }

  .gear-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    width: 100%;
    padding: 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 25%, transparent);
  }

  .gear-list li:nth-child(odd) { background: color-mix(in srgb, var(--border) 6%, transparent); }
  .gear-list li:nth-child(even) > *,
  .gear-list li:nth-child(even) .gear-link > * { background: none; }
  .gear-list li > *,
  .gear-list .gear-link > * { border-bottom: none; padding: 0; background: none; }

  .gear-link { display: contents; }

  .gear-list .gear-name { grid-column: 1; grid-row: 1; }
  .gear-list .gear-rating { grid-column: 2; grid-row: 1 / -1; align-self: center; padding-left: 0.75rem; border-left: 1px solid color-mix(in srgb, var(--border) 25%, transparent); }

  .gear-list .gear-desc {
    display: block;
    grid-column: 1;
    grid-row: 2;
    color: var(--muted);
    font-size: 0.8rem;
    padding-top: 0.15rem;
  }
  .gear-list .gear-desc:empty { display: none; }
  .gear-list .gear-states { grid-column: 1; grid-row: 3; padding-top: 0.3rem; }
  .gear-list .gear-states:empty { display: none; }

  .gear-cover { display: block; margin-left: auto; margin-right: auto; }
}
