/* ==========================================================================
   Svyatoslav Andriyishen — portfolio
   Deep greens & blues on a beige-to-khaki background.
   ========================================================================== */

:root {
  --bg-top: #f2edde;
  --bg-bottom: #e2d8bc;
  --surface: #faf6ea;
  --edge: rgba(20, 50, 38, 0.14);

  --ink: #25302a;
  --ink-soft: #5b6557;

  --green-900: #143226;
  --green-700: #1f4d3a;
  --green-500: #2f6e54;
  --blue-900: #13283f;
  --blue-700: #1d4263;
  --blue-500: #2d6391;

  --sage: #a7c4b5;
  --sky: #9dbcd8;
  --cream: #f4efdf;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%) fixed;
}

a { color: var(--blue-700); }
a:hover { color: var(--green-700); }

code {
  font-size: 0.9em;
  background: rgba(20, 50, 38, 0.08);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

::selection { background: var(--green-700); color: var(--cream); }

/* --------------------------------------------------------------------------
   Top navigation
   -------------------------------------------------------------------------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(18, 40, 31, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 18px rgba(18, 40, 31, 0.25);
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.topnav .brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sage);
}

.navlinks {
  display: flex;
  gap: 1.5rem;
}

.navlinks a {
  position: relative;
  color: #e9e3d0;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  padding-bottom: 2px;
}

.navlinks a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--sage), var(--sky));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.navlinks a:hover { color: #fff; }
.navlinks a:hover::after { transform: scaleX(1); }

.navlinks .count { opacity: 0.65; font-size: 0.85em; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding: clamp(3rem, 8vw, 5.5rem) 1.5rem 2.5rem;
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(2rem, 5vw, 3.5rem);
  flex-wrap: wrap;
}

.portrait {
  width: clamp(170px, 24vw, 235px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow:
    0 0 0 6px var(--surface),
    0 0 0 9px var(--green-700),
    0 20px 45px rgba(18, 40, 31, 0.28);
}

#hero-content { flex: 1; min-width: 280px; }

.hero h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.05;
  color: var(--green-900);
}

.tagline {
  margin: 0 0 1rem;
  color: var(--blue-700);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 500;
}

.summary {
  max-width: 58ch;
  margin: 0.6rem 0;
  color: var(--ink);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

.hero-tags .chip {
  font-size: 0.88rem;
  padding: 0.32rem 0.9rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border-radius: 999px;
  background: var(--green-700);
  color: var(--cream);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  background: var(--blue-700);
  color: var(--cream);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(19, 40, 63, 0.3);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.page-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem 0;
}

.section-head .overline {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--blue-700);
}

.section-head h2 {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 600;
  color: var(--green-900);
}

.section-head::after {
  content: "";
  display: block;
  width: 76px;
  height: 4px;
  margin-top: 0.8rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--green-700), var(--blue-500));
}

.loading, .load-error, .empty { color: var(--ink-soft); }
.load-error { font-weight: 500; }

/* --------------------------------------------------------------------------
   Resume blocks
   -------------------------------------------------------------------------- */

.resume-block {
  margin-top: 1.7rem;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(18, 40, 31, 0.07);
}

.resume-block-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--green-700);
}

.resume-block-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--edge);
}

.entry {
  position: relative;
  margin-top: 1.5rem;
  padding-left: 1.7rem;
  border-left: 2px solid rgba(31, 77, 58, 0.25);
}

.entry::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.45rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px rgba(45, 99, 145, 0.45);
}

.entry h4 {
  margin: 0;
  font-size: 1.13rem;
  font-weight: 700;
  color: var(--green-900);
}

.entry .org {
  color: var(--blue-700);
  font-weight: 600;
}

.entry .meta {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.entry p { margin: 0.4rem 0; }

.entry ul {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
}

.entry li { margin: 0.3rem 0; }
.entry li::marker { color: var(--green-500); }

/* Loose section content (Skills, Certifications, ...) */

.skill-row {
  display: grid;
  grid-template-columns: 215px 1fr;
  gap: 0.4rem 1.2rem;
  align-items: start;
  margin-top: 1.1rem;
}

.skill-label {
  font-weight: 650;
  color: var(--green-900);
  padding-top: 0.18rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-block;
  padding: 0.2rem 0.72rem;
  border-radius: 999px;
  background: rgba(29, 66, 99, 0.09);
  border: 1px solid rgba(29, 66, 99, 0.28);
  color: var(--blue-900);
  font-size: 0.83rem;
  font-weight: 500;
}

.loose-list {
  margin: 1rem 0 0;
  padding-left: 1.15rem;
}

.loose-list li { margin: 0.35rem 0; }
.loose-list li::marker { color: var(--green-500); }

.resume-block > p { margin: 0.9rem 0 0; }

/* --------------------------------------------------------------------------
   Project cards
   -------------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.7rem;
  margin-top: 1.7rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(18, 40, 31, 0.07);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

a.card:hover {
  transform: translateY(-5px);
  border-color: var(--green-500);
  box-shadow: 0 18px 40px rgba(18, 40, 31, 0.16);
  color: var(--ink);
}

.card-img {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--edge);
}

.card-img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-700), var(--blue-700));
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.card-img-fallback.alt {
  background: linear-gradient(135deg, var(--blue-700), var(--green-500));
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.2rem 1.3rem 1.3rem;
}

.card-date {
  margin: 0 0 0.3rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-700);
}

.card-body h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--green-900);
}

.card-desc {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.card-tags .chip { font-size: 0.78rem; }

.card-cta {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green-700);
}

a.card:hover .card-cta { color: var(--blue-700); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

footer {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding: 2.5rem 1.5rem;
  background: var(--blue-900);
  color: #dee5da;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-name {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cream);
}

.footnote { margin: 0; font-size: 0.85rem; opacity: 0.75; }

.footnote code { background: rgba(255, 255, 255, 0.12); color: var(--cream); }

.footer-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }

.footer-links a {
  color: var(--sky);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.footer-links a:hover { color: #fff; text-decoration: underline; }

/* --------------------------------------------------------------------------
   Reveal animation
   -------------------------------------------------------------------------- */

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

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

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

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .hero-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  #hero-content { min-width: 0; width: 100%; }
  .hero-links { justify-content: center; }
  .hero-tags { justify-content: center; }
  .summary { margin-left: auto; margin-right: auto; }
  .skill-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .topnav .brand span { display: none; }
}

/* --------------------------------------------------------------------------
   Print: resume only, ink-friendly
   -------------------------------------------------------------------------- */

@media print {
  body { background: #fff; color: #000; }
  .topnav, .hero-links, #projects, footer, .portrait { display: none; }
  .hero, .page-section { padding: 0.5rem 0; max-width: none; }
  .resume-block {
    border: none;
    box-shadow: none;
    padding: 0.5rem 0;
    break-inside: avoid;
    background: #fff;
  }
  .reveal { opacity: 1; transform: none; }
  a { color: #000; text-decoration: none; }
}
