/* ---------------------------------------------------------
   Portfolio styles
   Palette: warm parchment paper, warm ink, copper + blueprint accents.
   Type:    Fraunces (display) / Geist (body) / JetBrains Mono (technical).
   Layout:  Asymmetric two-column with a narrow reference-designator gutter.
   --------------------------------------------------------- */

:root {
  --paper: #ebe4d0;
  --paper-soft: #e2dabf;
  --ink: #1c1815;
  --ink-soft: #605a4d;
  --rule: #cbc3ad;
  --copper: #9e4a1c;
  --copper-soft: #b56b3d;
  --blueprint: #24405c;

  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 62ch;
  --gutter: 88px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Very faint paper grain */
  background-image:
    radial-gradient(rgba(28, 24, 21, 0.025) 1px, transparent 1.5px);
  background-size: 3px 3px;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 88px 32px 56px;
}

/* --- Intro ---------------------------------------------- */
.intro {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 32px;
  margin-bottom: 72px;
}

.intro-mark {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blueprint);
  padding-top: 12px;
  line-height: 1.6;
}

.intro-body { min-width: 0; }

.status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
}

.dot {
  width: 7px;
  height: 7px;
  background: #587a48;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(88, 122, 72, 0.18);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 6.5vw, 60px);
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 0;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin: 0 0 22px;
  color: var(--ink);
}

.tagline {
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  max-width: var(--measure);
}

.tagline em {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 24, "SOFT" 80, "WONK" 1;
  color: var(--ink);
  font-size: 1.08em;
  font-weight: 500;
}

/* --- Sections ------------------------------------------- */
.section {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 32px;
  padding-top: 44px;
  margin-top: 44px;
  border-top: 1px solid var(--rule);
  position: relative;
}

/* Small copper tick where the section rule crosses the gutter. */
.section::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 0;
  width: 6px;
  height: 6px;
  background: var(--copper);
  border-radius: 50%;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blueprint);
  margin: 0;
  padding-top: 4px;
}

.section-content { min-width: 0; }

.prose {
  margin: 0;
  max-width: var(--measure);
  font-size: 17px;
  line-height: 1.65;
}
.prose + .prose { margin-top: 16px; }

/* --- Projects ------------------------------------------- */
.project { margin-bottom: 64px; }
.project:last-child { margin-bottom: 0; }

.project-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}

.project-ref {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--copper);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding-top: 3px;
}

.project-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  font-variation-settings: "opsz" 24, "SOFT" 30, "WONK" 0;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0;
}

.project-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 20, "SOFT" 60, "WONK" 1;
  font-size: 15px;
  color: var(--ink-soft);
  margin: 4px 0 0;
}

/* Datasheet-style spec table. */
.project-specs {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 12px 0;
  margin: 18px 0 20px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-specs dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 32px;
  row-gap: 6px;
}

.project-specs dl > div {
  display: flex;
  gap: 12px;
}

.project-specs dt {
  color: var(--blueprint);
  min-width: 56px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project-specs dd {
  margin: 0;
  color: var(--ink);
}

.project-desc {
  max-width: var(--measure);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 22px;
}

/* --- Gallery -------------------------------------------- */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 8px;
}

.project-gallery figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.figure-placeholder {
  aspect-ratio: 4 / 3;
  width: 100%;
  border: 1px solid var(--rule);
  background-color: var(--paper-soft);
  overflow: hidden;
  position: relative;
}

/* PCB — green solder mask with copper trace hints. */
.figure--pcb {
  background:
    repeating-linear-gradient(90deg,
      transparent 0, transparent 20px,
      rgba(212, 165, 88, 0.5) 20px, rgba(212, 165, 88, 0.5) 22px,
      transparent 22px, transparent 44px),
    repeating-linear-gradient(0deg,
      transparent 0, transparent 28px,
      rgba(212, 165, 88, 0.3) 28px, rgba(212, 165, 88, 0.3) 29px,
      transparent 29px, transparent 56px),
    radial-gradient(circle at 25% 30%, rgba(255, 220, 130, 0.25) 3px, transparent 4px),
    radial-gradient(circle at 70% 65%, rgba(255, 220, 130, 0.25) 3px, transparent 4px),
    #1e4a3a;
}

/* Oscilloscope — dark, subtle graticule, phosphor waveform. */
.figure--scope {
  background-color: #0e1512;
  background-image:
    url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 300' preserveAspectRatio='none'%3E%3Cg stroke='%232a3d33' stroke-width='0.5'%3E%3Cline x1='0' y1='75' x2='400' y2='75'/%3E%3Cline x1='0' y1='150' x2='400' y2='150'/%3E%3Cline x1='0' y1='225' x2='400' y2='225'/%3E%3Cline x1='100' y1='0' x2='100' y2='300'/%3E%3Cline x1='200' y1='0' x2='200' y2='300'/%3E%3Cline x1='300' y1='0' x2='300' y2='300'/%3E%3C/g%3E%3Cpath d='M0,150 Q50,60 100,150 T200,150 T300,150 T400,150' stroke='%237dd58a' stroke-width='2' fill='none' opacity='0.9'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* Schematic — cream paper with a fine dot grid. */
.figure--schematic {
  background:
    radial-gradient(circle, rgba(96, 90, 77, 0.35) 1px, transparent 1.5px),
    #f2ecd8;
  background-size: 12px 12px;
}

figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* --- Stack --------------------------------------------- */
.stack {
  margin: 0;
  max-width: var(--measure);
  font-size: 15px;
}

.stack > div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 6px 0;
}

.stack > div + div {
  border-top: 1px dashed var(--rule);
}

.stack dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blueprint);
  padding-top: 3px;
}

.stack dd {
  margin: 0;
  color: var(--ink);
}

/* --- Contact ------------------------------------------- */
.links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.links li {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
}
.links li:last-child { border-bottom: none; }

.links-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
  width: 72px;
  flex-shrink: 0;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  padding-bottom: 1px;
}

.links a:hover {
  color: var(--copper);
  border-bottom-color: var(--copper);
}

/* --- Footer -------------------------------------------- */
.footer {
  margin-top: 96px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
}

.footer p { margin: 0; }

/* --- Focus states -------------------------------------- */
a:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Responsive ---------------------------------------- */
@media (max-width: 760px) {
  .page {
    padding: 56px 22px 40px;
  }

  .intro,
  .section {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .intro-mark,
  .section-label {
    padding-top: 0;
  }

  .section::before { display: none; }

  h1 { font-size: 36px; }
  .tagline { font-size: 17px; }

  .project-header {
    flex-wrap: wrap;
  }

  .project-title { font-size: 22px; }

  .project-specs dl {
    grid-template-columns: 1fr;
  }

  .project-gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .stack > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 440px) {
  .project-gallery {
    grid-template-columns: 1fr;
  }
}

/* --- Reduced motion ------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}
