/* =========================================================================
   anush devkar — portfolio
   Base layer: hyper-minimalist, high-contrast, text-forward "system log".
   ========================================================================= */

/* Fonts. Kept as web imports; body falls back to system stacks if offline. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

/* ---- Theme tokens ------------------------------------------------------- */
/* Default: dark mode, matching the 80two brand (near-black + violet accent). */
:root {
  --bg:            #0a0a0b;
  --fg:            #e8e8ea;   /* ~13.9:1 on --bg  → passes WCAG AA */
  --fg-dim:        #a6a6ad;   /* ~6.2:1  on --bg  → passes AA      */
  --fg-faint:      #6c6c74;
  --accent:        #b9a2ff;   /* violet — link hover / arm glow    */
  --accent-strong: #8b5cf6;
  --rule:          #1e1e22;

  /* Canvas manipulator colors (read by JS via getComputedStyle). */
  --arm-alu:        #3d7bfd;   /* blue anodized aluminum brackets */
  --arm-alu-hi:     #8fb5ff;   /* satin sheen on the anodizing    */
  --arm-alu-edge:   #16337f;
  --arm-servo:      #1b1b1f;   /* black hobby-servo cases / jaws  */
  --arm-servo-hi:   #45454e;
  --arm-servo-edge: #000000;
  --arm-hw:         #b8b8c2;   /* bare metal: screws, horns, gears */
  --arm-hw-hi:      #eeeef4;
  --arm-hw-edge:    #4a4a54;
  --arm-pcb:        #1f7a44;   /* control-board substrate          */
  --arm-pcb-silk:   #d9f2e2;   /* silkscreen text                  */
  --arm-wire-a:     #e4574d;   /* jumper wires                     */
  --arm-wire-b:     #eab308;
  --arm-wire-c:     #b9a2ff;
  --arm-active:     #b9a2ff;   /* violet — active-state LEDs/glow  */
  --arm-telemetry:  #7a6fb0;

  --maxw: 46rem;
}

/* Stark off-white light mode. */
:root[data-theme="light"] {
  --bg:            #f6f6f4;
  --fg:            #111114;   /* ~16:1 on --bg → AA */
  --fg-dim:        #45454c;   /* ~8.7:1 on --bg → AA */
  --fg-faint:      #8a8a90;
  --accent:        #6d28d9;   /* darker violet for contrast on light → ~6.4:1 */
  --accent-strong: #5b21b6;
  --rule:          #e2e2dd;

  --arm-alu:        #2f66e0;
  --arm-alu-hi:     #7ea6f5;
  --arm-alu-edge:   #12295f;
  --arm-servo:      #1d1d21;
  --arm-servo-hi:   #4a4a52;
  --arm-servo-edge: #000000;
  --arm-hw:         #8e8e98;
  --arm-hw-hi:      #c9c9d2;
  --arm-hw-edge:    #3d3d44;
  --arm-pcb:        #1d6b3d;
  --arm-pcb-silk:   #e6f5eb;
  --arm-wire-a:     #d64940;
  --arm-wire-b:     #ca9a06;
  --arm-wire-c:     #6d28d9;
  --arm-active:     #6d28d9;
  --arm-telemetry:  #8a7fb8;
}

/* ---- Reset-ish ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.05rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ---- The arm canvas ----------------------------------------------------- */
#arm-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  pointer-events: none;   /* never intercept clicks/scroll */
}

/* ---- Layout ------------------------------------------------------------- */
.page {
  position: relative;
  z-index: 2;             /* text sits under the arm's z-index visually,
                             but arm is pointer-events:none so links work */
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 8rem) clamp(1.5rem, 6vw, 4rem) 8rem;
}

.masthead { margin-bottom: clamp(3rem, 8vh, 6rem); }

.name {
  font-weight: 600;
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0;
}

.block { margin-bottom: clamp(2.5rem, 6vh, 4rem); }

/* // headers + telemetry use JetBrains Mono. */
.section-head {
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log li {
  margin: 0.35rem 0;
  text-wrap: pretty;
}

.mark {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--fg-faint);
  margin-right: 0.5ch;
  user-select: none;
}

em { color: var(--fg); font-style: italic; }

/* ---- Footer + links ----------------------------------------------------- */
.footer { margin-top: clamp(3rem, 8vh, 6rem); }

.footer__links {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--fg-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.9rem;
}

/* Robotic links — the elements the arm grabs. Always underlined. */
.robotic-link {
  color: var(--fg);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--fg-dim);
  transition: color 0.2s ease, text-decoration-color 0.2s ease,
    text-shadow 0.2s ease;
}

.robotic-link[data-type] { position: relative; }

.robotic-link:hover,
.robotic-link:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent);
  outline: none;
}

/* Keep a visible focus ring for keyboard users. */
.robotic-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Theme toggle ------------------------------------------------------- */
#theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5ch;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--fg-dim);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

#theme-toggle:hover,
#theme-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.theme-toggle__state { color: var(--accent); font-weight: 500; }

/* ---- Photo modal -------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 5vw, 4rem);
  background: color-mix(in srgb, var(--bg) 92%, black);
  opacity: 0;
  visibility: hidden;
  cursor: zoom-out;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}

.modal__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid var(--rule);
  box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 25%, transparent);
  transform: scale(0.98);
  transition: transform 0.35s ease;
}

.modal.is-open .modal__img { transform: scale(1); }

/* ---- Reduced motion ----------------------------------------------------- */
/* JS also branches on this; here we simply drop non-essential transitions. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  /* Keep the modal fade — it is the one motion explicitly allowed as a fade. */
  .modal { transition: opacity 0.3s ease, visibility 0s linear 0.3s !important; }
  .modal.is-open { transition: opacity 0.3s ease !important; }
}
