/* Shared styles for every page of davidmedina's portfolio */

:root {
  --bg: #ffffff;
  --text: #1c2a22;
  --muted: #55655b;
  --brand: #2d6a4f;
  --brand-dark: #1b4332;
  --brand-mid: #40916c;
  --brand-light: #74b88f;
  --brand-pale: #b7e4c7;
  --line: #e2e9e4;
  --tag-bg: #e8f3ec;
  --card: #f6faf7;
  --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6 C 50 2, 120 9, 198 4' stroke='%232d6a4f' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1712;
    --text: #e4ece6;
    --muted: #a3b5a9;
    --brand: #95d5b2;
    --line: #23332a;
    --tag-bg: #1a2a21;
    --card: #131f18;
    --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6 C 50 2, 120 9, 198 4' stroke='%2395d5b2' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Ubuntu", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}
a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, .skip:focus {
  outline: 3px solid var(--brand-light);
  outline-offset: 3px;
  border-radius: 3px;
}
.skip {
  position: absolute; left: -999rem; top: 0.5rem; z-index: 20;
  background: #fff; color: var(--brand-dark);
  padding: 0.5rem 0.9rem; border-radius: 4px; font-weight: 700;
}
.skip:focus { left: 0.5rem; }

/* ---------- Banner header ---------- */
.banner { position: relative; background: var(--brand-dark); color: #fff; overflow: hidden; }
.banner-top { position: relative; height: 4.25rem; }
.banner-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.banner-peak { position: absolute; right: 1.25rem; bottom: 0; height: 100%; width: auto; }
.banner-name {
  position: relative; margin: 0;
  padding: 1.1rem 1.5rem 0;
  font-size: 1.5rem; font-weight: 700; letter-spacing: 0.01em;
}
.banner-name a { color: #fff; text-decoration: none; }

nav { position: relative; background: #24573f; }
nav ul {
  list-style: none; margin: 0; padding: 0.55rem 1.25rem 0.6rem;
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.6rem;
}
nav a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: #fff; text-decoration: none;
  font-weight: 500; font-size: 0.95rem;
  padding: 0.2rem 0.1rem;
  border-bottom: 2px solid transparent;
}
nav a:hover, nav a[aria-current="page"] { border-bottom-color: #fff; }
nav svg { width: 1em; height: 1em; flex: none; }
@media (max-width: 30rem) {
  nav ul { gap: 0.25rem 1.1rem; padding-left: 1rem; padding-right: 1rem; }
  nav a { font-size: 0.9rem; }
  nav svg { display: none; }
  .banner-peak { opacity: 0.55; }
}

/* ---------- Page column ---------- */
main { flex: 1; padding: 2.5rem 1.25rem 3rem; }
.col { max-width: 42rem; margin: 0 auto; }
section { margin-bottom: 2.75rem; }
section:last-child { margin-bottom: 0; }

h1, h2 {
  display: inline-block;
  margin: 0 0 1rem;
  padding-bottom: 0.45rem;
  color: var(--brand);
  font-weight: 700;
  line-height: 1.15;
  background: var(--swoosh) left bottom / 100% 0.6rem no-repeat;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 2rem; }
.emoji { font-size: 0.8em; margin-left: 0.2rem; }
h3 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 0.25rem; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.1rem; color: var(--muted); }

/* Text beside a photo */
.split {
  display: grid;
  grid-template-columns: 1fr 11.5rem;
  gap: 1.75rem;
  align-items: start;
}
.photo {
  margin: 0; width: 100%;
  aspect-ratio: 3 / 4.4;
  border-radius: 10px; overflow: hidden;
  background: linear-gradient(160deg, var(--brand-pale), var(--brand-mid));
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(20, 50, 30, 0.18);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .placeholder { color: #fff; font-size: 0.85rem; text-align: center; padding: 1rem; opacity: 0.9; }
@media (max-width: 40rem) {
  .split { grid-template-columns: 1fr; }
  .photo { max-width: 14rem; }
}

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1fr 13rem; gap: 2rem; align-items: center; }
.hero .photo { aspect-ratio: 1; border-radius: 50%; }
.hero h1 { font-size: 2.6rem; }
@media (max-width: 40rem) {
  .hero { grid-template-columns: 1fr; }
  .hero .photo { max-width: 10rem; order: -1; }
  .hero h1 { font-size: 2.1rem; }
}
.btns { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 500;
  padding: 0.55rem 1.1rem; border-radius: 999px;
  border: 2px solid var(--brand-mid); color: var(--brand);
}
.btn.primary { background: var(--brand-mid); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }

.focus-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
.focus-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.05rem; }
.focus-list .emoji { display: block; font-size: 1.5rem; margin: 0 0 0.35rem; }
.focus-list p { margin: 0; color: var(--muted); font-size: 0.93rem; }
@media (max-width: 40rem) { .focus-list { grid-template-columns: 1fr; } }

/* ---------- Projects ---------- */
.projects { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.project { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.15rem 1.25rem 1rem; }
.project p { margin-bottom: 0.6rem; }
.outcome { font-weight: 500; color: var(--brand); }
.stack { list-style: none; padding: 0; margin: 0 0 0.6rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.stack li { background: var(--tag-bg); color: var(--text); border-radius: 999px; padding: 0.05rem 0.65rem; font-size: 0.82rem; }
.card-links { margin: 0; font-weight: 500; }
.card-links a + a { margin-left: 1.1rem; }
.note { color: var(--muted); font-size: 0.88rem; font-weight: 400; margin-left: 0.4rem; }

/* ---------- About ---------- */
.jobs { list-style: none; padding: 0; margin: 0; }
.jobs > li { padding-bottom: 1.25rem; }
.jobs > li:last-child { padding-bottom: 0; }
.where { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.3rem; }
.jobs p:last-child { margin-bottom: 0; }
.label { color: var(--brand); font-weight: 700; }
.skills p { margin-bottom: 0.35rem; }
.year { color: var(--muted); font-weight: 500; }
.edu p { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding: 1.5rem 1.25rem 2.5rem; }
footer .col { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }
footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-weight: 500; }
footer p { margin: 0; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem;
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--brand-mid); color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top svg { width: 1.1rem; height: 1.1rem; }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }
