/* ==========================================================================
   Enrico Resaba — portfolio
   1. Fonts   2. Tokens   3. Base   4. Layout   5. Header   6. Hero
   7. Sections   8. Work   9. Technologies   10. Contact   11. Footer
   12. Utilities   13. Motion
   ========================================================================== */

/* 1. Fonts (self-hosted, SIL Open Font License) -------------------------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
}

/* 2. Tokens --------------------------------------------------------------- */
:root {
  --bg: #f5f3ee;
  --surface: #faf9f6;
  --ink: #141413;
  --ink-soft: #3b3a37;
  --muted: #65625b;      /* 5.4:1 on --bg */
  --line: #d9d5cb;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: "DM Sans", ui-sans-serif, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: clamp(1.25rem, 1.05rem + 0.9vw, 1.625rem);
  --text-xl: clamp(1.75rem, 1.2rem + 2.6vw, 3rem);
  --text-hero: clamp(1.75rem, 8.4vw, 5.75rem);

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --section-space: clamp(4rem, 10vw, 8rem);
  --max-width: 70rem;
  --header-height: 4rem;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.1;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

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

/* 5. Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  min-height: var(--header-height);
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding-block: 0.75rem;
}

.nav {
  display: flex;
  gap: clamp(1rem, 4vw, 2.25rem);
}

.nav a {
  display: inline-block;
  padding-block: 0.75rem;
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: underline transparent;
}

.nav a:hover,
.nav a[aria-current] {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* 6. Hero ----------------------------------------------------------------- */
.hero {
  padding-block: clamp(4.5rem, 14vw, 10rem) var(--section-space);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow__dot {
  width: 0.4375rem;
  height: 0.4375rem;
  background: var(--ink);
  flex: none;
}

.hero h1 {
  margin-top: 1.75rem;
  font-size: var(--text-hero);
  line-height: 1;
  letter-spacing: -0.04em;
  text-wrap: wrap;
}

.hero h1 span {
  display: block;
}

.hero__lead {
  max-width: 36rem;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--ink-soft);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: clamp(2rem, 5vw, 3rem);
}

.button {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.button:hover {
  background: transparent;
  color: var(--ink);
}

.arrow-link {
  display: inline-block;
  padding-block: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration-color: var(--line);
}

.arrow-link:hover {
  text-decoration-color: currentColor;
}

.arrow-link span {
  display: inline-block;
  transition: transform 0.2s var(--ease);
}

.arrow-link:hover span {
  transform: translateX(3px);
}

/* 7. Sections ------------------------------------------------------------- */
.section {
  display: grid;
  gap: 2rem;
  padding-block: var(--section-space);
  position: relative;
}

/* Hairline above each section, inset to the container gutter */
.section::before {
  content: "";
  position: absolute;
  inset: 0 var(--gutter) auto;
  border-top: 1px solid var(--line);
}

.section__label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.65;
  text-transform: uppercase;
  color: var(--muted);
}

.section__body {
  min-width: 0;
}

@media (min-width: 56rem) {
  .section {
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 3rem;
  }

  .section__label {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    align-self: start;
  }
}

.prose {
  max-width: 40rem;
}

.prose p + p {
  margin-top: 1.25em;
}

.prose p {
  color: var(--ink-soft);
}

.prose .prose__lead {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

/* 8. Work ----------------------------------------------------------------- */
/* 1px gaps over a line-coloured background draw the hairlines between cards */
.projects {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

@media (min-width: 40rem) {
  .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--bg);
}

.project__media {
  display: block;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.project__media img {
  display: block;
  width: 100%;
  height: auto;
}

/* A featured project spans the grid and puts its image beside the text */
.project--feature {
  grid-column: 1 / -1;
}

/* An odd card left alone on the last row fills the row */
@media (min-width: 40rem) {
  .project--feature ~ .project:last-child:nth-child(even) {
    grid-column: 1 / -1;
  }
}

.project__body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (min-width: 40rem) {
  .project--feature {
    flex-direction: row-reverse;
    align-items: stretch;
    gap: clamp(1.5rem, 4vw, 2.25rem);
  }

  .project--feature .project__media {
    flex: 0 0 52%;
    align-self: center;
    margin-bottom: 0;
  }
}

.project__index {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.project__title {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  font-size: var(--text-lg);
  letter-spacing: -0.015em;
}

.project__desc {
  margin-top: 0.75rem;
  margin-bottom: 1.75rem;
  color: var(--ink-soft);
}

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

.tags li {
  padding: 0.1875rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.25rem;
}

/* 9. Technologies --------------------------------------------------------- */
.stack {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 40rem) {
  .stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
  }
}

.stack__title {
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--ink);
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

.stack__group li {
  padding-block: 0.6875rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

/* 10. Contact ------------------------------------------------------------- */
.contact__headline {
  max-width: 16ch;
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
}

.contact__lead {
  max-width: 34rem;
  margin-top: 1.5rem;
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--ink-soft);
}

.contact__links {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--line);
}

.contact__links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding-block: 1.125rem;
  border-bottom: 1px solid var(--line);
}

.contact__kind {
  flex: 0 0 6.5rem;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact__links a {
  min-width: 0;
  overflow-wrap: anywhere; /* long email addresses wrap on very narrow screens */
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-decoration-color: transparent;
}

.contact__links a:hover {
  text-decoration-color: currentColor;
}

/* 11. Footer -------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding-block: 1.5rem;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* 12. Utilities ----------------------------------------------------------- */
.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0.75rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--bg);
  font-size: var(--text-sm);
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
}

/* Marks links that still point at placeholder URLs.
   Delete the data-placeholder attribute in the HTML once the link is real. */
[data-placeholder]::after {
  content: "placeholder";
  display: inline-block;
  margin-left: 0.625rem;
  padding: 0.0625rem 0.4375rem;
  border: 1px dashed var(--muted);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: middle;
}

/* 404 page */
.not-found {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-block: var(--section-space);
}

.not-found h1 {
  margin-block: 1.5rem;
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
}

.not-found p:not(.eyebrow) {
  margin-bottom: 2rem;
  color: var(--ink-soft);
}

/* 13. Motion -------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .arrow-link:hover span {
    transform: none;
  }
}

@media print {
  .site-header {
    position: static;
  }

  .skip-link,
  [data-placeholder]::after {
    display: none;
  }
}
