/* =============================================================
   Personal landing page — stylesheet
   Design direction: "engineering precision"
   - Prussian ink neutrals on cool technical paper
   - One restrained accent (cobalt), no second hue
   - Signature: registration crosshairs + monospaced micro-labels
   ============================================================= */

/* -------------------------------------------------------------
   1. Design tokens
   ------------------------------------------------------------- */
:root {
  /* Typography */
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs:   0.75rem;   /* 12px — micro-labels */
  --text-sm:   0.8125rem; /* 13px — tags, captions */
  --text-base: 1rem;
  --text-md:   clamp(1.0625rem, 1.02rem + 0.22vw, 1.1875rem);
  --text-lg:   clamp(1.125rem, 1.06rem + 0.34vw, 1.3125rem);
  --text-xl:   clamp(1.375rem, 1.24rem + 0.6vw, 1.75rem);
  --text-2xl:  clamp(1.75rem, 1.5rem + 1.15vw, 2.5rem);
  --text-3xl:  clamp(2.125rem, 1.6rem + 2.4vw, 3.375rem);

  /* Colour — cool prussian neutrals */
  --c-bg:          #edf1f6;
  --c-surface:     #ffffff;
  --c-surface-2:   #f7f9fc;
  --c-ink:         #0e2138;
  --c-body:        #3f5169;
  --c-muted:       #556a85;
  --c-line:        #d3dce8;
  --c-line-soft:   #e4eaf2;

  /* Colour — single accent */
  --c-accent:      #1355c6;
  --c-accent-deep: #0e44a0;
  --c-accent-soft: #e1ebfb;
  --c-focus:       #0e44a0;

  /* Contextual (overridden per band) */
  --card-bg:    var(--c-surface);
  --card-line:  var(--c-line);
  --ph-bg:      var(--c-accent-soft);
  --ph-line:    #9dbcee;
  --ph-color:   var(--c-accent-deep);

  /* Space scale (4px base) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(14, 33, 56, 0.05);
  --shadow-md: 0 12px 32px -18px rgba(14, 33, 56, 0.35);

  /* Signature crosshair (registration mark) */
  --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9'%3E%3Cpath d='M4.5 0v9M0 4.5h9' stroke='%231355c6' stroke-width='1'/%3E%3C/svg%3E");

  --shell: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

/* -------------------------------------------------------------
   2. Base
   ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--c-bg);
  color: var(--c-body);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--c-ink);
  line-height: 1.16;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p {
  margin: 0;
}

ul,
dl {
  margin: 0;
  padding: 0;
  list-style: none;
}

dd {
  margin: 0;
}

svg {
  display: block;
}

a {
  color: var(--c-accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

/* -------------------------------------------------------------
   3. Layout primitives
   ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(3.5rem, 8vw, 7rem);
  scroll-margin-top: 2rem;
}

.section--alt {
  background-color: var(--c-surface);
  --card-bg: var(--c-surface-2);
}

.section__title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

/* Signature: registration mark next to a section heading.
   Inline on narrow screens, hung into the gutter once there is room,
   so headings stay flush with the body text below them. */
.mark {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.7em;
}

.mark::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  background-image: var(--mark);
  transform: translateY(-0.25em);
}

/* Placeholder — must stay visible until replaced by hand */
.ph {
  display: inline-block;
  padding-inline: 0.35em;
  border: 1px dashed var(--ph-line);
  border-radius: var(--radius-sm);
  background-color: var(--ph-bg);
  color: var(--ph-color);
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 400;
  letter-spacing: 0;
}

/* -------------------------------------------------------------
   4. Hero
   ------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(4rem, 13vw, 8.5rem) clamp(4rem, 10vw, 7rem);
  border-bottom: 1px solid var(--c-line);
}

.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--c-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--c-line) 1px, transparent 1px);
  background-size: 72px 72px;
  background-position: center top;
  opacity: 0.75;
  -webkit-mask-image: radial-gradient(125% 105% at 10% 0%, #000 0%, rgba(0, 0, 0, 0.35) 45%, transparent 78%);
  mask-image: radial-gradient(125% 105% at 10% 0%, #000 0%, rgba(0, 0, 0, 0.35) 45%, transparent 78%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
}

.hero__text {
  max-width: 46rem;
}

.hero__name {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--c-ink);
}

.hero__status {
  margin-top: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-muted);
  letter-spacing: 0.02em;
}

.hero__dot {
  color: var(--c-accent);
  padding-inline: 0.15em;
}

.hero__title {
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  /* Natural wrapping beats balance here: with the portrait beside it, balance
     evens the headline into four short lines instead of three full ones. */
  text-wrap: wrap;
}

.hero__lead {
  margin-top: var(--sp-5);
  max-width: 40rem;
  font-size: var(--text-lg);
  line-height: 1.6;
}

.hero .button {
  margin-top: clamp(2rem, 5vw, 2.75rem);
}

/* -------------------------------------------------------------
   5. Portrait — photo in a drawing frame, corners marked
   ------------------------------------------------------------- */
.portrait {
  position: relative;
  margin: 0;
}

.portrait::before {
  content: "";
  position: absolute;
  inset: -5px;
  background-image: var(--mark), var(--mark), var(--mark), var(--mark);
  background-repeat: no-repeat;
  background-position: 0 0, 100% 0, 0 100%, 100% 100%;
  background-size: 9px 9px;
  pointer-events: none;
  z-index: 1;
}

.portrait__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-line);
  background-color: var(--c-surface-2);
  box-shadow: var(--shadow-md);
  object-fit: cover;
}

.hero__portrait {
  max-width: 17rem;
}

.hero__portrait .portrait__img {
  aspect-ratio: 4 / 5;
}

.about__photo .portrait__img {
  aspect-ratio: 4 / 3;
}

/* -------------------------------------------------------------
   6. Button
   ------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-md);
  background-color: var(--c-accent);
  color: #fff;
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.button:hover {
  background-color: var(--c-accent-deep);
  transform: translateY(-1px);
}

.button__icon {
  transition: transform 0.2s ease;
}

.button:hover .button__icon {
  transform: translateX(3px);
}

/* The default ring is accent-on-accent here — swap it for ink */
.button:focus-visible {
  outline-color: var(--c-ink);
}

/* -------------------------------------------------------------
   7. About
   ------------------------------------------------------------- */
.about {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
}

.about__photo {
  max-width: 28rem;
}

.prose {
  max-width: 42rem;
  display: grid;
  gap: var(--sp-5);
  font-size: var(--text-md);
  line-height: 1.75;
}

/* -------------------------------------------------------------
   8. Skill cards
   ------------------------------------------------------------- */
.cards {
  display: grid;
  gap: var(--sp-4);
}

.cards--support {
  margin-top: var(--sp-4);
}

.card {
  position: relative;
  padding: var(--sp-5);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: var(--sp-4);
  border-radius: var(--radius-sm);
  background-color: var(--c-surface);
  border: 1px solid var(--c-line);
  color: var(--c-muted);
}

.card__title {
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card__text {
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--c-body);
}

/* Lead cards — the two key competences */
.card--lead {
  padding: var(--sp-5);
  border-color: #c6d7f2;
  background-color: var(--c-surface);
  box-shadow: var(--shadow-md);
}

/* Registration marks in the corners — the page signature */
.card--lead::before {
  content: "";
  position: absolute;
  inset: -5px;
  background-image: var(--mark), var(--mark), var(--mark), var(--mark);
  background-repeat: no-repeat;
  background-position: 0 0, 100% 0, 0 100%, 100% 100%;
  background-size: 9px 9px;
  pointer-events: none;
}

.card--lead .card__icon {
  background-color: var(--c-accent-soft);
  border-color: #c6d7f2;
  color: var(--c-accent);
}

.card--lead .card__title {
  font-size: var(--text-lg);
}

.card--lead .card__text {
  font-size: var(--text-base);
}

/* -------------------------------------------------------------
   9. Stack
   ------------------------------------------------------------- */
.stack {
  border-top: 1px solid var(--c-line);
}

.stack__row {
  display: grid;
  gap: var(--sp-3);
  padding-block: var(--sp-4);
  border-bottom: 1px solid var(--c-line);
}

.stack__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--c-muted);
  padding-top: 0.35rem;
}

.stack__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  background-color: var(--c-surface);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-ink);
}

/* -------------------------------------------------------------
   10. Projects & stats
   ------------------------------------------------------------- */
.projects {
  display: grid;
  gap: var(--sp-4);
}

.project {
  padding: var(--sp-5);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  background-color: var(--card-bg);
}

.project::before {
  content: "";
  display: block;
  width: 28px;
  height: 2px;
  margin-bottom: var(--sp-4);
  background-color: var(--c-accent);
  border-radius: 2px;
}

.project__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4em;
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1.35;
}

.project__kind {
  font-weight: 400;
  color: var(--c-body);
}

.project__text {
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.7;
}

.stats {
  position: relative;
  display: grid;
  gap: var(--sp-5);
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: var(--sp-5);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  background-color: var(--card-bg);
}

.stats::before {
  content: "";
  position: absolute;
  inset: -5px;
  background-image: var(--mark), var(--mark), var(--mark), var(--mark);
  background-repeat: no-repeat;
  background-position: 0 0, 100% 0, 0 100%, 100% 100%;
  background-size: 9px 9px;
  pointer-events: none;
}

.stat {
  display: grid;
  gap: var(--sp-1);
}

.stat__value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.1;
  color: var(--c-ink);
  justify-self: start;
}

.stat__label {
  font-size: var(--text-sm);
  color: var(--c-muted);
}

/* -------------------------------------------------------------
   11. Principles
   ------------------------------------------------------------- */
.principles {
  display: grid;
  gap: var(--sp-5);
}

.principle {
  padding-top: var(--sp-4);
  border-top: 2px solid var(--c-ink);
  max-width: 34rem;
}

.principle__title {
  font-size: var(--text-md);
  font-weight: 700;
}

.principle__text {
  margin-top: var(--sp-2);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* -------------------------------------------------------------
   12. Footer / contacts
   ------------------------------------------------------------- */
.footer {
  padding-block: clamp(3.5rem, 8vw, 6rem);
  background-color: var(--c-ink);
  color: #c3cfdf;
  scroll-margin-top: 0;

  --c-focus: #93b4f2;
  --ph-bg: rgba(147, 180, 242, 0.12);
  --ph-line: #4d6a94;
  --ph-color: #a9c4f4;
}

.footer__title {
  color: #fff;
  font-size: var(--text-xl);
  font-weight: 700;
}

.footer__lead {
  margin-top: var(--sp-3);
  font-size: var(--text-md);
  color: #c3cfdf;
}

/* Wrapping row, not a fixed set of columns: contact labels carry real
   addresses of unpredictable length and must never force a page-wide scroll. */
.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: clamp(2rem, 5vw, 2.75rem);
}

.contacts > li {
  flex: 1 1 100%;
}

.contact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #2a3f5c;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.03);
  color: #fff;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.contact:hover {
  background-color: rgba(255, 255, 255, 0.07);
  border-color: #43608a;
}

.contact__icon {
  flex: none;
  color: #93b4f2;
}

.contact__label {
  font-weight: 600;
}

.footer__note {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  padding-top: var(--sp-4);
  border-top: 1px solid #24384f;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #8ea3bd;
}

.footer__sep {
  color: #93b4f2;
  padding-inline: 0.25em;
}

/* -------------------------------------------------------------
   13. Breakpoints
   ------------------------------------------------------------- */
@media (min-width: 40em) {
  .mark::before {
    position: absolute;
    left: -1.5rem;
    top: 0.44em;
    transform: none;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
    padding-block: var(--sp-6);
  }

  .stack__row {
    grid-template-columns: 11rem 1fr;
    gap: var(--sp-4);
    align-items: start;
  }

  .contacts > li {
    flex: 0 1 auto;
  }
}

@media (min-width: 56em) {
  .about {
    grid-template-columns: minmax(0, 1fr) clamp(16rem, 30%, 22rem);
    align-items: start;
  }

  .about__photo {
    max-width: none;
  }

  .cards--lead,
  .cards--support {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-5);
  }

  .cards--support {
    margin-top: var(--sp-5);
  }

  .card--lead {
    padding: var(--sp-6);
  }

  .projects {
    gap: var(--sp-4);
  }

  /* Spec-sheet row: title column, description column */
  .project {
    display: grid;
    grid-template-columns: 18rem 1fr;
    column-gap: var(--sp-6);
    align-items: start;
    padding: var(--sp-6);
  }

  .project::before {
    grid-column: 1 / -1;
  }

  .project__title {
    display: block;
  }

  .project__kind {
    display: block;
    margin-top: 0.35em;
    font-size: var(--text-sm);
  }

  .project__text {
    margin-top: 0;
    padding-top: 0.2rem;
    max-width: 34rem;
    font-size: var(--text-base);
  }

  .principles {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-5);
  }

  .section__title {
    font-size: var(--text-2xl);
  }
}

/* Hero splits into text + portrait only when the text column is still wide
   enough for the headline to hold three full lines; below that the photo
   sits under the text and the headline keeps the first screen. */
@media (min-width: 60em) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr) clamp(14rem, 25vw, 20rem);
    align-items: center;
    gap: clamp(2.5rem, 6vw, 5rem);
  }

  .hero__portrait {
    max-width: none;
  }
}

/* -------------------------------------------------------------
   14. Motion — one orchestrated moment, nothing scattered
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .hero__step {
    animation: rise 0.65s cubic-bezier(0.22, 0.7, 0.3, 1) both;
  }

  .hero__text > .hero__step:nth-child(2) { animation-delay: 0.07s; }
  .hero__text > .hero__step:nth-child(3) { animation-delay: 0.14s; }
  .hero__text > .hero__step:nth-child(4) { animation-delay: 0.22s; }
  .hero__text > .hero__step:nth-child(5) { animation-delay: 0.32s; }
  .hero__portrait { animation-delay: 0.18s; }
}

/* Scroll reveal applies only when JS can switch it back on */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 0.7, 0.3, 1);
  }

  .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button:hover,
  .button:hover .button__icon {
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
