/* ============================================================
   achyutsharma.me — the page is a PCB.
   Layers: soldermask green board, copper traces, ENIG gold pads,
   silkscreen white lettering. Routed by hand, like the real ones.
   ============================================================ */

:root {
  --mask: #0f3a2d;          /* soldermask green */
  --mask-deep: #0a2c22;     /* board core, shadowed areas */
  --mask-lite: #14483a;     /* raised panels */
  --copper: #cf8a4d;        /* exposed copper trace */
  --gold: #e9c46a;          /* ENIG pads */
  --silk: #eef4ee;          /* silkscreen white */
  --silk-dim: #a4bdb0;      /* faded silkscreen */
  --silk-faint: #6f8c7e;
  --rule: rgba(238, 244, 238, 0.14);
  --display: "Chakra Petch", "Archivo", sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --measure: 62ch;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background-color: var(--mask);
  /* copper routing grid, faint — like an unpoured ground plane */
  background-image:
    linear-gradient(to right, rgba(207, 138, 77, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(207, 138, 77, 0.055) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--silk);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  border-left: 3px solid var(--gold);
  border-right: 3px solid var(--gold);
  min-height: 100vh;
}

a {
  color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--silk); }

em { font-style: italic; }
strong { color: var(--silk); font-weight: 600; }

::selection { background: var(--copper); color: var(--mask-deep); }

/* corner mounting holes */
.hole {
  position: fixed;
  z-index: 20;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--mask-deep);
  border: 4px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--mask-deep), inset 0 0 0 20px #000;
}
.hole.tl { top: 10px; left: 12px; }
.hole.tr { top: 10px; right: 12px; }

/* ============ NAV ============ */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem clamp(1.5rem, 6vw, 4.5rem);
  background: color-mix(in srgb, var(--mask-deep) 82%, transparent);
  backdrop-filter: blur(7px);
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: var(--silk);
  text-decoration: none;
}
.wordmark span { color: var(--copper); font-weight: 500; }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 1.7rem);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-links a { color: var(--silk-dim); text-decoration: none; }
.nav-links a:hover { color: var(--gold); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--gold) !important;
  border: 1px solid var(--gold);
  padding: 0.28rem 0.75rem;
  border-radius: 99px;
}
.nav-cta:hover { background: var(--gold); color: var(--mask-deep) !important; }
.tp-ring {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

/* ============ HERO ============ */

.hero {
  padding: clamp(4rem, 12vh, 8rem) clamp(1.5rem, 6vw, 4.5rem) clamp(3rem, 8vh, 5rem);
  max-width: 74rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
}

.hero .kicker,
.hero h1 { grid-column: 1 / -1; }

.lede { grid-column: 1; }

.kicker {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 6.4vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: 0.005em;
  text-transform: none;
  max-width: 22ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--gold);
  /* underline routed like a trace: sharp 45° stub */
  background: linear-gradient(to right, var(--copper), var(--copper)) bottom left / 100% 3px no-repeat;
  padding-bottom: 4px;
}

.lede {
  margin-top: 1.8rem;
  max-width: var(--measure);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  color: var(--silk-dim);
}

/* schematic title block — bottom-right corner, like every real drawing */
.titleblock {
  grid-column: 2;
  justify-self: end;
  align-self: end;
  margin-top: 2.6rem;
  display: inline-grid;
  grid-template-columns: auto auto auto;
  border: 1px solid var(--silk-dim);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--silk);
  background: color-mix(in srgb, var(--mask-deep) 55%, transparent);
}

.titleblock > div {
  padding: 0.5rem 0.9rem;
  border-right: 1px solid var(--silk-faint);
  border-bottom: 1px solid var(--silk-faint);
}
.titleblock > div:nth-child(3) { border-right: none; }
.titleblock > div:first-child { grid-column: 1 / -1; border-right: none; }
.titleblock .tb-led { grid-column: 1 / -1; border-bottom: none; border-right: none; }

.titleblock span {
  display: block;
  font-size: 0.62rem;
  color: var(--silk-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.led {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 2px;             /* SMD LEDs are square */
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  vertical-align: baseline;
  margin-right: 0.2rem;
  animation: blink 2.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============ SECTIONS ============ */

.section {
  padding: clamp(3rem, 8vh, 5.5rem) clamp(1.5rem, 6vw, 4.5rem);
  max-width: 74rem;
  margin-inline: auto;
}

.section-head { margin-bottom: clamp(2rem, 5vh, 3.2rem); }

.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--copper);
}

.section-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-top: 0.4rem;
}

.section-note {
  margin-top: 0.5rem;
  color: var(--silk-dim);
  max-width: var(--measure);
  font-size: 0.95rem;
}

/* ============ COMPONENT ENTRIES ============ */

.comp {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(200px, 270px);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1.8rem, 4vh, 2.6rem) 0;
  border-top: 1px solid var(--rule);
}

.comp:last-of-type { border-bottom: 1px solid var(--rule); }

/* copper trace running down the refdes column, with a via at each part */
.comp::before {
  content: "";
  position: absolute;
  left: 1.35rem;
  top: 0; bottom: 0;
  width: 2px;
  background: color-mix(in srgb, var(--copper) 45%, transparent);
}

.refdes {
  position: relative;
  z-index: 1;
  padding-top: 0.4rem;
}

.refdes span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;               /* a via */
  border: 2px solid var(--copper);
  background: var(--mask-deep);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.comp:hover .refdes span {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(233, 196, 106, 0.35);
}

.comp-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--silk-faint);
  margin-bottom: 0.7rem;
}

.status {
  border: 1px solid var(--rule);
  padding: 0.1rem 0.55rem;
  border-radius: 99px;
  color: var(--silk-dim);
}

.status.live {
  border-color: var(--gold);
  color: var(--gold);
}

.comp-body h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  margin-bottom: 0.7rem;
}

.comp-body p {
  color: var(--silk-dim);
  max-width: var(--measure);
  font-size: 0.97rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin-top: 1.1rem;
}

.tags li {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--silk-dim);
  background: var(--mask-deep);
  border: 1px solid var(--rule);
  padding: 0.18rem 0.6rem;
  border-radius: 3px;
}

.comp-links {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* ============ PHOTOS: gold-pad frames ============ */

.pad-frame {
  position: relative;
  background: var(--mask-deep);
  border: 2px solid var(--gold);
  padding: 0.55rem 0.55rem 0.4rem;
  align-self: start;
}

/* corner pads, like a QFN footprint */
.pad-frame::before,
.pad-frame::after {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  background: var(--gold);
}
.pad-frame::before { top: -7px; left: -7px; }
.pad-frame::after { bottom: -7px; right: -7px; }

.comp .pad-frame { margin-top: 0.4rem; }

.pad-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--mask-lite);
}

.pad-frame figcaption {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--silk-faint);
  padding-top: 0.45rem;
  text-align: center;
  text-transform: uppercase;
}

/* empty slot: unpopulated footprint — dashed courtyard + instructions */
.pad-frame.empty {
  border-style: dashed;
  border-color: var(--silk-faint);
  background: transparent;
}
.pad-frame.empty::before,
.pad-frame.empty::after { display: none; }

.pad-frame.empty .slot-fill {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  aspect-ratio: 4 / 3;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--silk-faint);
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(238, 244, 238, 0.03) 14px 28px);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(1.4rem, 3vw, 2.2rem);
}

/* ============ BOM TABLE ============ */

.bom-wrap { overflow-x: auto; }

.bom {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  border: 1px solid var(--silk-faint);
}

.bom th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  color: var(--copper);
  background: var(--mask-deep);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--silk-faint);
}

.bom td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--silk-dim);
  vertical-align: top;
}

.bom td:first-child {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gold);
  white-space: nowrap;
}

.bom td:nth-child(2) {
  font-family: var(--display);
  font-weight: 500;
  color: var(--silk);
}

.bom td:last-child {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.bom tbody tr:hover { background: color-mix(in srgb, var(--mask-lite) 70%, transparent); }
.bom tbody tr:last-child td { border-bottom: none; }

/* ============ ABOUT ============ */

.about-body {
  max-width: var(--measure);
  display: grid;
  gap: 1.2rem;
}

.about-body p { color: var(--silk-dim); font-size: 1.02rem; }

.about-fine {
  font-family: var(--mono);
  font-size: 0.78rem !important;
  color: var(--silk-faint) !important;
  border-left: 2px solid var(--copper);
  padding-left: 1rem;
}

/* ============ FOOTER / EDGE CONNECTOR ============ */

.footer {
  position: relative;
  margin-top: clamp(2rem, 6vh, 4rem);
  background: var(--mask-deep);
  padding: clamp(3.5rem, 10vh, 6rem) clamp(1.5rem, 6vw, 4.5rem) 3.4rem;
  border-top: 1px solid var(--rule);
}

.footer-kicker {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 1rem;
}

.footer-email {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4.5vw, 2.8rem);
  color: var(--silk);
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  word-break: break-all;
}

.footer-email:hover { color: var(--gold); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.8rem;
  margin-top: 2.2rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.footer-links a { color: var(--silk-dim); text-decoration: none; }
.footer-links a:hover { color: var(--gold); }

.colophon {
  margin-top: 3.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--silk-faint);
}

/* gold edge-connector fingers along the bottom of the board */
.edge-fingers {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 14px;
  background: repeating-linear-gradient(
    to right,
    var(--gold) 0 26px,
    var(--mask-deep) 26px 40px
  );
}

/* ============ REVEAL ============ */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.in { opacity: 1; transform: none; }

/* focus visibility on a dark board */
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .led { animation: none; }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 880px) {
  .comp { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .comp .pad-frame {
    grid-column: 2;
    max-width: 340px;
  }
}

@media (max-width: 580px) {
  .hole { display: none; }
  body { border-width: 2px; }
  .nav-links a:not(.nav-cta) { display: none; }
  .comp { grid-template-columns: 1fr; }
  .comp::before { display: none; }
  .refdes { padding-top: 0; }
  .refdes span { min-width: 2.3rem; height: 2.3rem; font-size: 0.8rem; }
  .titleblock { grid-template-columns: 1fr 1fr; }
  .titleblock > div:nth-child(3) { border-right: 1px solid var(--silk-faint); }
}

/* ============ REV 3.0 ADDITIONS ============ */

/* print farm: text + photo split */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.split-text {
  display: grid;
  gap: 1.1rem;
  max-width: var(--measure);
}

.split-text p { color: var(--silk-dim); font-size: 1rem; }

@media (max-width: 880px) {
  .split { grid-template-columns: 1fr; }
  .split .pad-frame { max-width: 460px; }
}

/* the PWR LED is a button now — click it */
.led-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.led-btn:hover .led { box-shadow: 0 0 14px var(--gold); }

.led-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* footer content centered like the rest of the board */
.footer-inner {
  max-width: 74rem;
  margin-inline: auto;
}

/* little bits of life */
.tags li { transition: transform 0.15s ease, border-color 0.15s ease; }
.tags li:hover {
  transform: translateY(-2px);
  border-color: var(--copper);
  color: var(--silk);
}

.refdes span { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.comp:hover .refdes span { transform: rotate(8deg); }

.pad-frame { transition: transform 0.2s ease; }
.gallery .pad-frame:hover { transform: translateY(-4px); }

@media (prefers-reduced-motion: reduce) {
  .tags li, .refdes span, .pad-frame { transition: none; }
  .comp:hover .refdes span { transform: none; }
  .gallery .pad-frame:hover { transform: none; }
}
