/* ========================================
   Phase 2 — Portfolio styles
   Direction: light studio, ink + teal accent
   ======================================== */

@import url("https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,600;1,7..72,400&family=Syne:wght@500;600;700;800&display=swap");

/* --- 2.1 Reset / normalize --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* --- 2.2 Variables --- */
:root {
  --bg: #edf1ec;
  --bg-deep: #dfe6dc;
  --ink: #14201a;
  --ink-soft: #3d4a42;
  --muted: #5f6d64;
  --accent: #0f6b5c;
  --accent-hover: #0a5247;
  --surface: rgba(255, 255, 255, 0.42);
  --line: rgba(20, 32, 26, 0.12);
  --font-display: "Syne", sans-serif;
  --font-body: "Literata", Georgia, serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --max: 68rem;
  --header-h: 4.25rem;
  --radius: 0.35rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- 2.3 / 2.4 Page shell + typography --- */
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(15, 107, 92, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgba(90, 110, 80, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 48%, #e7ebe4 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
.brand,
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

p {
  color: var(--ink-soft);
  max-width: 38rem;
}

p + p {
  margin-top: var(--space-sm);
}

section {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  padding-block: var(--space-xl);
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}

/* --- 2.5 Header / sticky nav --- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: var(--header-h);
  padding: 0.75rem 1.25rem;
  background: rgba(237, 241, 236, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.logo {
  font-size: 1.15rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
}

#site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  padding: var(--space-sm) 1.25rem var(--space-md);
  background: rgba(237, 241, 236, 0.96);
  border-bottom: 1px solid var(--line);
}

header.nav-open #site-nav {
  display: block;
}

#site-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#site-nav a {
  display: inline-block;
  padding: 0.55rem 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  position: relative;
}

#site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0.35rem;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

#site-nav a:hover::after,
#site-nav a:focus-visible::after,
#site-nav a.active::after {
  transform: scaleX(1);
}

#site-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* --- 2.6 Hero --- */
#hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: var(--space-lg);
  background:
    linear-gradient(120deg, transparent 40%, rgba(15, 107, 92, 0.06) 100%);
}

.brand {
  font-size: clamp(3rem, 12vw, 7.5rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: var(--ink);
  margin-bottom: var(--space-md);
  animation: rise-in 0.9s var(--ease) both;
}

#hero-heading {
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 600;
  max-width: 22ch;
  margin-bottom: var(--space-sm);
  animation: rise-in 0.9s var(--ease) 0.12s both;
}

.hero-lede {
  font-size: 1.1rem;
  max-width: 34rem;
  margin-bottom: var(--space-md);
  animation: rise-in 0.9s var(--ease) 0.22s both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise-in 0.9s var(--ease) 0.32s both;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.35rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
    color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.button-primary {
  background: var(--accent);
  color: #f4faf7;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent-hover);
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
}

/* --- 2.7 About --- */
#about {
  display: grid;
  gap: var(--space-md);
  border-top: 1px solid var(--line);
}

#about h2 {
  grid-column: 1 / -1;
}

#about img {
  width: min(100%, 18rem);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(15, 107, 92, 0.18), rgba(20, 32, 26, 0.08));
  border: 1px solid var(--line);
}

#about p {
  font-size: 1.1rem;
}

/* --- 2.8 Projects --- */
#projects {
  border-top: 1px solid var(--line);
}

#projects article {
  padding-block: var(--space-md);
  border-bottom: 1px solid var(--line);
}

#projects article:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

#projects h3 {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
}

#projects article p {
  margin-bottom: var(--space-sm);
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: var(--space-sm);
  color: var(--muted);
  font-size: 0.92rem;
}

.tech-tags li {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
}

#projects article > a {
  font-family: var(--font-display);
  font-weight: 650;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

#projects article > a:hover,
#projects article > a:focus-visible {
  border-bottom-color: var(--accent);
  outline: none;
}

/* --- 2.9 Skills --- */
#skills {
  border-top: 1px solid var(--line);
  display: grid;
  gap: var(--space-md);
}

#skills h2 {
  grid-column: 1 / -1;
}

#skills h3 {
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

#skills ul li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

#skills ul li:last-child {
  border-bottom: none;
}

/* --- 2.10 Contact + Footer --- */
#contact {
  border-top: 1px solid var(--line);
}

#contact > p {
  margin-bottom: var(--space-md);
  font-size: 1.1rem;
}

#contact ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#contact a {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.15rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

#contact a:hover,
#contact a:focus-visible {
  border-bottom-color: var(--accent);
  outline: none;
}

/* Contact page */
.contact-page {
  border-top: none;
  min-height: calc(100vh - var(--header-h) - 8rem);
  padding-top: var(--space-lg);
}

.contact-kicker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.contact-page h1 {
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  max-width: 16ch;
  margin-bottom: var(--space-sm);
  animation: rise-in 0.8s var(--ease) both;
}

.contact-lede {
  max-width: 36rem;
  margin-bottom: var(--space-lg);
  animation: rise-in 0.8s var(--ease) 0.1s both;
}

.contact-layout {
  display: grid;
  gap: var(--space-lg);
  animation: rise-in 0.8s var(--ease) 0.18s both;
}

.contact-form {
  display: grid;
  gap: var(--space-md);
  max-width: 34rem;
}

.form-field {
  display: grid;
  gap: 0.45rem;
}

.form-field label {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.95rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.form-field input:hover,
.form-field textarea:hover {
  border-color: rgba(15, 107, 92, 0.35);
}

.form-field input:focus-visible,
.form-field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
}

.form-field textarea {
  resize: vertical;
  min-height: 9rem;
}

.contact-form .button {
  justify-self: start;
}

.form-note {
  min-height: 1.4em;
  font-size: 0.95rem;
  color: var(--accent);
}

.contact-aside h2 {
  font-size: 1.15rem;
  margin-bottom: var(--space-sm);
}

.contact-aside a {
  font-size: 1.05rem;
}

#site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  padding: var(--space-lg) 0 var(--space-xl);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

footer a {
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.25s var(--ease);
}

footer a:hover,
footer a:focus-visible {
  color: var(--accent);
  outline: none;
}

/* --- 2.12 Motion --- */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(1.1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- 2.11 Responsive --- */
@media (min-width: 640px) {
  #about {
    grid-template-columns: 18rem 1fr;
    align-items: start;
  }

  #about h2 {
    grid-column: 1 / -1;
  }

  #skills {
    grid-template-columns: repeat(3, 1fr);
  }

  #contact ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem 2rem;
  }

  .contact-layout {
    grid-template-columns: 1.4fr 0.8fr;
    align-items: start;
    gap: var(--space-xl);
  }

  .contact-aside ul {
    flex-direction: column;
    gap: 0.85rem;
  }

  footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 900px) {
  header {
    padding-inline: max(1.5rem, calc((100% - var(--max)) / 2));
  }

  .nav-toggle {
    display: none;
  }

  #site-nav {
    position: static;
    display: block;
    padding: 0;
    background: none;
    border: none;
  }

  #site-nav ul {
    flex-direction: row;
    gap: 1.5rem;
  }

  #site-nav a {
    padding: 0.25rem 0;
  }

  #site-nav a::after {
    bottom: 0;
  }

  section {
    width: min(100% - 3rem, var(--max));
  }

  #hero {
    padding-block: var(--space-xl);
  }

  #projects article {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: auto auto auto;
    column-gap: var(--space-lg);
    row-gap: var(--space-xs);
    align-items: start;
  }

  #projects article h3 {
    grid-column: 1;
    grid-row: 1;
  }

  #projects article p {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
  }

  #projects article .tech-tags {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
  }

  #projects article > a {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
  }
}
