/* ════════════════════════════════════════════════
   MECHANICAL ENGINEER PERSONAL SITE
   Font: Share Tech Mono (ISO 3098 DNA)
   Two modes: NGHT (default) · DAY
   ════════════════════════════════════════════════ */

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

/* ── DARK THEME (default) ────────────────────── */
:root,
[data-theme="dark"] {
  --bg:           #000000;
  --bg-surface:   #0a0a0a;
  --border:       #1c1c1c;
  --border-mid:   #2a2a2a;
  --text:         #e8e0c8;
  --text-soft:    #6e6860;
  --text-faint:   #353028;
  --gold:         #b8a868;
  --gold-dim:     #6a5c30;

  /* SVG placeholder tokens — dark */
  --ph-bg:        #080808;
  --ph-s1:        #141414;
  --ph-s2:        #101010;
  --ph-stroke:    #222222;
  --ph-stroke2:   #2a2a2a;
  --ph-stroke3:   #383838;
  --ph-grid:      #101018;
  --ph-highlight: rgba(232,224,200,0.07);
  --ph-dim:       rgba(184,168,104,0.35);
  --ph-dim-bright:rgba(184,168,104,0.6);
  --ph-cl:        rgba(232,224,200,0.1);
  --ph-caption:   rgba(232,224,200,0.18);

  /* Frame furniture opacity */
  --frame-opacity: 0.22;
  --tblock-opacity: 0.32;
}

/* ── LIGHT THEME ─────────────────────────────── */
[data-theme="light"] {
  --bg:           #f4f0e8;       /* aged drafting paper */
  --bg-surface:   #ede8df;
  --border:       #c8c0b0;
  --border-mid:   #b0a898;
  --text:         #1a1810;
  --text-soft:    #6a6050;
  --text-faint:   #a09880;
  --gold:         #7a6820;       /* ink on paper */
  --gold-dim:     #b0a060;

  /* SVG placeholder tokens — light (blueprint / paper drawing feel) */
  --ph-bg:        #ede8df;
  --ph-s1:        #ddd8ce;
  --ph-s2:        #d4cfc5;
  --ph-stroke:    #b0a898;
  --ph-stroke2:   #988878;
  --ph-stroke3:   #888070;
  --ph-grid:      #c8c0b0;
  --ph-highlight: rgba(26,24,16,0.06);
  --ph-dim:       rgba(100,80,20,0.5);
  --ph-dim-bright:rgba(80,60,10,0.8);
  --ph-cl:        rgba(26,24,16,0.15);
  --ph-caption:   rgba(26,24,16,0.3);

  --frame-opacity: 0.3;
  --tblock-opacity: 0.45;
}

/* ── TRANSITIONS on theme swap ───────────────── */
body,
.theme-toggle,
.tg-box,
.tg-track,
.title-block,
.scale-block,
.corner::before,
.corner::after,
body::before {
  transition:
    background-color 0.35s ease,
    background 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    opacity 0.35s ease;
}

/* ── BASE ────────────────────────────────────── */
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100svh;
  overflow-x: hidden;
}

a { color: var(--text); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--gold); }
em { font-style: italic; }

/* ── DRAWING FRAME ───────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0.75rem;
  border: 1px solid var(--border);
  pointer-events: none; z-index: 99;
  opacity: var(--frame-opacity);
}

/* Corner crosshair marks */
.corner {
  position: fixed; width: 18px; height: 18px;
  pointer-events: none; z-index: 100;
  opacity: var(--frame-opacity);
}
.corner::before, .corner::after {
  content: ''; position: absolute; background: var(--text);
}
.corner::before { width: 1px; height: 100%; left: 50%; top: 0; }
.corner::after  { width: 100%; height: 1px; top: 50%; left: 0; }
.corner--tl { top: 1.5rem; left: 1.5rem; }
.corner--tr { top: 1.5rem; right: 1.5rem; }
.corner--bl { bottom: 1.5rem; left: 1.5rem; }
.corner--br { bottom: 1.5rem; right: 1.5rem; }

/* ── TITLE BLOCK ─────────────────────────────── */
.title-block {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  z-index: 101; pointer-events: none;
  display: flex; flex-direction: column; gap: 0.2rem;
  opacity: var(--tblock-opacity);
}
.scale-block {
  position: fixed; bottom: 1.5rem; left: 1.5rem;
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  z-index: 101; pointer-events: none;
  display: flex; gap: 0.5rem;
  font-size: 0.6rem; opacity: var(--tblock-opacity);
}
.tb-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.58rem; line-height: 1; }
.tb-label { color: var(--text-faint); letter-spacing: 0.08em; min-width: 2.2rem; }
.tb-value { color: var(--text-soft); letter-spacing: 0.05em; }

/* ── THEME TOGGLE ────────────────────────────────────────────────
   Styled as an engineering drawing annotation callout bubble.
   Top-right of viewport. The box is the note, the leader line
   points inward like a dimension annotation.
   ─────────────────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 1.5rem; right: 1.5rem;
  z-index: 200;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  /* Nudge so it clears the frame border */
  margin-top: 0.6rem;
  margin-right: 0.6rem;
}

/* The annotation box */
.tg-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border-mid);
  background: var(--bg);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover .tg-box {
  border-color: var(--gold);
  color: var(--text);
}

/* Mode labels either side of the track */
.tg-mode-label { user-select: none; }

/* The track — like a tolerance band */
.tg-track {
  width: 28px; height: 12px;
  border: 1px solid var(--border-mid);
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.3s;
}
.theme-toggle:hover .tg-track { border-color: var(--gold-dim); }

/* The thumb — sliding reference marker */
.tg-thumb {
  position: absolute;
  top: 1px; left: 1px;
  width: 8px; height: 8px;
  background: var(--text-soft);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), background 0.3s;
}
[data-theme="light"] .tg-thumb {
  transform: translateX(16px);
  background: var(--gold);
}

/* Leader line from box to the frame — cosmetic only */
.tg-leader {
  display: block;
  width: 10px; height: 1px;
  background: var(--border-mid);
  opacity: 0.6;
}
/* Terminal dot — like an arrowless leader termination */
.tg-dot {
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--border-mid);
  opacity: 0.6;
}

/* ── SITE SHELL ──────────────────────────────── */
.site-shell {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100svh;
  padding: 3rem 2rem 5rem;
}

/* ── NAV ─────────────────────────────────────── */
.site-nav {
  display: flex; gap: 2.5rem;
  margin-bottom: 4rem;
  flex-wrap: wrap; justify-content: center;
}
.nav-link {
  font-size: 0.78rem; letter-spacing: 0.1em;
  color: var(--text-soft);
  position: relative; padding-bottom: 0.2rem;
  transition: color 0.2s;
}
.nav-link::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; width: 0; height: 1px;
  background: var(--gold);
  transition: width 0.25s cubic-bezier(0.16,1,0.3,1);
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after, .nav-link:hover::after { width: 100%; }

/* ── PAGE TRANSITIONS ────────────────────────── */
.page-container {
  width: 100%; max-width: 700px; flex: 1;
}
.page.fade-in  { animation: pgIn  0.32s cubic-bezier(0.16,1,0.3,1) forwards; }
.page.fade-out { animation: pgOut 0.28s cubic-bezier(0.4,0,1,1) forwards; }
@keyframes pgIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes pgOut { from { opacity:1; transform:none; } to { opacity:0; transform:translateY(-6px); } }

/* ── HOME ────────────────────────────────────── */
.callout-block {
  display: flex; align-items: center; gap: 1.25rem;
  margin-bottom: 0.5rem;
}
.callout-arrow--left, .callout-arrow--right {
  flex: 1; height: 1px; background: var(--border-mid); position: relative;
}
.callout-arrow--left::before {
  content: ''; position: absolute; right: -1px; top: -3px;
  border: 3px solid transparent;
  border-right: 5px solid var(--border-mid); border-left: none;
}
.callout-arrow--right::after {
  content: ''; position: absolute; left: -1px; top: -3px;
  border: 3px solid transparent;
  border-left: 5px solid var(--border-mid); border-right: none;
}
.display-name {
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  font-weight: 400; letter-spacing: 0.18em;
  color: var(--text); white-space: nowrap; text-transform: uppercase;
}

/* Dimension line under name */
.dim-callout {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2.5rem;
}
.dim-line {
  flex: 1; height: 1px; background: var(--gold); opacity: 0.28;
  position: relative;
}
.dim-line::before, .dim-line::after {
  content: ''; position: absolute;
  width: 1px; height: 6px; background: var(--gold); opacity: 0.5; top: -3px;
}
.dim-line::before { left: 0; } .dim-line::after { right: 0; }
.dim-text {
  font-size: 0.62rem; letter-spacing: 0.22em;
  color: var(--gold); white-space: nowrap; opacity: 0.65;
}

/* Body text */
.body-text {
  font-family: 'Share Tech', 'Share Tech Mono', monospace;
  font-size: 0.95rem; line-height: 1.8;
  color: var(--text-soft); max-width: 520px;
}
.body-text p { margin-bottom: 1.1rem; }
.body-text a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-mid); }
.body-text a:hover { color: var(--gold); text-decoration-color: var(--gold); }

/* Spec table — tolerance annotation style */
.spec-table {
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}
.spec-row {
  display: grid; grid-template-columns: 7.5rem 3.5rem 1fr;
  align-items: center; gap: 0.75rem;
  padding: 0.42rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.spec-row:last-child { border-bottom: none; }
.spec-key {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem; color: var(--text-faint); letter-spacing: 0.08em;
}
.spec-tol {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68rem; color: var(--gold); opacity: 0.75;
  text-align: center; letter-spacing: 0.02em;
}
.spec-val {
  font-family: 'Share Tech', monospace;
  font-size: 0.85rem; color: var(--text);
}

/* ── PAGE HEADER ─────────────────────────────── */
.page-header {
  display: flex; align-items: baseline; gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.page-ref { font-size: 0.6rem; color: var(--text-faint); letter-spacing: 0.12em; }
.page-title {
  font-size: 0.75rem; font-weight: 400;
  letter-spacing: 0.22em; color: var(--text-soft);
}
.page-subtitle {
  font-family: 'Share Tech', monospace;
  font-size: 0.88rem; color: var(--text-soft);
  margin-bottom: 1.5rem;
}
.now-rev { margin-left: auto; font-size: 0.6rem; color: var(--text-faint); letter-spacing: 0.1em; }

/* ── ENTRY LIST (blog) ───────────────────────── */
.entry-list { list-style: none; border-top: 1px solid var(--border); }
.entry-item  { border-bottom: 1px solid var(--border); }
.entry-link {
  display: grid; grid-template-columns: 2.2rem 1fr auto;
  align-items: baseline; gap: 0.85rem;
  padding: 0.75rem 0.4rem;
  color: var(--text-soft);
  font-family: 'Share Tech', monospace; font-size: 0.9rem;
  transition: color 0.15s, background 0.15s;
}
.entry-link:hover { color: var(--text); background: rgba(232,224,200,0.025); }
[data-theme="light"] .entry-link:hover { background: rgba(26,24,16,0.03); }
.entry-num  { font-family: 'Share Tech Mono', monospace; font-size: 0.62rem; color: var(--text-faint); letter-spacing: 0.05em; }
.entry-meta { font-family: 'Share Tech Mono', monospace; font-size: 0.62rem; color: var(--text-faint); letter-spacing: 0.08em; white-space: nowrap; }

/* ── PHOTO GRID ──────────────────────────────── */
.photo-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); margin-top: 0.5rem;
}
.photo-fig {
  display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden; position: relative;
}
.photo-fig::before {
  content: attr(data-ref);
  position: absolute; top: 0.45rem; left: 0.45rem;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.56rem; color: var(--text-faint);
  letter-spacing: 0.08em; opacity: 0;
  transition: opacity 0.2s; z-index: 2;
}
.photo-fig:hover::before { opacity: 1; }
.photo-slot { overflow: hidden; }
.ph-svg { width: 100%; height: auto; display: block; transition: opacity 0.2s; }
.photo-fig:hover .ph-svg { opacity: 0.85; }
.photo-cap {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.58rem; color: var(--text-faint);
  letter-spacing: 0.08em; padding: 0.45rem 0.65rem;
  border-top: 1px solid var(--border); text-transform: uppercase;
}

/* ── PROJECTS ────────────────────────────────── */
.project-list { border-top: 1px solid var(--border); }
.project-entry {
  padding: 1.5rem 0; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.project-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.project-num { font-size: 0.62rem; color: var(--text-faint); letter-spacing: 0.08em; }
.project-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.82rem; font-weight: 400; letter-spacing: 0.14em;
  color: var(--text); flex: 1;
}
.project-status {
  font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border-mid); color: var(--text-faint);
}
.status--active  { border-color: #2a4a2e; color: #5a8a5a; }
.status--archived { opacity: 0.45; }
.project-desc {
  font-family: 'Share Tech', monospace;
  font-size: 0.88rem; color: var(--text-soft); line-height: 1.7; max-width: 540px;
}
.project-links { display: flex; gap: 1.5rem; font-size: 0.72rem; letter-spacing: 0.05em; }
.project-links a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-mid); }
.project-links a:hover { color: var(--gold); text-decoration-color: var(--gold); }

/* ── NOW PAGE ────────────────────────────────── */
.now-list { border-top: 1px solid var(--border); }
.now-entry {
  display: grid; grid-template-columns: 5.5rem 1fr;
  gap: 1.25rem; padding: 1.1rem 0;
  border-bottom: 1px solid var(--border); align-items: start;
}
.now-label {
  font-size: 0.6rem; letter-spacing: 0.12em;
  color: var(--text-faint); padding-top: 0.15rem;
}
.now-body-text {
  font-family: 'Share Tech', monospace;
  font-size: 0.9rem; color: var(--text-soft); line-height: 1.75;
}
.now-body-text p { margin-bottom: 0.5rem; }
.now-body-text p:last-child { margin-bottom: 0; }
.now-body-text a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-mid); }
.now-body-text a:hover { color: var(--gold); }
.now-note { margin-top: 1.75rem; font-size: 0.62rem; color: var(--text-faint); letter-spacing: 0.05em; }
.now-note a { color: var(--text-faint); }

/* ── FOOTER ──────────────────────────────────── */
.site-footer {
  margin-top: 4rem; width: 100%; max-width: 700px;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 0.75rem;
}
.footer-socials { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.social-link { font-size: 0.7rem; letter-spacing: 0.1em; color: var(--text-soft); transition: color 0.15s; }
.social-link:hover { color: var(--gold); }
.footer-sep { color: var(--text-faint); font-size: 0.7rem; user-select: none; }
.footer-copy { font-size: 0.6rem; letter-spacing: 0.1em; color: var(--text-faint); }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 660px) {
  body::before { inset: 0.5rem; }
  .corner--tl { top: 1rem; left: 1rem; }
  .corner--tr { top: 1rem; right: 1rem; }
  .corner--bl { bottom: 1rem; left: 1rem; }
  .corner--br { bottom: 1rem; right: 1rem; }
  .title-block, .scale-block { display: none; }

  .site-shell { padding: 2rem 1.25rem 4rem; }
  .site-nav { gap: 1.5rem; margin-bottom: 3rem; }
  .photo-grid { grid-template-columns: repeat(2,1fr); }
  .now-entry { grid-template-columns: 4.5rem 1fr; gap: 0.85rem; }
  .spec-row  { grid-template-columns: 6rem 3rem 1fr; }

  /* Toggle on mobile — pull it in from the edge */
  .theme-toggle { top: 1rem; right: 1rem; }
  .tg-leader, .tg-dot { display: none; }
}

@media (max-width: 400px) {
  .photo-grid { grid-template-columns: 1fr; }
  .callout-arrow--left, .callout-arrow--right { display: none; }
  .callout-block { justify-content: center; }
  .site-nav { gap: 1rem; }
}
