/* SA7KZA — amateur radio engineering site
   --bg #15181a  --panel #1b1f22  --line #2c3236
   --text #e8e4d9  --muted #8b9296
   --amber #d98e3f (primary accent)  --teal #5fa8a0 (secondary accent)
   Type: 'JetBrains Mono' for display/labels, 'Inter' for body
*/

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #15181a;
  --panel: #1b1f22;
  --line: #2c3236;
  --text: #e8e4d9;
  --muted: #8b9296;
  --amber: #d98e3f;
  --teal: #5fa8a0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
a.section-link { color: var(--teal); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
img { max-width: 100%; display: block; }
.mono { font-family: 'JetBrains Mono', monospace; }

.wrap-full {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Top bar: only Home + Contact ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.site-header .wrap-full {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.callsign {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--text);
}
.callsign span { color: var(--amber); }
.header-right { display: flex; align-items: center; gap: 24px; }
.site-header nav { display: flex; gap: 24px; }
.site-header nav a {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-header nav a:hover, .site-header nav a.active { color: var(--teal); text-decoration: none; }

.lang-switch { display: flex; align-items: center; gap: 10px; padding-left: 20px; border-left: 1px solid var(--line); }
.lang-switch a {
  display: block;
  line-height: 0;
  border-radius: 2px;
  overflow: hidden;
  filter: grayscale(70%);
  opacity: 0.45;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
  transition: opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.lang-switch a svg { display: block; }
.lang-switch a:hover { opacity: 0.85; filter: grayscale(15%); }
.lang-switch a.active { opacity: 1; filter: none; box-shadow: 0 0 0 1px var(--amber); }

/* ---------- Layout: sidebar + content ---------- */
.layout {
  display: flex;
  gap: 44px;
  align-items: flex-start;
  padding-top: 36px;
}
.sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 28px;
}
.sidebar-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 12px;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--line);
}
.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav a {
  display: block;
  padding: 10px 14px;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}
.sidebar-nav a:hover {
  color: var(--text);
  border-left-color: var(--line);
  background: var(--panel);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: var(--text);
  border-left-color: var(--line);
  background: var(--panel);
}

.sidebar-parent-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  background: none;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.sidebar-parent-btn:hover {
  color: var(--text);
  border-left-color: var(--line);
  background: var(--panel);
}
.sidebar-parent-item.open .sidebar-parent-btn { color: var(--text); }
.sidebar-parent-btn .chevron { flex-shrink: 0; transition: transform 0.15s ease; }
.sidebar-parent-item.open .chevron { transform: rotate(180deg); }

.sidebar-submenu {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.sidebar-parent-item.open .sidebar-submenu { display: flex; }
.sidebar-submenu a {
  display: block;
  padding: 8px 14px 8px 28px;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.sidebar-submenu a:hover {
  color: var(--text);
  border-left-color: var(--line);
  background: var(--panel);
  text-decoration: none;
}
.sidebar-submenu a.active {
  color: var(--text);
  border-left-color: var(--line);
  background: var(--panel);
}
.content { flex: 1; min-width: 0; padding-bottom: 60px; }

/* ---------- Hero / page intro ---------- */
.hero { padding-bottom: 28px; }
.hero .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.hero h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.08;
  margin: 0 0 16px;
}
.hero h1 span { color: var(--amber); }
.hero p.lead { max-width: 600px; color: var(--muted); font-size: 17px; }

.trace {
  width: 100%;
  height: 16px;
  margin: 36px 0;
  display: block;
}

section { padding: 4px 0 36px; }
h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 18px;
}
h2::before { content: "// "; color: var(--line); }
p { color: var(--text); }
p.muted { color: var(--muted); }

blockquote {
  border-left: 3px solid var(--teal);
  background: var(--panel);
  margin: 8px 0 24px;
  padding: 12px 18px;
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
}

/* ---------- Photo gallery (home QTH photos, project galleries) ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.gallery .photo-placeholder { margin: 0; }

.photo-placeholder {
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: var(--panel);
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin: 8px 0 24px;
}
.photo-placeholder .ratio { aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }

/* Variant for tall/narrow diagrams that shouldn't be forced into a 16:10 box */
.photo-placeholder.diagram { padding: 12px 16px; }

/* Smaller, centered standalone photo (roughly 2/3 of the normal width) */
.photo-placeholder.small { max-width: 66%; margin-left: auto; margin-right: auto; }
.photo-placeholder.small-50 { max-width: 50%; margin-left: auto; margin-right: auto; }
.photo-placeholder.small-25 { max-width: 25%; margin-left: auto; margin-right: auto; }

/* ---------- Project page ---------- */
.project-hero { padding: 0 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.project-hero .tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 2px;
  padding: 3px 10px;
  margin-bottom: 14px;
}
.project-hero h1 { font-family: 'JetBrains Mono', monospace; font-size: clamp(28px, 4.5vw, 40px); margin: 0 0 12px; }
.project-hero p.lead { color: var(--muted); font-size: 16px; max-width: 600px; }

.specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 24px 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.specs div .k { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.specs div .v { font-size: 14px; color: var(--text); }

.downloads { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--amber);
  border: none;
  border-radius: 3px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: var(--teal); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.btn.ghost:hover { background: var(--teal); color: var(--bg); }

/* ---------- STL 3D viewer ---------- */
.stl-viewer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.stl-viewer-grid .stl-viewer-wrap { margin: 0; }
.stl-viewer-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 8px 0 24px;
  overflow: hidden;
}
.stl-viewer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.stl-viewer-label .stl-filename { color: var(--muted); text-transform: none; letter-spacing: 0; font-size: 11px; }
.stl-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 480px;
  cursor: grab;
}
.stl-viewer:active { cursor: grabbing; }
.stl-viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.stl-viewer-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
.stl-viewer-hint {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

ul.changelog { list-style: none; padding: 0; margin: 0; }
ul.changelog li { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
ul.changelog li:last-child { border-bottom: none; }
ul.changelog .ver { font-family: 'JetBrains Mono', monospace; color: var(--amber); min-width: 70px; }
ul.changelog .desc { color: var(--muted); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 24px 0 40px; margin-top: 20px; }
footer p { color: var(--muted); font-size: 13px; font-family: 'JetBrains Mono', monospace; }

/* ---------- Guestbook (contact.php) ---------- */
#gb-honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; }

.gb-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .gb-fields { grid-template-columns: 1fr; } }

.gb-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.gb-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.gb-field input, .gb-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.15s;
}
.gb-field input::placeholder, .gb-field textarea::placeholder { color: var(--muted); opacity: 0.6; }
.gb-field input:focus, .gb-field textarea:focus { outline: none; border-color: var(--teal); }
.req { color: var(--amber); }
.gb-charcount { font-size: 11px; color: var(--muted); text-align: right; font-family: 'JetBrains Mono', monospace; }

.gb-notice {
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 18px;
  font-family: 'JetBrains Mono', monospace;
}
.gb-error { background: rgba(217, 94, 63, 0.08); color: #e2775a; border: 1px solid rgba(217, 94, 63, 0.35); }
.gb-ok { background: rgba(95, 168, 160, 0.1); color: var(--teal); border: 1px solid rgba(95, 168, 160, 0.35); }

.btn:disabled, .btn[disabled] { background: var(--muted); color: var(--bg); cursor: not-allowed; opacity: 0.7; }

.gb-messages { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.gb-msg {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px 18px;
}
.gb-msg--admin { border-color: var(--amber); background: rgba(217, 142, 63, 0.06); }
.gb-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 16px;
  flex-wrap: wrap;
}
.gb-msg-name { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 14px; color: var(--text); }
.gb-msg-date { font-size: 12px; color: var(--muted); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.gb-msg-body { font-size: 15px; line-height: 1.7; color: var(--text); white-space: pre-wrap; }
.gb-admin-badge {
  display: inline-block;
  background: var(--amber);
  color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .layout { flex-direction: column; gap: 24px; padding-top: 24px; }
  .sidebar { width: 100%; position: static; }
  .sidebar-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: visible; align-items: flex-start; gap: 8px; padding-bottom: 4px; }
  .sidebar-nav a { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; border-radius: 3px 3px 0 0; }
  .sidebar-nav a.active, .sidebar-nav a:hover { border-left: none; border-bottom-color: var(--line); }
  .sidebar-parent-item { display: flex; flex-direction: column; flex-shrink: 0; }
  .sidebar-parent-btn { white-space: nowrap; }
  .sidebar-submenu { margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 4px; min-width: 190px; }
  .sidebar-submenu a { border-left: none; border-radius: 3px; padding: 8px 10px; white-space: nowrap; }
  .sidebar-submenu a.active, .sidebar-submenu a:hover { border-left: none; }
  .site-header nav { gap: 16px; }
}
