/* ==========================================================================
   pwr-control.com — site stylesheet
   Light, technical, minimal. One file, no framework, no build step.
   Edit the tokens in :root to change colours and fonts site-wide.
   ========================================================================== */

:root {
  /* colours */
  --bg:        #ffffff;
  --bg-soft:   #f5f7f9;   /* section bands, figure frames */
  --line:      #e2e6ea;   /* hairlines */
  --line-dark: #c9d0d6;
  --text:      #1c2127;
  --text-2:    #4b5563;   /* secondary text */
  --text-3:    #7b8794;   /* captions, meta */
  --accent:    #0b5c8e;   /* links, primary button */
  --accent-2:  #094a72;   /* hover */
  --mark:      #e8a020;   /* small highlights (amber, as in the GitHub badge) */

  /* type */
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* layout */
  --max:   1120px;
  --gutter: 20px;
  --radius: 4px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

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

img, svg { max-width: 100%; height: auto; display: block; }

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

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; margin-top: 2.5rem; }
h3 { font-size: 1.15rem; margin-top: 1.75rem; }
p  { margin: 0 0 1em; }
code, kbd { font-family: var(--mono); font-size: 0.9em; background: var(--bg-soft); padding: 0.1em 0.35em; border-radius: 3px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* ---- containers ------------------------------------------------------- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.narrow { max-width: 760px; }

main { padding: 2.5rem 0 4rem; }

.band { background: var(--bg-soft); padding: 3rem 0; margin: 3rem 0; }
.band h2 { margin-top: 0; }

/* ---- header ----------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.02em;
}
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.brand:hover { text-decoration: none; color: var(--accent); }
.brand small { font-family: var(--sans); font-weight: 400; color: var(--text-3); font-size: 0.8rem; margin-left: 0.4rem; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.site-nav a {
  font-size: 0.92rem;
  color: var(--text-2);
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav a[aria-current="page"], .site-nav a.active { color: var(--text); border-bottom-color: var(--mark); }
.site-nav .ext::after { content: " \2197"; font-size: 0.8em; color: var(--text-3); }

/* ---- footer ----------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  color: var(--text-3);
  font-size: 0.88rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--text-2); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.2rem; flex-wrap: wrap; }

/* ---- hero ------------------------------------------------------------- */
.hero { padding: 2.5rem 0 1rem; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 0.9rem;
}
.eyebrow::before { content: ""; display: inline-block; width: 22px; height: 2px; background: var(--mark); vertical-align: middle; margin-right: 0.6rem; }
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); max-width: 18em; }
.lead { font-size: 1.15rem; color: var(--text-2); max-width: 44em; }
.cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); color: #fff; }

/* ---- section headings ------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { margin: 0; }
.section-head .more { font-size: 0.92rem; }

/* ---- card grids ------------------------------------------------------- */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-tight { gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--line-dark); box-shadow: 0 2px 10px rgba(20,30,40,0.06); text-decoration: none; color: inherit; }
.card .thumb {
  aspect-ratio: 16 / 10;
  background: #f2f2f2;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .thumb svg { width: 100%; height: 100%; }
.card .body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-2); font-size: 0.93rem; }
.card .tags { margin-top: auto; padding-top: 0.5rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
}

/* plain text cards (areas, expertise) */
.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: #fff;
  color: inherit;
}
.tile:hover { border-color: var(--line-dark); text-decoration: none; color: inherit; }
.tile h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.tile p { margin: 0; font-size: 0.92rem; color: var(--text-2); }
.tile .num { font-family: var(--mono); font-size: 0.75rem; color: var(--mark); letter-spacing: 0.08em; display: block; margin-bottom: 0.4rem; }

/* ---- project page ----------------------------------------------------- */
.crumbs { font-size: 0.85rem; color: var(--text-3); margin-bottom: 1.25rem; }
.crumbs a { color: var(--text-2); }
.crumbs span::before { content: "/"; margin: 0 0.5rem; color: var(--line-dark); }

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin-bottom: 0.4rem; }
.page-head .lead { font-size: 1.08rem; margin-bottom: 0.75rem; }

.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; align-items: start; }
.project-main { min-width: 0; }
.project-aside { position: sticky; top: 80px; }

.facts {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: var(--bg-soft);
  font-size: 0.9rem;
}
.facts h3 { margin: 0 0 0.6rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.facts dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; column-gap: 0.9rem; row-gap: 0.4rem; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }
.facts ul { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.facts li { padding: 0.3rem 0; border-top: 1px solid var(--line); }
.facts li a::after { content: " \2197"; color: var(--text-3); font-size: 0.85em; }

figure { margin: 1.5rem 0; }
figure.frame img { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
figcaption { font-size: 0.85rem; color: var(--text-3); margin-top: 0.5rem; }
.fig-row { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.fig-row figure { margin: 0.5rem 0; }

.video {
  display: flex; gap: 1rem; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; color: inherit;
}
.video:hover { border-color: var(--line-dark); text-decoration: none; color: inherit; }
.video img { width: 160px; border-radius: 3px; }
.video span { font-size: 0.92rem; }
.video small { display: block; color: var(--text-3); }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 0.92rem; }

/* ---- tables (notes) --------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; margin: 1rem 0 2rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 600; border-bottom-color: var(--line-dark); }
.table td.num { text-align: right; font-family: var(--mono); font-size: 0.85rem; color: var(--text-2); white-space: nowrap; }
.table td .sub { display: block; color: var(--text-3); font-size: 0.85rem; }
.table .pdf { font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; }

/* ---- about ------------------------------------------------------------ */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2.5rem; align-items: start; }
.stats { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.stats li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.stats b { font-family: var(--mono); font-weight: 600; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { padding: 0.35rem 0; }
.contact-list a::after { content: " \2197"; color: var(--text-3); font-size: 0.85em; }

/* ---- utilities -------------------------------------------------------- */
.muted { color: var(--text-3); }
.small { font-size: 0.88rem; }
.mono  { font-family: var(--mono); }
.mt-0 { margin-top: 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.note {
  border-left: 3px solid var(--mark);
  background: var(--bg-soft);
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  margin: 1.5rem 0;
}

/* ---- responsive ------------------------------------------------------- */
@media (max-width: 860px) {
  .project-layout, .about-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .project-aside { position: static; }
  h1 { font-size: 1.9rem; }
}
@media (max-width: 520px) {
  body { font-size: 15px; }
  .site-header .wrap { min-height: 52px; padding-top: 0.4rem; padding-bottom: 0.4rem; }
  .site-nav ul { gap: 1rem; }
  .brand small { display: none; }
  .table th:nth-child(1), .table td:nth-child(1) { display: none; } /* hide topic column on phones */
  .video img { width: 110px; }
}

@media print {
  .site-header, .site-footer, .cta, .pager { display: none; }
  a { color: inherit; }
}
