/* ==========================================================================
   chordasewell.com — one stylesheet for the whole site.
   To change the look, edit the colors in :root below. Everything else
   just uses those variables.
   ========================================================================== */

/* ---- Font files (IBM Plex Mono, served from assets/fonts/) -------------- */
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-600.woff2") format("woff2");
}

/* ---- Colors & fonts (light mode) ---------------------------------------- */
:root {
  --bg:        #f7f6f1;   /* page background, off-white "paper" */
  --panel:     #ffffff;   /* inside of boxes */
  --ink:       #1d1f21;   /* main text */
  --muted:     #5f646b;   /* secondary text, dates, labels */
  --rule:      #d6d3c8;   /* borders and lines */
  --accent:    #0e6b6b;   /* links, headings bar — deep teal */
  --accent-bg: #e4efed;   /* light tint of the accent for box headers */
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Dark mode (follows the visitor's system setting) ------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #15181b;
    --panel:     #1c2024;
    --ink:       #e4e2dc;
    --muted:     #9aa0a6;
    --rule:      #343a40;
    --accent:    #5cc2b8;
    --accent-bg: #1f2e2d;
  }
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

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

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

h1, h2, h3 { font-family: var(--mono); line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }

code, pre { font-family: var(--mono); font-size: 0.85em; }
pre {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 0.75rem 1rem;
  overflow-x: auto;
}

/* Page width and side margins */
.wrap { max-width: 780px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* ---- Header & navigation ------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}
.site-name {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.site-nav { font-family: var(--mono); font-size: 0.9rem; }
.site-nav a { margin-right: 1rem; text-decoration: none; }
.site-nav a:last-child { margin-right: 0; }
.site-nav a:hover, .site-nav a[aria-current] { text-decoration: underline; }

main { padding: 2rem 0 3rem; }

/* ---- Boxes (the QRZ-style bordered panels) ------------------------------ */
.box {
  background: var(--panel);
  border: 1px solid var(--rule);
  margin: 0 0 1.5rem;
}
.box-title {
  margin: 0;
  padding: 0.4rem 0.9rem;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.box-body { padding: 1rem 0.9rem; }
.box-body > :first-child { margin-top: 0; }
.box-body > :last-child { margin-bottom: 0; }

/* ---- Home: info card ----------------------------------------------------- */
.info-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.info-card img {
  width: 160px;
  border: 1px solid var(--rule);
  display: block;
}

/* Key/value table, used on the home page and on write-up pages */
.facts { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.facts th, .facts td {
  text-align: left;
  vertical-align: top;
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--rule);
}
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts th {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--muted);
  width: 8.5rem;
  padding-right: 1rem;
  white-space: nowrap;
}

/* ---- Home: link groups --------------------------------------------------- */
.link-group { margin: 0 0 1rem; }
.link-group:last-child { margin-bottom: 0; }
.link-group h3 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.5rem;
}
.links a {
  display: block;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  text-decoration: none;
  color: var(--ink);
  line-height: 1.3;
}
.links a:hover { border-color: var(--accent); }
.links strong { display: block; color: var(--accent); font-weight: 600; }
.links small { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

/* ---- Featured work cards ------------------------------------------------- */
.cards { display: grid; gap: 1rem; }
.card {
  display: block;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.card .title { display: block; font-weight: 600; color: var(--accent); margin: 0.15rem 0 0.3rem; }
.card p { margin: 0; font-size: 0.95rem; }

/* ---- Log / dated lists --------------------------------------------------- */
.log { list-style: none; margin: 0; padding: 0; }
.log li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--rule);
}
.log li:last-child { border-bottom: 0; }
.log time, .log .date { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }

/* ---- Publication list (IEEE-style references, [J1], [C1], ...) ----------- */
.refs { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.refs li {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0;
}
.refs .tag { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); padding-top: 0.1rem; }
.refs a { overflow-wrap: anywhere; }

/* ---- Write-up pages ------------------------------------------------------ */
.lede { font-size: 1.05rem; color: var(--muted); margin-top: 0; }
figure { margin: 1.5rem 0; }
figure img { border: 1px solid var(--rule); background: #fff; }
figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; }
.todo {
  border: 1px dashed var(--muted);
  padding: 0.6rem 0.9rem;
  color: var(--muted);
  font-style: italic;
}
/* Two pictures side by side in one figure (stacks on phones) */
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.fig-pair img { display: block; width: 100%; }

/* Picture placeholder inside a figure (replace with an <img>) */
figure .todo {
  min-height: 10rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.back { font-family: var(--mono); font-size: 0.85rem; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 2rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- Phones -------------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .info-card { grid-template-columns: 1fr; }
  .info-card img { width: 128px; }
  .facts th { width: 6.5rem; }
  .log li { grid-template-columns: 1fr; gap: 0; }
  .fig-pair { grid-template-columns: 1fr; }
}
