/* ===================================================================
   John Lewis - portfolio / workshop log
   Theme: "Blueprint" - locked dark. Cool slate ground, faint technical
   grid, monospaced labels, single cyan accent. No light mode.
   Single shared stylesheet for every page.
   =================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: dark;

  --bg: #0d1117;
  --bg-alt: #121a24;
  --grid-line: rgba(120, 160, 200, 0.06);

  --text: #c9d6e4;
  --text-strong: #eaf1f8;
  --text-muted: #8193a6;

  --border: #1f2c3c;
  --border-strong: #2c3f57;

  --accent: #4cc2ff;
  --accent-hover: #86d6ff;
  --accent-dim: rgba(76, 194, 255, 0.10);
  --on-accent: #04121d;

  --card-bg: #121a24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);

  --radius: 8px;
  --radius-sm: 4px;
  --max-width: 880px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  /* Faint blueprint grid */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--text);
  line-height: 1.6;
}

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

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

img {
  max-width: 100%;
}

::selection {
  background: var(--accent-dim);
  color: var(--text-strong);
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Header / nav ---------- */
header.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-title {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-strong);
}

.site-title::before {
  content: "";
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.5em;
  flex-shrink: 0;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='6' width='12' height='12' rx='1.4' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3Cpath d='M9 6V3M12 6V3M15 6V3M9 18v3M12 18v3M15 18v3M6 9H3M6 12H3M6 15H3M18 9h3M18 12h3M18 15h3' stroke='%23000' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='6' width='12' height='12' rx='1.4' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3Cpath d='M9 6V3M12 6V3M15 6V3M9 18v3M12 18v3M15 18v3M6 9H3M6 12H3M6 15H3M18 9h3M18 12h3M18 15h3' stroke='%23000' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

nav.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin: 0;
  padding: 0;
}

nav.site-nav a {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

nav.site-nav a:hover,
nav.site-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Layout ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

section {
  margin-bottom: 3rem;
}

h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.15rem;
  color: var(--text-strong);
  margin: 0 0 1.25rem;
}

/* Blueprint-style section headings on top-level sections only
   (not inside individual post articles, which keep normal case) */
main > section > h2 {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
}

main > section > h2::before {
  content: "// ";
  color: var(--text-muted);
}

#about p {
  text-align: justify;
}

.lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
}

/* ---------- Fiducial corner marks ----------
   Small cross marks in two opposite corners, echoing PCB
   fabrication fiducials. Purely decorative. */
.fiducial {
  position: relative;
}

.fiducial::before,
.fiducial::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  opacity: 0.7;
  background:
    linear-gradient(var(--border-strong) 1px, transparent 1px) center / 100% 1px no-repeat,
    linear-gradient(90deg, var(--border-strong) 1px, transparent 1px) center / 1px 100% no-repeat;
  pointer-events: none;
}

.fiducial::before {
  top: 8px;
  left: 8px;
}

.fiducial::after {
  bottom: 8px;
  right: 8px;
}

/* ---------- Tab cards on home page ---------- */
.tab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.tab-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tab-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim), 0 6px 18px rgba(0, 0, 0, 0.35);
  text-decoration: none;
}

.tab-card .tab-icon {
  display: block;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.tab-card .tab-icon svg {
  width: 100%;
  height: 100%;
}

.tab-card h3 {
  margin: 0 0 0.35rem;
  color: var(--text-strong);
  font-size: 1.15rem;
}

.tab-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Post list (tab index pages) ---------- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  counter-reset: note;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  counter-increment: note;
  transition: border-color 0.15s ease;
}

.post-card:hover {
  border-color: var(--border-strong);
}

.post-card h3 {
  margin: 0 0 0.35rem;
}

.post-card h3 a {
  color: var(--text-strong);
}

.post-card h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-card .post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.post-card .post-meta::after {
  content: " \00b7 NOTE-" counter(note, decimal-leading-zero);
  font-family: var(--font-mono);
  color: var(--accent);
}

.post-card p.excerpt {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Empty state ---------- */
.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Single post ---------- */
article.post h1 {
  margin-bottom: 0.25rem;
}

article.post .post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
}

article.post h2 {
  margin-top: 2rem;
  font-size: 1.35rem;
}

article.post pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}

article.post code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
  color: #9fd8f5;
}

article.post pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

article.post figure {
  margin: 2rem 0;
}

article.post img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

article.post figcaption {
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- File list (Files tab) ---------- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  counter-reset: pn;
}

.file-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  counter-increment: pn;
  transition: border-color 0.15s ease;
}

.file-card:hover {
  border-color: var(--border-strong);
}

.file-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
}

.file-info {
  flex: 1 1 240px;
  min-width: 0;
}

.file-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--text-strong);
}

.file-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-meta::after {
  content: " \00b7 PN-" counter(pn, decimal-leading-zero);
  font-family: var(--font-mono);
  color: var(--accent);
}

.file-download {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}

.file-download:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: var(--on-accent);
}

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 1.5rem;
}

/* ===================================================================
   Professional / CV page
   =================================================================== */

/* ---------- CV header ---------- */
.cv-header {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.cv-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.cv-header h1 {
  margin: 0 0 1rem;
}

.cv-lede {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.02rem;
}

.cv-aside {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
}

.cv-facts {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cv-facts > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cv-facts dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.cv-facts dd {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
}

.cv-skills-label {
  display: block;
  margin: 1.2rem 0 0.65rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ---------- Shared tag row ---------- */
.tag-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.tag-row li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #9fd8f5;
  background: var(--accent-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
}

/* ---------- Experience timeline ---------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.tl-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
}

.tl-period {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  padding: 0.15rem 0 0 0.9rem;
  border-left: 2px solid var(--border-strong);
}

.tl-body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  color: var(--text-strong);
}

.tl-org {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.tl-body p {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Selected projects ---------- */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  transition: border-color 0.15s ease;
}

.project:hover {
  border-color: var(--border-strong);
}

.project-media {
  position: relative;
  align-self: start;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-alt);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 14px 14px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Two stacked layers: blueprint drawing by default, photo revealed on hover.
   Falls back gracefully - if the photo can't load the blueprint stays put. */
.project-media .pm-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.project-media .pm-original {
  opacity: 0;
}

.project:hover .pm-original,
.project:focus-within .pm-original {
  opacity: 1;
}

.project:hover .pm-blueprint,
.project:focus-within .pm-blueprint {
  opacity: 0;
}

/* Contain variant - image sits inside the frame, transparent backing
   (for product shots / renders rather than edge-to-edge photos) */
.project-media--contain {
  background: transparent;
}

.project-media--contain img {
  object-fit: contain;
}

.project-media--contain .pm-layer {
  object-fit: contain;
  padding: 0.75rem;
}

/* Portrait frame for tall product shots */
.project-media--portrait {
  aspect-ratio: 3 / 4;
}

.project-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.project-head h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-strong);
}

.project-org {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent);
  white-space: nowrap;
}

.project-body > p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.project-points {
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.project-points li {
  margin-bottom: 0.25rem;
}

.project-tags {
  margin-bottom: 0.8rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.project-links a::before {
  content: "\2197  ";
}

/* ---------- Education / publications ---------- */
.entry-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
}

.entry-main h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  color: var(--text-strong);
}

.entry-org {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.entry-main p {
  margin: 0;
  color: var(--text-muted);
}

.entry-year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .cv-header {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .tl-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .tl-period {
    border-left: none;
    padding-left: 0;
  }
  .project {
    grid-template-columns: 1fr;
  }
  .project-media {
    max-width: 320px;
  }
  .entry {
    grid-template-columns: 1fr;
  }
}
