/* ==========================================================================
   Jon Andrian — portfolio styles
   Fixed navy/white brand theme. No framework, no build step.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --navy: #0D1D3B;
  --brand: #2B4C8C;
  --brand-deep: #1C3566;
  --sky: #9CC3F5;
  --ice: #EEF7FC;
  --slate: #4B5870;
  --hairline: #DCE4EF;
  --white: #FFFFFF;
  --error: #B42318;

  --font-head: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --max: 1120px;
  --gutter: 16px;
  --header-h: 68px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13, 29, 59, 0.06), 0 8px 24px rgba(13, 29, 59, 0.06);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.5rem, 7vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.875rem, 4.5vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }

p { margin: 0 0 1em; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-deep); }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

ul[role="list"] { list-style: none; margin: 0; padding: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter); top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 10px; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
@media (min-width: 768px) { .container { padding: 0 32px; } }

.narrow { max-width: 760px; }

.section { padding: 80px 0; }
@media (min-width: 768px) { .section { padding: 112px 0; } }
.section-ice { background: var(--ice); }

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.lead {
  max-width: 640px;
  color: var(--slate);
  font-size: 1.125rem;
  margin-bottom: 40px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-sm { min-height: 40px; padding: 8px 18px; font-size: 0.9375rem; }

.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover { background: var(--brand-deep); color: var(--white); }

.btn-outline { border-color: var(--brand); color: var(--brand); background: transparent; }
.btn-outline:hover { background: var(--brand); color: var(--white); }

.btn-outline-light { border-color: var(--sky); color: var(--white); background: transparent; }
.btn-outline-light:hover { background: var(--sky); color: var(--navy); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
}
.brand:hover { color: var(--navy); }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-mark img, .brand-mark svg { width: 36px; height: 36px; object-fit: contain; }
.fallback-logo { display: none; }
.brand-mark.is-missing img { display: none; }
.brand-mark.is-missing .fallback-logo { display: block; }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a:not(.btn) {
  color: var(--navy);
  font-family: var(--font-head);
  font-weight: 500;
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:not(.btn):hover { color: var(--brand); border-bottom-color: var(--sky); }

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  position: relative;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  position: absolute;
  left: 50%;
  width: 20px; height: 2px;
  margin-left: -10px;
  background: var(--navy);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-bars { top: 50%; margin-top: -1px; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; left: 0; margin-left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 767px) {
  /* Toggle only appears when JS is running; without JS the nav simply wraps. */
  .js .nav-toggle { display: block; }
  .js .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--hairline);
    box-shadow: 0 12px 24px rgba(13, 29, 59, 0.08);
    display: none;
  }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 16px;
  }
  .js .site-nav a:not(.btn) {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid var(--hairline);
  }
  .js .site-nav li:last-child { padding-top: 16px; }
  .js .site-nav .btn { width: 100%; min-height: 48px; }

  html:not(.js) .header-inner { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  html:not(.js) .site-nav ul { gap: 16px; flex-wrap: wrap; }
}

/* ---------- 1. Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  background-color: var(--navy);
  background-image: url(assets/hero-bg.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--white);
  text-align: center;
  padding: 88px 0 96px;
}
@media (min-width: 768px) { .hero { padding: 120px 0 136px; } }

.hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }

.avatar {
  position: relative;
  width: 200px; height: 200px;
  margin-bottom: 32px;
  border-radius: 50%;
  border: 3px solid var(--sky);
  overflow: hidden;
  background: var(--brand-deep);
}
@media (min-width: 768px) { .avatar { width: 240px; height: 240px; } }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback {
  display: none;
  position: absolute; inset: 0;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 3rem;
  font-weight: 700;
  color: var(--sky);
}
.avatar.is-missing img { display: none; }
.avatar.is-missing .avatar-fallback { display: flex; }

.hero h1 { margin-bottom: 12px; }
.hero-sub {
  max-width: 560px;
  margin-bottom: 36px;
  color: var(--sky);
  font-size: clamp(1.125rem, 2.6vw, 1.375rem);
}
.hero .btn-row { justify-content: center; }

/* ---------- 2. About ---------- */
#about p:not(.eyebrow) { color: var(--navy); }
.follow {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}
.follow-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ---------- 3. Projects ---------- */
.cards {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(3, 1fr); align-items: start; }
}

.card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
@media (min-width: 768px) { .card { padding: 32px; } }

.card-tag {
  display: inline-block;
  margin-bottom: 16px;
  padding: 4px 12px;
  background: var(--ice);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--brand);
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.card h3 { margin-bottom: 20px; }
.card h4 {
  margin: 20px 0 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}
.card p { font-size: 1rem; color: var(--slate); }

.card blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--sky);
}
.card blockquote p {
  margin: 0;
  font-style: italic;
  color: var(--navy);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
.chips li {
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--white);
  color: var(--navy);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}

/* ---------- 4. Contracts ---------- */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 768px) {
  .logo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}
.logo-grid li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: 20px 16px;
  text-align: center;
}
.logo-grid img {
  max-height: 64px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
/* Name shows only if the logo image is missing */
.logo-grid span { display: none; }
.logo-grid li.is-missing img { display: none; }
.logo-grid li.is-missing span {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--slate);
  overflow-wrap: anywhere;
}

/* ---------- 5. Contact ---------- */
.contact-grid {
  display: grid;
  gap: 40px;
}
@media (min-width: 900px) {
  .contact-grid { grid-template-columns: 1fr 1.1fr; gap: 64px; align-items: start; }
}
.contact-copy p:not(.eyebrow) { color: var(--slate); }
.contact-email a {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.contact-panel {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: var(--shadow);
}
@media (min-width: 768px) { .contact-panel { padding: 36px; } }

.field { margin-bottom: 20px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9375rem;
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #A9B6CA; /* darker than hairline for 3:1 non-text contrast */
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 1rem;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 0;
  border-color: var(--brand);
}
.field [aria-invalid="true"] { border-color: var(--error); }
.field-error {
  margin: 6px 0 0;
  color: var(--error);
  font-size: 0.875rem;
}

.contact-form .btn { width: 100%; }
@media (min-width: 480px) { .contact-form .btn { width: auto; } }
.contact-form .btn[disabled] { opacity: 0.7; cursor: progress; }

.form-status { margin: 14px 0 0; font-size: 0.9375rem; color: var(--slate); }
.form-status.is-error { color: var(--error); }

.form-success {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  outline: none;
}
.form-success[hidden] { display: none; }
.form-success svg { width: 32px; height: 32px; flex: none; }
.form-success p { margin: 2px 0 0; font-size: 1.125rem; font-weight: 500; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: var(--white);
  padding: 32px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
}
.footer-inner p { margin: 0; font-size: 0.9375rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-links a {
  color: var(--sky);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 500;
}
.footer-links a:hover { color: var(--white); text-decoration: underline; }
.site-footer :focus-visible { outline-color: var(--sky); }
.hero :focus-visible { outline-color: var(--sky); }
