/* ==============================================================
   Boyd Lyons – portfolio styles
   Change colours and fonts in :root and the whole site follows.
   ============================================================== */

:root {
  /* Blues */
  --ink: #0b1b33;          /* headings, dark text */
  --text: #33445e;         /* body text */
  --muted: #6a7a93;        /* captions, dates */
  --accent: #1f5fd1;       /* links, buttons, highlights */
  --accent-dark: #164aa6;
  --accent-soft: #e6eefc;  /* tag backgrounds */
  --line: #dbe3ef;         /* borders */
  --bg: #ffffff;
  --bg-tint: #f3f6fb;      /* alternating sections */
  --navy: #0a1730;         /* contact section */

  /* Type */
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Layout */
  --max: 1120px;
  --radius: 14px;
  --nav-h: 68px;
  --shadow: 0 1px 2px rgba(11, 27, 51, .05), 0 8px 24px rgba(11, 27, 51, .06);
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-weight: 600; margin-bottom: 1.4em; }
h3 { font-size: 1.3rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
em { font-style: normal; color: var(--accent); font-weight: 600; }

.container { width: min(100% - 32px, var(--max)); margin-inline: auto; }

.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; border: 0 !important;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .8em 1.4em;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31, 95, 209, .25); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-dark); box-shadow: none; }
.btn--small { padding: .45em 1.1em; font-size: .88rem; }
.btn--light { background: #fff; color: var(--navy); border-color: #fff; }
.btn--light:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--navy); }

/* ---------- Mono labels (section numbers, figure captions) ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.4em;
  display: flex; align-items: center; gap: .5em;
}
.eyebrow span { color: var(--accent); font-weight: 500; }
.eyebrow::after { content: ""; flex: 0 0 48px; height: 1px; background: var(--line); margin-left: .5em; }

.fig {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--muted);
  margin-top: .7em;
  letter-spacing: .02em;
}
.fig > span:first-child { color: var(--accent); }
.fig--split > span:first-child { color: var(--muted); }
.fig--split > span:first-child > span:first-child { color: var(--accent); }
.fig--split { display: flex; justify-content: space-between; gap: 1em; }

/* Image frame: rounded, subtle border, blue placeholder if image is missing */
.frame {
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #dce7fa, #eef3fc);
  border: 1px solid var(--line);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, box-shadow .25s;
}
.nav.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 4px 20px rgba(11, 27, 51, .05); }
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav__logo { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: var(--ink); letter-spacing: -0.02em; }
.nav__logo:hover { text-decoration: none; color: var(--accent); }

.nav__links { display: flex; align-items: center; gap: 1.8rem; }
.nav__links a:not(.btn) {
  color: var(--text); font-size: .93rem; font-weight: 500; position: relative;
}
.nav__links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transition: transform .25s;
}
.nav__links a:not(.btn):hover { color: var(--ink); text-decoration: none; }
.nav__links a:not(.btn):hover::after,
.nav__links a.is-active::after { transform: scaleX(1); }
.nav__links a.is-active { color: var(--ink); }

.nav__toggle {
  display: none; background: none; border: 0; padding: 14px 11px; cursor: pointer;
  flex-direction: column; gap: 5px;
}
.nav__toggle span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .25s; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 104px);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(31, 95, 209, .10), transparent 70%),
    radial-gradient(600px 300px at -10% 20%, rgba(31, 95, 209, .06), transparent 70%);
}
.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;           /* photo starts level with the text, not centred */
}
.hero h1 { margin-bottom: .45em; }
.hero h1 .accent { color: var(--accent); }

.status {
  display: inline-flex; align-items: center; gap: .6em;
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink);
  padding: .4em .9em; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  margin-bottom: 1.6em;
}
.status__dot {
  width: 8px; height: 8px; border-radius: 50%; background: #22a06b;
  box-shadow: 0 0 0 0 rgba(34, 160, 107, .5);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(34, 160, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 160, 107, 0); }
}

.hero__summary { font-size: 1.08rem; max-width: 56ch; color: var(--text); }

.creds { margin: 1.8em 0 2em; border-top: 1px solid var(--line); }
.creds__row {
  display: grid; grid-template-columns: 200px 1fr; gap: 1em;
  padding: .75em 0; border-bottom: 1px solid var(--line);
}
.creds dt { font-weight: 600; color: var(--ink); }
.creds dd { margin: 0; color: var(--text); }

.hero__buttons { display: flex; flex-wrap: wrap; gap: .8rem; }

.hero__photo { margin: 0; position: relative; isolation: isolate; }
.hero__photo .frame {
  aspect-ratio: 4 / 5;
  box-shadow: 0 30px 60px -20px rgba(11, 27, 51, .25);
}
.hero__photo .fig { margin-top: 1.9em; }
.hero__photo::before {   /* offset blue outline behind the photo */
  content: ""; position: absolute; inset: 14px -14px auto 14px;
  aspect-ratio: 4 / 5; border: 1.5px solid var(--accent); border-radius: var(--radius);
  opacity: .35; z-index: -1;
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section--tinted { background: var(--bg-tint); }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px); align-items: start;
}
.about__text p { font-size: 1.04rem; }

.meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1em;
  margin: 2em 0 0; padding-top: 1.4em; border-top: 1px solid var(--line);
}
.meta dt { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta dd { margin: .2em 0 0; font-weight: 600; color: var(--ink); }

/* ---------- Carousel ---------- */
.carousel { margin: 0; }
.carousel__viewport {
  position: relative; overflow: hidden; border-radius: var(--radius);
  aspect-ratio: 1 / 1; border: 1px solid var(--line);
  background: linear-gradient(135deg, #dce7fa, #eef3fc);
}
.carousel__track { display: flex; height: 100%; transition: transform .5s cubic-bezier(.4, 0, .2, 1); }
.slide { flex: 0 0 100%; height: 100%; }
.slide img { width: 100%; height: 100%; object-fit: cover; }

.carousel__btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .9); color: var(--ink);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, background .2s;
}
.carousel__viewport:hover .carousel__btn,
.carousel__btn:focus-visible { opacity: 1; }
.carousel__btn:hover { background: #fff; color: var(--accent); }
.carousel__btn--prev { left: 12px; }
.carousel__btn--next { right: 12px; }

/* ---------- Experience ---------- */
.job {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(22px, 3.5vw, 40px); box-shadow: var(--shadow);
}
.job + .job { margin-top: 28px; }

.job__header {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1.1em; align-items: center;
  padding-bottom: 1.4em; margin-bottom: .6em; border-bottom: 1px solid var(--line);
}
.job__logo {
  width: 60px; height: 60px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--accent-soft);
}
.job__logo img { width: 100%; height: 100%; object-fit: cover; }
.job__title h3 { margin: 0; }
.job__role { margin: .1em 0 0; color: var(--muted); font-size: .95rem; }
.job__dates {
  font-family: var(--font-mono); font-size: .8rem; color: var(--accent);
  background: var(--accent-soft); padding: .35em .8em; border-radius: 999px; white-space: nowrap;
}

/* Each duty: label on the left, bullets on the right */
.duty {
  display: grid; grid-template-columns: 220px 1fr; gap: 1.5em;
  padding: 1.2em 0; border-bottom: 1px dashed var(--line);
}
.duty:last-of-type { border-bottom: 0; }
.duty h4 { margin: .15em 0 0; font-size: .98rem; }
.duty ul { margin: 0; padding: 0; list-style: none; }
.duty li { position: relative; padding-left: 1.2em; margin-bottom: .6em; }
.duty li:last-child { margin-bottom: 0; }
.duty li::before {
  content: ""; position: absolute; left: 0; top: .7em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ---------- Tags ---------- */
.tags { list-style: none; padding: 0; margin: 1.2em 0 0; display: flex; flex-wrap: wrap; gap: .45em; }
.tags li {
  font-family: var(--font-mono); font-size: .74rem;
  color: var(--accent-dark); background: var(--accent-soft);
  padding: .3em .75em; border-radius: 6px;
}

/* ---------- Education (timeline) ---------- */
.timeline { position: relative; padding-left: 36px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(var(--accent), var(--line));
}
.edu { position: relative; }
.edu + .edu { margin-top: 48px; }
.edu::before {
  content: ""; position: absolute; left: -36px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
}
.edu__header { display: flex; justify-content: space-between; gap: 1em; align-items: start; margin-bottom: 1em; }
.edu__header h3 { margin-bottom: .2em; }
.edu__place { color: var(--muted); margin: 0; }
.edu__dates { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); white-space: nowrap; padding-top: .3em; }
.edu > p { max-width: 72ch; }

.edu__awards { list-style: none; padding: 0; margin: 1.2em 0 0; display: grid; gap: .5em; }
.edu__awards li { display: flex; align-items: center; gap: .8em; }
.edu__awards li span {
  font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); border: 1px solid currentColor; padding: .15em .55em; border-radius: 4px;
}

.grades {
  list-style: none; padding: 0; margin: 0 0 1.2em;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.grades li {
  background: var(--bg-tint); border: 1px solid var(--line); border-radius: 12px;
  padding: 1em; display: flex; flex-direction: column; gap: .2em;
}
.grades__grade { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; color: var(--accent); line-height: 1; }
.grades li span:last-child { font-size: .9rem; color: var(--ink); }

/* ---------- Projects ---------- */
.projects { display: grid; gap: clamp(48px, 7vw, 88px); }
.project {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(28px, 5vw, 64px); align-items: start;
}
.project:nth-child(even) .project__media { order: 2; }   /* alternate sides */
.project__media { margin: 0; position: sticky; top: calc(var(--nav-h) + 24px); }
/* Figures keep their own shape (no cropping) on a white card; click opens full size */
.project__media .frame { display: block; background: #fff; box-shadow: var(--shadow); }
.project__media .frame--dark { background: #000; }
.project__media .frame img { height: auto; transition: transform .6s ease; }
.frame--zoom { cursor: zoom-in; }
.project:hover .project__media .frame img { transform: scale(1.03); }

.project__type {
  display: inline-block; font-family: var(--font-mono); font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: .7em;
}
.project h3 { font-size: clamp(1.35rem, 2.4vw, 1.7rem); }

.project__outcome {
  background: #fff; border-left: 3px solid var(--accent);
  padding: .9em 1.1em; border-radius: 0 10px 10px 0;
}
.project__outcome strong {
  display: block; font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: .2em;
}

details { margin: 1em 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary {
  cursor: pointer; list-style: none; padding: .8em 0;
  font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.2rem; color: var(--accent); transition: transform .25s; }
details[open] summary::after { transform: rotate(45deg); }
summary:hover { color: var(--accent); }
details ul { margin: 0 0 1em; padding-left: 1.2em; }
details li { margin-bottom: .45em; }
details li::marker { color: var(--accent); }

/* ---------- Skills ---------- */
.skills { border-top: 1px solid var(--line); }
.skill-row {
  display: grid; grid-template-columns: 260px 1fr; gap: 1.5em;
  padding: 1.4em 0; border-bottom: 1px solid var(--line);
}
.skill-row h3 { font-size: 1.05rem; margin: .1em 0 0; }
.skill-row ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5em; }
.skill-row li {
  padding: .35em .85em; border: 1px solid var(--line); border-radius: 999px;
  font-size: .92rem; color: var(--ink); background: #fff;
  transition: border-color .2s, color .2s, background .2s;
}
.skill-row li:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Contact ---------- */
.section--dark {
  background:
    radial-gradient(700px 360px at 90% 0%, rgba(31, 95, 209, .35), transparent 70%),
    var(--navy);
  color: #c4d1e6;
}
.section--dark .eyebrow { color: #8ea3c4; }
.section--dark .eyebrow span { color: #7fa8f5; }
.section--dark .eyebrow::after { background: rgba(255, 255, 255, .15); }

.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.contact__links { list-style: none; padding: 0; margin: 1.6em 0 0; display: grid; gap: .6em; }
.contact__links a { color: #fff; font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, .25); padding-bottom: 2px; }
.contact__links a:hover { text-decoration: none; border-color: #7fa8f5; color: #7fa8f5; }

.contact__form {
  position: relative;
  display: grid; gap: 1em;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius); padding: clamp(20px, 3vw, 32px);
}
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }
.contact__form label { display: grid; gap: .4em; font-size: .85rem; font-weight: 500; color: #c4d1e6; }
.contact__form input, .contact__form textarea {
  font: inherit; font-size: 1rem; color: #fff;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 10px; padding: .75em .9em; width: 100%;
  transition: border-color .2s, background .2s;
}
.contact__form input:focus, .contact__form textarea:focus {
  outline: none; border-color: #7fa8f5; background: rgba(255, 255, 255, .1);
}
.contact__form textarea { resize: vertical; min-height: 130px; }
.contact__form .btn { justify-self: start; }
.contact__status { margin: 0; font-size: .9rem; min-height: 1.4em; }
.contact__status.is-ok { color: #7ee2b0; }
.contact__status.is-error { color: #ff9a9a; }

/* ---------- Footer ---------- */
.footer { background: var(--navy); color: #8ea3c4; border-top: 1px solid rgba(255, 255, 255, .08); padding: 24px 0; font-size: .88rem; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1em; }
.footer p { margin: 0; }
.footer a { color: #c4d1e6; }

/* ---------- Scroll-in animation (added by js/main.js) ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* Touch screens: no hover, so show carousel arrows and stop hover effects sticking after a tap */
@media (hover: none) {
  .carousel__btn { opacity: 1; }
  .btn:hover { transform: none; box-shadow: none; }
  .project:hover .project__media .frame img { transform: none; }
}

/* ==============================================================
   Responsive
   ============================================================== */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; }
  /* On tablets/phones the photo moves above the text */
  .hero__photo { order: -1; max-width: 220px; }
  .hero__photo .frame, .hero__photo::before { aspect-ratio: 1 / 1; }

  .about, .contact { grid-template-columns: 1fr; }
  .carousel { max-width: 460px; }

  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .project__media { order: 0; }
  .project__media { position: static; }

  .duty, .skill-row { grid-template-columns: 1fr; gap: .6em; }
  .grades { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 16px 20px; box-shadow: 0 16px 30px rgba(11, 27, 51, .08);
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a:not(.btn) { padding: .9em 0; border-bottom: 1px solid var(--line); }
  .nav__links a:not(.btn)::after { display: none; }
  .nav__links .btn { margin-top: 1em; justify-content: center; }
}

@media (max-width: 560px) {
  .creds__row { grid-template-columns: 1fr; gap: .1em; }
  .meta { grid-template-columns: 1fr 1fr; }
  .job__header { grid-template-columns: auto 1fr; }
  .job__dates { grid-column: 1 / -1; justify-self: start; }
  .edu__header { flex-direction: column; gap: .3em; }
  .form__row { grid-template-columns: 1fr; }
  .footer__inner { flex-direction: column; }
}
