/* Site styles for the Hector Ruiz portfolio page. Layered on top of the
   base tokens and components (nocturne.css); adds the neon-green accent and
   page layout the base layer doesn't cover. */

:root {
  --color-neon: #39ff8c;
  --color-neon-dim: #1f9c58;
}

@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bracketGlow {
  0%, 100% { filter: drop-shadow(0 0 0px var(--color-accent)); }
  50% { filter: drop-shadow(0 0 6px var(--color-accent)); }
}
@keyframes heroGlowBreathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
@keyframes heroNameShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes statusPulse {
  0% { transform: scale(0.6); opacity: 0.55; }
  70%, 100% { transform: scale(2); opacity: 0; }
}
@keyframes markBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes markGlow {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes markRing {
  0% { transform: scale(0.9); opacity: 0.5; }
  70%, 100% { transform: scale(1.45); opacity: 0; }
}

/* The page must never scroll sideways. `clip` rather than `hidden` on purpose:
   `hidden` would make these scroll containers and break the sticky .site-nav,
   whereas `clip` cuts the overflow without creating a scrollport. Set on both
   html and body so the value is deterministic — overflow on body propagates to
   the viewport only while html's is visible. overscroll-behavior-x kills the
   horizontal rubber-band iOS otherwise allows. */
html {
  overflow-x: clip;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
}
/* No single long word ("cybersecurity" in the contact heading, an email in a
   button) may push a line past the screen edge. */
h1, h2, h3, p, .btn { overflow-wrap: break-word; }
a { color: var(--color-accent-300); }
a:hover { color: var(--color-accent-200); }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

.fade-in { animation: fadeUp 0.7s ease-out both; }

.fadeline {
  height: 1px;
  border: 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
  margin: 0;
}

.container { max-width: 1180px; margin: 0 auto; }

/* — nav — */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-divider);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.nav-brand:hover .nav-name { color: var(--color-accent-200); }
.nav-brand:hover .nav-brand-label { color: var(--color-neon); }
.nav-icon {
  display: block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  /* Crest is a cut-out silhouette — no tile radius so the brand shape reads clean */
}
.nav-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}
.nav-name {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--color-text);
  transition: color 0.15s ease;
}
.nav-brand-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  transition: color 0.15s ease;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  row-gap: var(--space-2);
}
.nav-links > a:not(.btn) {
  position: relative;
  font-size: 13px;
  text-decoration: none;
  color: var(--color-text);
  opacity: 0.75;
  transition: opacity 0.2s;
}
.nav-links > a:not(.btn)::after {
  content: '';
  position: absolute;
  left: 0; right: 100%; bottom: -4px;
  height: 1px;
  background: var(--color-accent);
  transition: right 0.25s ease;
}
.nav-links > a:not(.btn):hover { opacity: 1; }
.nav-links > a:not(.btn):hover::after { right: 0; }
.nav-links .btn { text-decoration: none; }

/* — hero — */
.hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--space-8) * 3) var(--space-8) calc(var(--space-8) * 2);
}
.hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 500px at 12% -10%,
      color-mix(in srgb, var(--color-accent) 30%, transparent), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%,
      color-mix(in srgb, var(--color-neon) 16%, transparent), transparent 65%);
  pointer-events: none;
  animation: heroGlowBreathe 7s ease-in-out infinite;
}
.hero-scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: repeating-linear-gradient(180deg,
    color-mix(in srgb, var(--color-text) 4%, transparent) 0px,
    transparent 1px, transparent 3px);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  /* min(340px, 100%) — a bare 340px floor can't shrink below itself, so on a
     320px phone the track overflowed the container by ~65px and the copy got
     clipped. This keeps the two-column behaviour and lets the track collapse. */
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: calc(var(--space-8) * 1.4);
  align-items: center;
}
.hero-copy { animation-delay: 0.05s; }
.hero-tags {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.tag-whoami {
  letter-spacing: 0.06em;
  border-color: var(--color-neon);
  color: var(--color-neon);
}
.hero-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.status-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-neon);
  box-shadow: 0 0 6px var(--color-neon);
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--color-neon);
  animation: statusPulse 2.2s ease-out infinite;
}
/* 64px is the design's size; it only scales down once the viewport can't hold it. */
.hero h1 { font-size: clamp(40px, 12vw, 64px); margin-bottom: var(--space-3); }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .hero h1 {
    background: linear-gradient(100deg,
      var(--color-text) 0%, var(--color-accent-300) 55%, var(--color-neon) 120%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: heroNameShift 8s ease-in-out infinite;
  }
}
.hero-subline {
  font-size: 15px;
  color: var(--color-accent-300);
  margin-bottom: var(--space-4);
  letter-spacing: 0.02em;
}
.hero-lede {
  font-size: 18px;
  max-width: 50ch;
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
  margin-bottom: var(--space-6);
}
.hero-ctas { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.hero-ctas .btn, .contact-card .btn { text-decoration: none; }
.btn-glow { transition: box-shadow 0.2s, transform 0.2s; }
.btn-glow:hover {
  box-shadow: 0 0 18px color-mix(in srgb, var(--color-accent) 55%, transparent);
  transform: translateY(-1px);
}

.hero-photo { animation-delay: 0.15s; position: relative; }
.photo-frame {
  position: relative;
  /* 280px is the design size; below ~325px of viewport it has to give way or
     it pushes the corner brackets past the screen edge. aspect-ratio keeps it
     square as it shrinks. */
  /* the 20px reserve keeps the -10px corner brackets on screen once the frame
     is the width-limiting element. */
  width: min(280px, 100% - 20px);
  aspect-ratio: 1;
  margin: 0 auto;
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.bracket {
  position: absolute;
  width: 28px;
  height: 28px;
  animation: bracketGlow 3s ease-in-out infinite;
}
.bracket-tl { top: -10px; left: -10px; border-top: 2px solid var(--color-accent); border-left: 2px solid var(--color-accent); }
.bracket-tr { top: -10px; right: -10px; border-top: 2px solid var(--color-accent); border-right: 2px solid var(--color-accent); animation-delay: 0.3s; }
.bracket-bl { bottom: -10px; left: -10px; border-bottom: 2px solid var(--color-accent); border-left: 2px solid var(--color-accent); animation-delay: 0.6s; }
.bracket-br { bottom: -10px; right: -10px; border-bottom: 2px solid var(--color-accent); border-right: 2px solid var(--color-accent); animation-delay: 0.9s; }
/* Brand mark, twice over — hero top-right and photo top-left. Both are plain
   composites on purpose: no mix-blend-mode and no filter, because a blend mode
   here forces the whole tall .hero to rasterize as one isolated group, and iOS
   Safari tiles those and leaves a visible seam across the section.
   The mark is a corner ornament, not a row element: equal insets pin it to the
   hero's top-right corner, deliberately above and outside the copy so it stops
   competing with the h1. Earlier revisions tried to relate it to the "$ whoami"
   row — centred on it, then flush with its top edge — and both read as a large
   object marooned mid-hero. Size it to stay ornamental; at much past 64px it
   starts reading as content again. `top` is independent of .hero's padding-top
   now, so the two no longer have to move together. */
.hero-mark {
  position: absolute;
  top: var(--space-8);
  right: var(--space-8);
  width: 56px;
  height: 56px;
  /* Keep tooltips/focus available so the brand mark can be inspected */
  pointer-events: auto;
  z-index: 2;
}
.hero-mark::before {
  content: "";
  position: absolute;
  /* Restrained on purpose: this now sits directly on .hero-glow's neon corner
     ellipse, and the two stacking at full strength is what made the old halo
     read as a smudge rather than as light. */
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--color-accent) 38%, transparent) 0%,
    color-mix(in srgb, var(--color-accent) 17%, transparent) 38%,
    color-mix(in srgb, var(--color-neon) 6%, transparent) 58%,
    transparent 76%);
  animation: markGlow 4.5s ease-in-out infinite;
}
/* Expanding ring, same idiom as .status-dot::after. Circular because the mark
   is a cut-out crest with no tile edge for a rounded square to agree with. */
.hero-mark::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--color-accent) 70%, transparent);
  animation: markRing 4.5s ease-out infinite;
}
.hero-mark img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.9;
  /* No border-radius or box-shadow: the mark is a transparent cut-out, so both
     would describe the image's rectangular box rather than the crest — a shadow
     here paints a floating rounded rectangle behind the silhouette. The ::before
     radial is what gives this one its glow, and drop-shadow is not an option
     (see the iOS seam note above). */
  /* Anchor the corner: breathing grows down and inward, so neither the top nor
     the right inset changes. */
  transform-origin: top right;
  animation: markBreathe 4.5s ease-in-out infinite;
}

.photo-mark {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-bg) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.35);
}
.photo-mark img { display: block; width: 26px; height: 26px; border-radius: 6px; }

.photo-caption {
  text-align: center;
  margin-top: var(--space-6);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.brand-caption {
  text-align: center;
  margin-top: var(--space-2);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--color-accent-300) 85%, transparent);
}

/* — terminal readout — */
.terminal-section { padding: 0 var(--space-8) calc(var(--space-8) * 2); }
.terminal {
  padding: 0;
  gap: 0; /* .card's default gap would open a seam under the title bar */
  background: var(--color-neutral-900);
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-neutral-600);
}
.terminal-dot-on { background: color-mix(in srgb, var(--color-neon) 70%, var(--color-neutral-600)); }
.terminal-title {
  margin-left: var(--space-3);
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.terminal-body { padding: var(--space-6); font-size: 14px; line-height: 1.9; }
.terminal-body .prompt { color: var(--color-neon); }
.terminal-body .output {
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
  padding-left: var(--space-4);
}
.terminal-body .cmd + .cmd, .terminal-body .output + .cmd { margin-top: var(--space-3); }
.terminal-cursor {
  color: var(--color-neon);
  opacity: 0;
  animation: blink 1.1s step-end infinite;
}

/* — sections — */
.section { padding: calc(var(--space-8) * 2) var(--space-8); }
.section h6 { color: var(--color-accent-300); margin-bottom: var(--space-2); }

/* — about — */
.about h2 { font-size: 28px; margin-bottom: var(--space-4); }
.about-copy { max-width: 70ch; }
.about-copy p {
  font-size: 17px;
  color: color-mix(in srgb, var(--color-text) 82%, transparent);
  margin-bottom: var(--space-4);
}
.about-copy p:last-child { margin-bottom: 0; }

/* — work — */
.work h2 { font-size: 28px; margin-bottom: var(--space-6); }
.project-card {
  position: relative;
  padding: calc(var(--space-8) * 1.3) var(--space-8);
  gap: var(--space-4);
  background: radial-gradient(ellipse at 8% 0%,
    color-mix(in srgb, var(--color-accent) 12%, transparent),
    var(--color-surface) 62%);
}
.project-card .bracket { width: 22px; height: 22px; }
.project-card .bracket-tl { top: 16px; left: 16px; }
.project-card .bracket-br { bottom: 16px; right: 16px; animation-delay: 0.6s; }
.project-card .tag { align-self: flex-start; }
.project-name {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 26px;
  line-height: 1.2;
  margin: 0;
}
.project-desc {
  margin: 0;
  max-width: 62ch;
  font-size: 16px;
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.project-actions { margin-top: var(--space-2); }
.project-actions .btn {
  align-self: flex-start;
  text-decoration: none;
}

/* — contact — */
.contact-section { padding: calc(var(--space-8) * 2) var(--space-8) calc(var(--space-8) * 3); }
.contact-card {
  position: relative;
  padding: calc(var(--space-8) * 1.5) var(--space-8);
  background: radial-gradient(ellipse at 10% 0%,
    color-mix(in srgb, var(--color-accent) 12%, transparent),
    var(--color-surface) 60%);
}
.contact-card .bracket { width: 22px; height: 22px; }
.contact-card .bracket-tl { top: 16px; left: 16px; }
.contact-card .bracket-br { bottom: 16px; right: 16px; animation-delay: 0.6s; }
/* .card is a stretch-aligned flex column, which would blow the pill and the
   button out to the full card width. */
.contact-card .tag,
.contact-card .btn { align-self: flex-start; }
.contact-card .tag { margin-bottom: var(--space-4); }
.contact-card h2 { font-size: 32px; margin-bottom: var(--space-3); max-width: 20ch; }
.contact-card p {
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  margin-bottom: var(--space-6);
  max-width: 50ch;
}
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.contact-actions .btn {
  align-self: flex-start;
  text-decoration: none;
}
/* the label is an unbreakable email address, so the button can't shrink below
   it on a very narrow screen without permission to break the string. */
.contact-card .btn-primary {
  font-size: 15px;
  padding: var(--space-3) var(--space-6);
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* — footer — */
.site-footer {
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--color-divider);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.footer-icon {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.footer-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
}
.footer-brand-name {
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
  letter-spacing: 0.03em;
}
.footer-brand-sub {
  color: color-mix(in srgb, var(--color-text) 48%, transparent);
  font-size: 11px;
}
.footer-meta {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

/* Scroll-triggered entrance for below-the-fold content. Pure CSS, no
   JavaScript — browsers without support just render everything visible
   with no animation, so this is a progressive enhancement only. */
@supports (animation-timeline: view()) {
  .about, .work, .contact-card {
    animation: fadeUp 0.8s ease-out both;
    animation-timeline: view();
    animation-range: entry 0% cover 35%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in, .bracket, .terminal-cursor,
  .hero h1, .hero-glow, .status-dot::after,
  .hero-mark::before, .hero-mark img,
  .about, .work, .contact-card {
    animation: none;
  }
  .terminal-cursor { opacity: 1; }
  .hero-glow { opacity: 1; }
  .hero-mark::before { opacity: 1; }
  .hero-mark::after { display: none; }
}

/* mobile + spacing fixes */
body { line-height: 1.6; }
.hero-lede { line-height: 1.7; margin-bottom: var(--space-8); }
.about-copy p { line-height: 1.8; margin-bottom: var(--space-6); }
@media (max-width: 640px) {
  .site-nav { justify-content: center; }
  .nav-brand, .nav-links { width: 100%; justify-content: center; }
  .hero { padding-top: calc(var(--space-8) * 2); }
  /* same equal-inset corner anchor, one step tighter. */
  .hero-mark { width: 38px; height: 38px; top: var(--space-6); right: var(--space-6); }
  .photo-mark { width: 32px; height: 32px; top: 8px; left: 8px; }
  .photo-mark img { width: 22px; height: 22px; }
  .hero-grid { gap: calc(var(--space-8) * 1.15); }
  .hero-lede { font-size: 17px; line-height: 1.8; margin-bottom: var(--space-8); }
  .hero-subline { line-height: 1.5; margin-bottom: var(--space-6); }
  .hero-ctas { gap: var(--space-4); justify-content: center; }
  .section { padding: calc(var(--space-8) * 1.6) var(--space-8); }
  .about h2 { margin-bottom: var(--space-6); }
  .about-copy p { line-height: 1.85; margin-bottom: var(--space-6); }
  .terminal-body { line-height: 2; }
  .contact-card h2 { line-height: 1.35; }
}
