/*
  Leonardo Arsie — Engineering & Systems Portfolio
  Design System: High-Contrast Minimalist Brutalist with Calm Micro-Interactions
*/

/* ===== RESET & BOX MODEL ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
  margin: 0;
  padding: 0;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #FFFFFF;
  --fg: #000000;
  --muted: #F5F5F5;
  --muted-fg: #525252;
  --border: #000000;
  --border-light: #E5E5E5;

  --border-hairline: 1px solid var(--border-light);
  --border-thin: 1px solid var(--fg);
  --border-medium: 2px solid var(--fg);
  --border-thick: 4px solid var(--fg);

  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* ===== SCROLL PROGRESS BAR ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--fg);
  z-index: 9999;
  transition: width 80ms linear;
  pointer-events: none;
}

/* ===== BASE TYPOGRAPHY ===== */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: inherit;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  line-height: 1.2;
}

p {
  max-width: 68ch;
  overflow-wrap: break-word;
}

a {
  color: currentColor;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: text-decoration-thickness 120ms ease;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* ===== ACCESSIBILITY: SKIP LINK & FOCUS ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1.5rem;
  background: var(--fg);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 9999;
  border: var(--border-medium);
  transition: top 150ms ease;
}

.skip-link:focus {
  top: 1rem;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

.section--inverted :focus-visible {
  outline-color: var(--bg);
}

/* ===== LAYOUT & CONTAINERS ===== */
.container {
  max-width: 72rem; /* 1152px */
  margin: 0 auto;
  padding-left: clamp(1.5rem, 5vw, 3rem);
  padding-right: clamp(1.5rem, 5vw, 3rem);
  position: relative;
  z-index: 1;
}

.section {
  position: relative;
  padding-top: clamp(4.5rem, 8vw, 8.5rem);
  padding-bottom: clamp(4.5rem, 8vw, 8.5rem);
  overflow: hidden;
  scroll-margin-top: 5.5rem;
  border-top: var(--border-thin);
}

.section--hero {
  border-top: none;
  padding-top: clamp(4rem, 7vw, 7rem);
}

.container > * + * { margin-top: 1.75rem; }

/* Subtle Scanline Texture */
.section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 1px, #000 1px, #000 2px);
  background-size: 100% 4px;
  opacity: 0.015;
  pointer-events: none;
  z-index: 0;
}

/* Subtle Technical Grid */
.section--grid::before {
  background-image:
    linear-gradient(#0000000a 1px, transparent 1px),
    linear-gradient(90deg, #0000000a 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 1;
}

/* Inverted Dark Section */
.section--inverted {
  background: var(--fg);
  color: var(--bg);
}

.section--inverted::before {
  background-image: repeating-linear-gradient(90deg, transparent, transparent 1px, #fff 1px, #fff 2px);
  background-size: 4px 100%;
  opacity: 0.03;
}

/* ===== NAV BAR & SCROLL-SPY ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: var(--border-thin);
  padding: 1.15rem clamp(1.5rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-family: var(--font-mono);
  transition: opacity 120ms ease;
}

.nav__logo:hover {
  opacity: 0.8;
}

.nav__logo-callsign {
  background: var(--fg);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  letter-spacing: 0.1em;
}

.nav__logo-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  list-style: none;
}

.nav__links a {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0;
  position: relative;
  transition: color 150ms ease;
}

.nav__links a::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--fg);
  transition: width 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.nav__links a:hover::after,
.nav__links a.nav-link--active::after {
  width: 100%;
}

@media (max-width: 768px) {
  .nav {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
  }
  .nav__links {
    gap: 0.5rem 1.25rem;
    flex-wrap: wrap;
    width: 100%;
  }
  .section {
    scroll-margin-top: 1rem;
  }
}

/* ===== EYEBROWS & LABELS ===== */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-fg);
  margin-bottom: 0.5rem;
}

.section--inverted .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

/* ===== LEAD ===== */
.lead {
  font-size: clamp(1.125rem, 2vw, 1.35rem);
  line-height: 1.6;
  color: var(--muted-fg);
}

.section--inverted .lead {
  color: rgba(255, 255, 255, 0.75);
}

.hero-cta-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

/* ===== CREDENTIALS BAR ===== */
.credentials-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  border-top: var(--border-thin);
  padding-top: 1.75rem;
  margin-top: 3.5rem;
}

.credential-tag {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border: var(--border-thin);
  background: var(--bg);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.credential-tag:hover {
  transform: translateY(-2px);
  box-shadow: 2px 2px 0px var(--fg);
}

.credential-tag__code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

.credential-tag__sub {
  font-size: 0.8rem;
  color: var(--muted-fg);
}

/* ===== DIVIDERS & RULES ===== */
.rule {
  border: none;
  border-top: var(--border-thick);
  margin: 2.5rem 0;
}

.section--inverted .rule {
  border-top-color: var(--bg);
}

/* ===== PULL QUOTE ===== */
.pull-quote {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.5vw, 1.85rem);
  line-height: 1.35;
  border-left: 4px solid var(--fg);
  padding-left: 1.5rem;
  margin-top: 3rem;
  max-width: 60ch;
}

.section--inverted .pull-quote {
  border-left-color: var(--bg);
}

/* ===== BUTTONS & MECHANICAL FEEDBACK ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.85rem 1.65rem;
  border: var(--border-medium);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  min-height: 46px;
  position: relative;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 60ms ease;
}

.btn:active {
  transform: translate(1px, 1px);
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.btn--primary:hover {
  background: var(--bg);
  color: var(--fg);
}

.btn--outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--fg);
}

.btn--outline:hover {
  background: var(--fg);
  color: var(--bg);
}

.btn--full {
  width: 100%;
}

.btn--copied {
  background: var(--fg) !important;
  color: var(--bg) !important;
}

/* Arrow Slide Micro-interaction */
.btn--arrow .arrow-icon {
  display: inline-block;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.btn--arrow:hover .arrow-icon {
  transform: translate(3px, -3px);
}

/* ===== CARDS & TACTILE HOVER ===== */
.card {
  background: var(--bg);
  color: var(--fg);
  border: var(--border-thin);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.card--solid {
  background: var(--bg);
  border: var(--border-medium);
}

.card__num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted-fg);
}

.card__context {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
  margin-bottom: 0.25rem;
}

.card__media {
  border: var(--border-thin);
  overflow: hidden;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  background: var(--muted);
}

.card__media img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  transition: transform 180ms ease;
}

.card__footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Tactile Inversion on Hover and Focus */
.card--hover-invert:hover,
.card--hover-invert:focus-within {
  background: var(--fg);
  color: var(--bg);
}

.card--hover-invert:hover .card__num,
.card--hover-invert:focus-within .card__num,
.card--hover-invert:hover .card__context,
.card--hover-invert:focus-within .card__context {
  color: rgba(255, 255, 255, 0.75);
}

.card--hover-invert:hover .tag,
.card--hover-invert:focus-within .tag {
  background: transparent;
  border-color: var(--bg);
  color: var(--bg);
}

.card--hover-invert:hover .btn--outline,
.card--hover-invert:focus-within .btn--outline {
  color: var(--bg);
  border-color: var(--bg);
}

.card--hover-invert:hover .btn--outline:hover,
.card--hover-invert:focus-within .btn--outline:hover {
  background: var(--bg);
  color: var(--fg);
}

/* ===== TAGS ===== */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-block;
  border: var(--border-thin);
  padding: 0.25rem 0.6rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.725rem;
  line-height: 1.4;
  background: var(--bg);
  color: var(--fg);
  transition: transform 100ms ease;
}

.tag:hover {
  transform: translateY(-1px);
}

.tag--solid {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.section--inverted .tag {
  background: transparent;
  border-color: var(--bg);
  color: var(--bg);
}

/* ===== CREDENTIALS BOX ===== */
.credentials-box {
  background: #111111;
  border: var(--border-thin);
  border-color: #333333;
  padding: 1.75rem;
}

.credentials-box__title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #333333;
}

.credentials-box__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.9rem;
}

.credentials-box__list strong {
  font-family: var(--font-mono);
  font-weight: 700;
  display: inline-block;
  margin-right: 0.25rem;
}

/* ===== GRIDS ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== CONTACT DIRECT INFO ===== */
.contact-direct-info {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.contact-direct-info code {
  font-family: var(--font-mono);
  background: #EEEEEE;
  padding: 0.15rem 0.4rem;
  border: 1px solid #DDDDDD;
}

/* ===== FOOTER ===== */
.footer {
  border-top: var(--border-thin);
  padding: 2.25rem 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.footer__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer__tags {
  color: var(--muted-fg);
}
