/* Abe's OpenSCAD portfolio — shared styles. Dark, clean grotesk, blue accent. */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg:        #0e0f11;
  --bg-2:      #131517;
  --surface:   #17191c;
  --surface-2: #1d2024;
  --border:    #262a2f;
  --border-2:  #313640;
  --text:      #e7e9ec;
  --text-2:    #9aa1a9;
  --text-3:    #6b727b;
  --accent:    #60a5fa;
  --accent-2:  #93c5fd;
  --accent-dim: rgba(96, 165, 250, 0.12);
  --radius:    6px;
  --maxw:      1200px;
  --font: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

/* ---------- label / mono-flavored technical type ---------- */
.label {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 16px;
  white-space: nowrap;
}
.brand .mark { flex: 0 0 auto; }
.brand .mark {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  position: relative;
}
.brand .mark::before,
.brand .mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--accent);
}
.brand .mark::before { transform: rotate(0deg); opacity: 0.35; }
.brand .mark::after  { transform: rotate(22.5deg); }
.brand .sub { color: var(--text-3); font-weight: 500; }
.topbar nav {
  display: flex; gap: 26px; align-items: center;
}
.topbar nav a {
  font-size: 13.5px;
  color: var(--text-2);
  transition: color 0.15s ease;
}
.topbar nav a:hover { color: var(--text); }

/* ---------- hero / intro ---------- */
.hero { padding: 72px 0 40px; border-bottom: 1px solid var(--border); }
.hero .eyebrow { margin-bottom: 18px; }
.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  max-width: 16ch;
}
.hero p {
  margin: 20px 0 0;
  max-width: 58ch;
  color: var(--text-2);
  font-size: 17px;
}
.hero .meta {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  align-items: center;
}
.hero .meta .label { color: var(--text-2); }

/* ---------- grid ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 46px 0 22px;
  gap: 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-head .count { color: var(--text-3); font-size: 13.5px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
  padding-bottom: 80px;
}

/* ---------- card ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.card:hover {
  border-color: var(--border-2);
  transform: translateY(-3px);
  background: var(--surface-2);
}
.card .thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.18s ease;
}
.card:hover .thumb img { transform: scale(1.035); }
.card .thumb .imgcount {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(8, 9, 10, 0.62);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px;
}
.card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.card .body h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card .body h3 .arrow {
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.card:hover .body h3 .arrow { opacity: 1; transform: translateX(0); }
.card .body p {
  margin: 9px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}
.cardmeta {
  margin-top: 13px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  color: var(--text-3);
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.tag {
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-2);
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--border);
  padding: 34px 0 60px;
  color: var(--text-3);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- about / credentials ---------- */
.about-wrap { max-width: 820px; margin: 0 auto; padding: 14px 32px 60px; }
.about-lead {
  color: var(--text-2);
  font-size: 16.5px;
  line-height: 1.75;
  margin: 0;
  text-wrap: pretty;
}
.creds {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px 28px;
  align-items: start;
}
.creds-label { padding-top: 3px; }
.creds-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.creds-list li {
  color: var(--text);
  font-size: 15px;
  padding-left: 18px;
  position: relative;
}
.creds-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
}

/* ---------- other work ---------- */
#other { padding-bottom: 26px; }
.ow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.ow-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
a.ow-card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.ow-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ow-title { font-size: 16.5px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.ow-link {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  transition: color 0.18s ease;
}
a.ow-card:hover .ow-link { color: var(--accent); }
.ow-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ---------- contact ---------- */
#contact { padding-bottom: 90px; }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
a.contact-card:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.contact-v {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}
a.contact-card:hover .contact-v { color: var(--accent-2); }

@media (max-width: 560px) {
  .creds { grid-template-columns: 1fr; gap: 12px; }
}

/* ============ DETAIL PAGE ============ */
.detail { padding: 44px 0 90px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  margin-bottom: 30px;
  transition: color 0.15s ease, gap 0.15s ease;
}
.back:hover { color: var(--text); gap: 11px; }

.detail-head { margin-bottom: 30px; }
.detail-head .eyebrow { margin-bottom: 14px; }
.detail-head h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.025em;
  line-height: 1.08;
  font-weight: 700;
}
.detail-head p {
  margin: 14px 0 0;
  max-width: 64ch;
  color: var(--text-2);
  font-size: 17px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.92fr);
  gap: 48px;
  align-items: start;
}

/* gallery */
.gallery { min-width: 0; }
.stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stage img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.stage img.active { opacity: 1; }
.stage .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: rgba(8, 9, 10, 0.55);
  border: 1px solid rgba(255,255,255,0.09);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.stage .nav:hover { background: rgba(8,9,10,0.8); border-color: var(--accent); }
.stage .nav.prev { left: 14px; }
.stage .nav.next { right: 14px; }
.stage .counter {
  position: absolute;
  bottom: 14px; left: 14px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--text);
  padding: 5px 10px;
  background: rgba(8,9,10,0.6);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px;
  backdrop-filter: blur(4px);
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.thumbs button {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-2);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  transition: border-color 0.15s ease, opacity 0.15s ease;
  opacity: 0.6;
}
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button:hover { opacity: 0.85; }
.thumbs button.active { opacity: 1; border-color: var(--accent); }

/* info column */
.info { position: sticky; top: 88px; }
.specs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.specs .row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.specs .row:last-child { border-bottom: 0; }
.specs .row .k { color: var(--text-3); white-space: nowrap; flex: 0 0 auto; }
.specs .row .v { color: var(--text); text-align: right; font-weight: 500; flex: 1 1 auto; min-width: 0; }

/* meta line under title (mono technical provenance) */
.metaline {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
.metaline i { width: 4px; height: 4px; border-radius: 999px; background: var(--border-2); display: inline-block; }

/* customizer parameters panel */
.params {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.params .prow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.params .prow:last-child { border-bottom: 0; }
.params .pk {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--accent-2);
  letter-spacing: -0.01em;
}
.params .pv {
  color: var(--text-2);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
  text-align: right;
  white-space: nowrap;
}
.params-note {
  margin-top: 9px;
  font-size: 12px;
  color: var(--text-3);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.01em;
}

/* gallery caption */
.caption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.01em;
  min-height: 18px;
}

.info .tags { margin-top: 18px; }

.about { margin-top: 30px; }
.about h3 {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  margin: 0 0 14px;
}
.about p {
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.7;
}
.about p:first-of-type { color: var(--text); }

/* prev/next other projects */
.more { margin-top: 70px; border-top: 1px solid var(--border); padding-top: 30px; }

/* ---------- OpenSCAD source block ---------- */
.source { margin-top: 64px; }
.source-head { margin-bottom: 16px; }
.source-head .source-sub {
  margin-top: 7px;
  color: var(--text-3);
  font-size: 14px;
}
.code-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0c0d0f;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.code-head .fname {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
}
.code-head .fname svg { color: var(--text-3); }
.chead-right { display: flex; align-items: center; gap: 14px; }
.code-head .ctag {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.copy-btn {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.ok { color: var(--accent-2); border-color: var(--accent); }

.code-body {
  margin: 0;
  padding: 18px 0;
  overflow-x: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 4;
}
.code-body code { display: block; min-width: max-content; }
.code-body .cl {
  display: block;
  padding: 0 22px 0 0;
  white-space: pre;
}
.code-body .lno {
  display: inline-block;
  width: 30px;
  margin-right: 18px;
  padding-right: 12px;
  text-align: right;
  color: #565d67;
  border-right: 1px solid var(--border);
  user-select: none;
}
.code-body .cl:hover { background: rgba(255,255,255,0.018); }
/* syntax tokens */
.t-cmt { color: #5b636d; font-style: italic; }
.t-str { color: #8fc7a0; }
.t-var { color: #93c5fd; }
.t-kw  { color: #b79cf0; }
.t-fn  { color: var(--accent); }
.t-num { color: #e0a872; }

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; gap: 34px; }
  .info { position: static; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 20px; }
  .topbar nav { gap: 16px; }
  .grid { grid-template-columns: 1fr; }
}
