/* ============================================================
   cgurbani.in — engineering notebook meets modern SaaS
   Dark by default; light theme via [data-theme="light"]
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root,
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-raised: #151b23;
  --bg-inset: #10151c;
  --border: #2a3441;
  --border-soft: #1e2733;
  --text: #e6e8eb;
  --text-dim: #9aa4b2;
  --text-faint: #6b7684;
  --accent: #fbbf24;          /* amber */
  --accent-strong: #f59e0b;
  --accent-ink: #1a1204;      /* text on accent */
  --accent-soft: rgba(251, 191, 36, 0.12);
  --grid-line: rgba(154, 164, 178, 0.14);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --wave: #fbbf24;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #fafaf7;
  --bg-raised: #ffffff;
  --bg-inset: #f1f1ec;
  --border: #d9d9d2;
  --border-soft: #e6e6df;
  --text: #1c2128;
  --text-dim: #4b5563;
  --text-faint: #8a919c;
  --accent: #b45309;          /* darker amber for contrast on light bg */
  --accent-strong: #92400e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(180, 83, 9, 0.10);
  --grid-line: rgba(28, 33, 40, 0.10);
  --shadow: 0 8px 24px rgba(28, 33, 40, 0.08);
  --wave: #b45309;
  color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
h3 { font-size: 1.25rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.accent { color: var(--accent); }

.container {
  width: min(1120px, 100% - 3rem);
  margin-inline: auto;
}

.kicker {
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.section { padding: 6rem 0 2rem; }

.section-head { max-width: 640px; margin-bottom: 3rem; }
.section-sub { color: var(--text-dim); margin-top: 1rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.nav-logo {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}
.nav-links a {
  color: var(--text-dim);
  font-size: 0.92rem;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.theme-toggle {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav-burger span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 6rem 0 4rem;
  min-height: 78vh;
}

.hero-text .subline {
  color: var(--text-dim);
  font-size: 1.12rem;
  margin-top: 1.4rem;
  max-width: 34rem;
}

.hero-tracks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-top: 2.4rem;
}

.track-card {
  display: block;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}
.track-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}
.track-card strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
}
.track-card span {
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* Hero SVG */
.hero-visual { min-width: 0; }
.loop-svg { width: 100%; height: auto; }

.svg-block {
  fill: var(--bg-raised);
  stroke: var(--border);
  stroke-width: 1.5;
}
.loop-wires line, .loop-wires path {
  stroke: var(--text-faint);
  stroke-width: 1.5;
}
.svg-arrow { fill: var(--text-faint); }
.svg-label { fill: var(--text); font-family: "Space Grotesk", sans-serif; font-size: 14px; }
.svg-sub { fill: var(--text-dim); font-size: 11px; }
.svg-op { fill: var(--text); font-size: 18px; font-family: "JetBrains Mono", monospace; }
.svg-op-sm { fill: var(--accent); font-size: 12px; font-family: "JetBrains Mono", monospace; }
.svg-wave { fill: none; stroke: var(--wave); stroke-width: 2; }
.svg-axis { stroke: var(--grid-line); stroke-width: 1; }
.dot { fill: var(--accent); }

.dot1 { animation: flow-top 4s linear infinite; }
.dot2 { animation: flow-bottom 4s linear infinite; }

@keyframes flow-top {
  0%   { cx: 20;  cy: 90; opacity: 0; }
  5%   { opacity: 1; }
  45%  { cx: 430; cy: 90; opacity: 1; }
  50%  { cx: 440; cy: 100; opacity: 0; }
  100% { cx: 440; cy: 100; opacity: 0; }
}
@keyframes flow-bottom {
  0%, 48% { cx: 440; cy: 205; opacity: 0; }
  52%  { cx: 430; cy: 210; opacity: 1; }
  78%  { cx: 100; cy: 210; opacity: 1; }
  95%  { cx: 98;  cy: 120; opacity: 1; }
  100% { cx: 98;  cy: 114; opacity: 0; }
}

/* ---------- Case studies ---------- */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}

.case-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.case-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.case-media {
  aspect-ratio: 16 / 9;
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, var(--grid-line) 12px 13px),
    var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  text-align: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-soft);
}
.case-media img { width: 100%; height: 100%; object-fit: cover; }

.case-body { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.9rem; flex: 1; }

.case-tag {
  align-self: flex-start;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.case-step { font-size: 0.92rem; color: var(--text-dim); }
.case-step strong {
  display: block;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }

.cta-row { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 2.4rem; }

/* ---------- Research ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
  margin-bottom: 3.5rem;
}

.research-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.research-card .area {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.research-card p { color: var(--text-dim); font-size: 0.95rem; flex: 1; }
.research-card .paper-link { font-size: 0.85rem; font-family: "JetBrains Mono", monospace; }

/* ---------- PID demo ---------- */
.pid-demo {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.8rem;
}
.pid-head p { color: var(--text-dim); margin-top: 0.6rem; max-width: 46rem; font-size: 0.95rem; }

.pid-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 1.6rem;
  margin-top: 1.5rem;
  align-items: start;
}

#pidCanvas {
  width: 100%;
  height: auto;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.pid-controls { display: flex; flex-direction: column; gap: 1rem; }
.pid-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.pid-controls label span { color: var(--accent); }

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-raised);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-raised);
}

.pid-stats {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.8rem;
  line-height: 1.8;
  white-space: pre-line;
}

/* ---------- Lab notes ---------- */
.notes-list { display: flex; flex-direction: column; gap: 0.9rem; }

.note-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.4rem;
  padding: 1.3rem 1.4rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}
.note-row:hover { text-decoration: none; border-color: var(--accent); transform: translateX(4px); }
.note-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--text-faint);
  padding-top: 0.2rem;
}
.note-row h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.note-row p { color: var(--text-dim); font-size: 0.92rem; }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  position: relative;
  margin-left: 0.5rem;
  padding-left: 2rem;
  border-left: 2px solid var(--border);
}

.timeline li {
  position: relative;
  padding-bottom: 2.6rem;
  max-width: 560px;
}
.timeline li:last-child { padding-bottom: 0.5rem; }

.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-2rem - 7px);
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transition: background 0.3s;
}
.timeline li.visible::before { background: var(--accent); }

.timeline .tl-year {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.timeline h3 { margin: 0.25rem 0 0.4rem; font-size: 1.1rem; }
.timeline p { color: var(--text-dim); font-size: 0.93rem; }
.tl-type {
  display: inline-block;
  margin-left: 0.6rem;
  font-size: 0.68rem;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}

/* ---------- Contact ---------- */
.contact-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3.5rem clamp(1.5rem, 5vw, 4rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}
.contact-card .section-sub { max-width: 34rem; }
.now-line {
  margin-top: 1.4rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  border-top: 1px dashed var(--border);
  padding-top: 1.2rem;
  max-width: 40rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 5rem;
  padding: 1.6rem 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.footer-links { display: flex; gap: 1.4rem; }
.footer-links a { color: var(--text-dim); font-size: 0.85rem; }
.footer-links a:hover { color: var(--accent); }

/* ---------- Notes page (notes.html) ---------- */
.note-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 0;
}
.note-article h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.6rem; }
.note-article h2 { font-size: 1.4rem; margin: 2.2rem 0 0.8rem; }
.note-article h3 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
.note-article p { margin-bottom: 1.1rem; color: var(--text-dim); }
.note-article ul, .note-article ol { margin: 0 0 1.1rem 1.4rem; color: var(--text-dim); }
.note-article li { margin-bottom: 0.4rem; }
.note-article code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}
.note-article pre {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin-bottom: 1.2rem;
}
.note-article pre code { background: none; border: 0; padding: 0; font-size: 0.85rem; color: var(--text); }
.note-article .note-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 2.5rem;
}
.note-article em { color: var(--text-faint); }
.back-link { font-family: "JetBrains Mono", monospace; font-size: 0.85rem; }

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .dot1, .dot2 { animation: none; opacity: 0; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: unset; padding-top: 4rem; }
  .hero-visual { max-width: 480px; }
  .pid-body { grid-template-columns: 1fr; }
  .hero-tracks { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav-burger { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    display: none;
    padding: 0.5rem 1.5rem 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.7rem 0; width: 100%; }
  .theme-toggle { margin-top: 0.6rem; }
  .note-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .section { padding: 4rem 0 1.5rem; }
}

/* ============ ADDITIONS: products, patents, future, travel, trading ============ */
.nav-links a[aria-current="page"] { color: var(--accent); }
.sub-head { font-size: 1.1rem; color: var(--text-dim); margin: 2.6rem 0 1.2rem; font-family: "JetBrains Mono", monospace; font-weight: 500; }
.section-head + .sub-head { margin-top: 0; }

.product-grid, .tool-grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.product-card {
  background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem;
  transition: border-color .2s, transform .2s;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.product-card h3 { font-size: 1.08rem; }
.product-card p { color: var(--text-dim); font-size: 0.92rem; flex: 1; }
.product-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.product-status { font-size: 0.72rem; color: var(--text-faint); }
.product-specs { list-style: none; padding: 0; margin: 0; font-size: 0.76rem; color: var(--text-faint); border-top: 1px solid var(--border-soft); padding-top: .6rem; }
.product-specs li { padding: .12rem 0; }
.product-specs li::before { content: "› "; color: var(--accent); }

.patent-list { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 3rem; }
.patent-row {
  display: grid; grid-template-columns: 110px 1fr; gap: 1.2rem;
  background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: 10px; padding: 1.1rem 1.3rem;
}
.patent-row h3 { font-size: 1.02rem; margin-bottom: .3rem; }
.patent-row p { color: var(--text-dim); font-size: .92rem; }
.patent-meta { font-size: .76rem !important; color: var(--text-faint) !important; margin-top: .35rem; }

.future-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.future-card { border-left: 2px solid var(--accent); padding: .3rem 0 .3rem 1.1rem; display: flex; flex-direction: column; gap: .45rem; }
.future-card p { color: var(--text-dim); font-size: .93rem; }

.beyond-grid, .travel-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.beyond-card, .travel-card {
  display: flex; flex-direction: column; background: var(--bg-raised); border: 1px solid var(--border-soft);
  border-radius: 12px; overflow: hidden; color: var(--text); transition: border-color .2s, transform .2s;
}
.beyond-card:hover, .travel-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-3px); }
.beyond-media, .travel-media {
  aspect-ratio: 16 / 9; background: var(--bg-inset); display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: .8rem; overflow: hidden;
}
.beyond-media img, .travel-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.beyond-card:hover img, .travel-card:hover img { transform: scale(1.04); }
.beyond-code { padding: 1.4rem; font-size: .8rem; color: var(--accent); line-height: 1.6; text-align: left; }
.beyond-body, .travel-body { padding: 1.1rem 1.25rem 1.3rem; display: flex; flex-direction: column; gap: .4rem; }
.beyond-body p, .travel-body p { color: var(--text-dim); font-size: .92rem; }
.travel-place { font-size: .74rem; color: var(--accent); }

.disclaimer { margin-top: 1.6rem; font-size: .76rem; color: var(--text-faint); max-width: 46rem; }
.note-article img { border-radius: 10px; margin: 1.2rem 0; }
.note-article pre { overflow-x: auto; max-height: 520px; }

@media (max-width: 560px) {
  .patent-row { grid-template-columns: 1fr; gap: .4rem; }
}
