/* ============================================================
   PORTFOLIO STYLES
   ------------------------------------------------------------
   Palette + type are driven by CSS variables in :root, with a
   .dark override block for dark mode. You rarely need to edit
   this file — content lives in projects.js.
   ============================================================ */

/* ---------- Theme tokens (light) ---------- */
:root {
  /* Surfaces */
  --bg: #F2E9DE;            /* paper-cream page background */
  --surface: #FBF6EE;       /* card surface */
  --band: #EFE7DA;          /* About section band */
  --contact-bg: #EDE4D7;    /* quiet contact panel */

  /* Text */
  --ink: #2A2018;           /* main heading / strong text */
  --body: #544A3E;          /* body copy */
  --muted: #6B5D4F;         /* muted text */
  --muted-2: #7A6E5E;       /* subtitles */

  /* Accent */
  --accent: #7A341E;        /* terracotta — buttons, active pill */
  --accent-ink: #F2E9DE;    /* text on the accent */
  --link: #B5572E;          /* links */

  /* Tags */
  --tag-health-bg: #D9E8DD;
  --tag-health-ink: #1E3A2E;
  --tag-other-bg: #EDE0CC;
  --tag-other-ink: #7A341E;

  /* Lines & decoration */
  --border: #E4D8C5;        /* card borders */
  --border-strong: #C3B29C; /* ghost-button / pill borders */
  --hairline: rgba(0, 0, 0, 0.08);
  --avatar-ring: #E3D6C2;
  --avatar-bg: #EBE0CE;
  --avatar-icon: #B09A7C;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.10);

  /* Type — Newsreader serif headings, Inter body/UI. */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;

  /* Layout */
  --maxw: 1080px;
  --radius: 14px;
  --radius-sm: 8px;
}

/* ---------- Theme tokens (dark) ---------- */
.dark {
  --bg: #17120E;
  --surface: #221C16;
  --band: #1E1813;
  --contact-bg: #1E1813;

  --ink: #F0E7D9;
  --body: #D8CBB9;
  --muted: #B3A491;
  --muted-2: #9C8E7B;

  --accent: #C25A38;
  --accent-ink: #1A1410;
  --link: #E08A5A;

  --tag-health-bg: #28392F;
  --tag-health-ink: #A9D6BE;
  --tag-other-bg: #3A2E22;
  --tag-other-ink: #E0A074;

  --border: #38302A;
  --border-strong: #4A4038;
  --hairline: rgba(255, 255, 255, 0.08);
  --avatar-ring: #3A3128;
  --avatar-bg: #2A231C;
  --avatar-icon: #8C7B66;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 17px;          /* large, comfortable base — easy on the eyes */
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-weight: 500;            /* Newsreader reads well at 500 */
  letter-spacing: -0.01em;
  line-height: 1.18;
}

a { color: var(--link); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}

/* Offset anchored sections so the sticky header doesn't cover them. */
#projects, #about, #contact, #top { scroll-margin-top: 84px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 0.5px solid var(--hairline);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--ink); }

/* Dark-mode toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0.5px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  padding-top: 64px;
  padding-bottom: 56px;
}

.hero-text { flex: 1; }

.hero-eyebrow {
  margin: 0 0 16px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--link);
  font-weight: 600;
}

.hero-title {
  margin: 0 0 20px;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 600;            /* confident serif headline */
  letter-spacing: -0.015em;
  max-width: 14ch;
}

.hero-intro {
  margin: 0 0 28px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--body);
  max-width: 34em;
  white-space: pre-line;   /* honor line breaks (\n) typed in the intro */
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Avatar circle (placeholder until profile.avatar is set) */
.hero-avatar {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid var(--avatar-ring);
  background: var(--avatar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-avatar svg { width: 64px; height: 64px; color: var(--avatar-icon); }
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 0.5px solid transparent;
  transition: transform 0.15s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: 0.92; }

.btn-ghost {
  background: transparent;
  color: var(--body);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--ink); }

.btn svg { width: 17px; height: 17px; }

/* ---------- Section heads ---------- */
.section { padding-top: 24px; padding-bottom: 48px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 26px;
}

.section-title { margin: 0 0 4px; font-size: 30px; }
.section-subtitle { margin: 0; font-size: 16px; color: var(--muted-2); }

/* ---------- Filter pills ---------- */
.filters { display: flex; gap: 8px; }

.filter {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  border: 0.5px solid var(--border-strong);
  color: var(--muted);
  background: transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter:hover { color: var(--ink); }
.filter.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.filter:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- Project grid + cards ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease;
}

/* Card hover: lift ~5px with a soft shadow */
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

/* Coloured thumbnail panel (placeholder icon, or real screenshot) */
.card-thumb {
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-thumb svg {
  width: 40px;
  height: 40px;
  transition: transform 0.4s ease;   /* icon scales on hover */
}
.card:hover .card-thumb svg { transform: scale(1.06); }

.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 18px 18px 20px; }

.card-title {
  margin: 0 0 6px;
  font-family: var(--font-sans);   /* titles stay in the UI font, like the mockup */
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.card-desc {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
}

/* Tag pills */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--tag-other-bg);
  color: var(--tag-other-ink);
}
.tag.tag-health { background: var(--tag-health-bg); color: var(--tag-health-ink); }

/* "Live demo" / "View on GitHub" link */
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

.card-link svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;  /* arrow nudges up-right on hover */
}
.card:hover .card-link svg { transform: translate(2px, -2px); }
.card-link:hover { text-decoration: underline; }

/* ---------- About band ---------- */
.section-band {
  background: var(--band);
  border-top: 0.5px solid var(--hairline);
  border-bottom: 0.5px solid var(--hairline);
  padding: 56px 0;
}

.about .section-title { margin-bottom: 18px; }
.about p {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.8;
  color: var(--body);
  max-width: 60ch;
}
.about p:last-child { margin-bottom: 0; }

/* ---------- Contact (quiet panel) ---------- */
.contact {
  background: var(--contact-bg);
  border-bottom: 0.5px solid var(--hairline);
  padding: 56px 0;
  text-align: center;
}

.contact-title { margin: 0 0 8px; font-size: 26px; }
.contact-line {
  margin: 0 auto 24px;
  max-width: 30em;
  font-size: 16px;
  color: var(--muted);
}

.contact-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Small icon-only social button (e.g. LinkedIn) */
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0.5px solid var(--border-strong);
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.icon-link:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-2px); }
.icon-link:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.icon-link svg { width: 20px; height: 20px; }

/* Contact form (Formspree) */
.contact-form {
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.contact-form textarea { resize: vertical; min-height: 120px; }

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--link);
  outline-offset: 1px;
  border-color: var(--link);
}

.contact-form-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.contact-status {
  margin: 4px 0 0;
  font-size: 14px;
  min-height: 1.2em;
  color: var(--muted);
}
.contact-status.ok { color: var(--accent); font-weight: 600; }
.contact-status.err { color: #B3261E; }
.dark .contact-status.err { color: #F0928A; }

/* Visually-hidden labels (kept for screen readers) */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Footer ---------- */
.site-footer { padding: 28px 0; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-name { margin: 0; font-family: var(--font-serif); color: var(--ink); font-size: 16px; }
.footer-note { margin: 0; font-size: 14px; color: var(--muted-2); }

.noscript-note { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 24px;
    padding-top: 44px;
  }
  .hero-avatar { width: 110px; height: 110px; }
  .projects-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; }
  .container { padding-left: 20px; padding-right: 20px; }
}

/* ---------- Respect reduced-motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
