/* =========================================================
   Michael Carnie - portfolio
   Flat single-colour background, one accent, multi-page.

   Background is forest green (--bg). Accent is a pale sage (--accent).
   Both live in :root below - change them in one place.
   ========================================================= */

:root {
  --bg: #2b382f;            /* sage green - the only background colour on the site */
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.26);

  --ink: #f4f8f4;
  --sand: #dbe6dd;
  --muted: #a8bdae;

  --accent: #a9ddba;
  --accent-hover: #bde8c9;
  --on-accent: #16261b;

  --maxw: 1040px;
  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* keyboard shortcut past the nav; only visible once focused */
.skip { position: absolute; left: -9999px; top: 0; z-index: 9999; }
.skip:focus {
  left: .75rem; top: .75rem; padding: .6rem 1.1rem;
  background: var(--accent); color: var(--on-accent);
  border-radius: 999px; font-size: .85rem; font-weight: 600;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  overflow-x: hidden;
}

body.is-loading { overflow: hidden; height: 100vh; }

/* height:auto is required: every <img> carries width/height attributes (so the
   browser can reserve space and avoid layout shift), and without this the
   attribute height is kept while max-width scales the width down, which
   stretches the image vertically. Elements that crop via object-fit set their
   own height further down and are unaffected. */
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ===================== LOADING SCREEN (home only) ===================== */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .6s var(--ease), visibility .6s var(--ease);
}
.preloader.done { opacity: 0; visibility: hidden; }
.preloader__core { text-align: center; }
.preloader__seis { width: 200px; height: 66px; color: var(--accent); }
#seisPath {
  stroke-dasharray: 520; stroke-dashoffset: 520;
  animation: drawSeis 2.2s var(--ease) infinite;
}
@keyframes drawSeis { 0% { stroke-dashoffset: 520; } 60%, 100% { stroke-dashoffset: 0; } }
.preloader__pct {
  font-family: var(--font-display); font-weight: 700;
  font-size: 2.2rem; line-height: 1;
}
.preloader__pct i { font-style: normal; font-size: .95rem; color: var(--accent); }
.preloader__label {
  color: var(--muted); letter-spacing: .16em; text-transform: uppercase;
  font-size: .66rem; margin-top: .5rem;
}

/* ===================== NAV ===================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 800;
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem clamp(1.1rem, 4vw, 2.5rem);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--border); }
.logo { display: flex; align-items: center; gap: .55rem; font-family: var(--font-display); }
.logo__mark { width: 26px; height: 26px; }
.logo__mark.sm { width: 22px; height: 22px; }
.logo__facet { fill: var(--accent); }
.logo__facet.f2, .logo__facet.f4 { fill: #7cc396; }
.logo__facet.f3 { fill: #5fae7c; }
.logo__text { font-weight: 400; font-size: .95rem; }
.logo__text b { font-weight: 700; }

.nav__links { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 1.75rem); }
.nav__links a {
  font-size: .86rem; color: var(--sand); padding: .2rem 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav__links a:hover { color: var(--accent); }
.nav__links a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.nav__burger {
  display: none; background: none; border: 0; cursor: pointer;
  width: 26px; height: 18px; position: relative;
}
.nav__burger span {
  position: absolute; left: 0; height: 2px; width: 100%;
  background: var(--ink); transition: .25s var(--ease);
}
.nav__burger span:nth-child(1) { top: 0; }
.nav__burger span:nth-child(2) { top: 8px; }
.nav__burger span:nth-child(3) { top: 16px; }
.nav.open .nav__burger span:nth-child(1) { top: 8px; transform: rotate(45deg); }
.nav.open .nav__burger span:nth-child(2) { opacity: 0; }
.nav.open .nav__burger span:nth-child(3) { top: 8px; transform: rotate(-45deg); }

/* ===================== BUTTON ===================== */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.15rem; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: .88rem;
  background: var(--accent); color: var(--on-accent);
  transition: background .2s var(--ease);
}
.btn:hover { background: var(--accent-hover); }

/* ===================== LAYOUT ===================== */
section { padding: clamp(2.75rem, 6vw, 4rem) clamp(1.1rem, 4vw, 2rem); }
.wrap { max-width: var(--maxw); margin: 0 auto; }

.section-sub { color: var(--muted); font-size: .9rem; margin-top: .35rem; max-width: 56ch; }

/* the section name at the top of a sub-page, larger than a section heading */
.page-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  line-height: 1.02; letter-spacing: -0.03em;
}

/* page header on the sub-pages, clears the fixed nav */
.page-head { padding-top: 6.5rem; padding-bottom: 0; }
.page-body { padding-top: 1.5rem; }

/* scroll reveal - only when JS runs, so content never gets stuck hidden */
.js [data-reveal] {
  opacity: 0; transform: translateY(10px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.js [data-reveal].in { opacity: 1; transform: none; }

/* ===================== HOME LAYOUT =====================
   One narrow centred column. Every block is spaced by the flex gap,
   so vertical rhythm is defined in exactly one place. */
.home {
  max-width: 940px; margin: 0 auto;
  padding: clamp(4.75rem, 9vh, 6rem) clamp(1.1rem, 4vw, 2rem) clamp(2.5rem, 5vw, 3.25rem);
  display: flex; flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.1rem);
}

/* home: links through to the three pages */
.home-nav {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .9rem;
}
.home-nav__item {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  padding: 1.15rem 1.3rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .25s var(--ease);
}
.home-nav__item:hover { border-color: var(--accent); }
.home-nav__item h2 { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.home-nav__arrow { color: var(--accent); font-size: .9rem; }

/* ===================== IDENTITY CARD (top of home) ===================== */
.id-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(1.25rem, 2.6vw, 1.75rem);
}
.id-card__row {
  display: flex; align-items: center;
  gap: clamp(1.25rem, 3.5vw, 2.25rem);
}
.id-card__photo {
  flex: 0 0 auto; width: clamp(180px, 32vw, 285px);
  aspect-ratio: 3 / 4; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}
.id-card__photo img { width: 100%; height: 100%; object-fit: cover; }
.id-card__text { min-width: 0; }
.id-card__name {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.1rem, 5.4vw, 3.1rem);
  line-height: 1.02; letter-spacing: -0.03em;
}
.id-card__line {
  color: var(--sand); font-size: clamp(.95rem, 1.5vw, 1.08rem);
  line-height: 1.5; margin-top: .7rem;
}
.id-card__email {
  font-family: var(--font-display); font-weight: 500;
  font-size: .9rem; color: var(--muted); margin-top: .6rem;
}
/* the @ and . come from CSS so scrapers reading DOM text can't form a valid address */
.id-card__email .at::before { content: "@"; color: var(--accent); }
.id-card__email .dot::before { content: "."; color: var(--accent); }
.id-card__actions { display: flex; flex-wrap: wrap; gap: .95rem; margin-top: 1.25rem; }

/* ===================== CURRENTLY ===================== */
.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: .8rem;
}
.block-head h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
}
.block-head__meta { color: var(--muted); font-size: .8rem; }

.currently { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.currently__row {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: .25rem 1.1rem;
  padding: .85rem 1.25rem; border-top: 1px solid var(--border);
}
.currently__row:first-child { border-top: 0; }
.currently__label {
  color: var(--muted); font-size: .62rem; letter-spacing: .14em;
  text-transform: uppercase; padding-top: .3rem;
}
.currently__val {
  font-family: var(--font-display); font-weight: 600;
  font-size: .92rem; line-height: 1.45;
}
.currently__sub { color: var(--muted); font-size: .8rem; margin-top: .2rem; line-height: 1.5; }

/* ===================== WHAT I WORK WITH (auto-scrolling row) ===================== */
.tools { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; }
.tools li {
  border: 1px solid var(--border); border-radius: 999px;
  padding: .7rem 1.4rem; font-size: clamp(1rem, 1.9vw, 1.2rem);
  font-family: var(--font-display); font-weight: 500;
  color: var(--sand); white-space: nowrap;
  /* min-width keeps the row wider than the column, so it always has to
     scroll rather than sitting still with everything visible at once */
  min-width: 9.5rem; text-align: center;
}

.marquee {
  overflow: hidden;
  /* fade the two ends so items appear/disappear instead of being cut off */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee__track {
  display: flex; gap: .5rem; width: max-content;
  animation: marquee 30s linear infinite;
}
/* pause so it can actually be read */
.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track { animation-play-state: paused; }
.marquee .tools { flex-wrap: nowrap; }
@keyframes marquee {
  from { transform: translateX(0); }
  /* the list appears 3x in the markup, so moving one third loops seamlessly.
     If you add or remove a copy, change this fraction to match. */
  to   { transform: translateX(-33.3333%); }
}

/* ===================== ABOUT / STORY ===================== */
.story { max-width: 64ch; }
.story p { color: var(--sand); font-size: .94rem; }
.story p + p { margin-top: .85rem; }
.story strong { color: var(--ink); font-weight: 500; }

/* ===================== SHARED CARD (flat, border only) ===================== */
.card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .25s var(--ease);
}
.card:hover { border-color: var(--border-strong); }

/* ===================== EXPERIENCE (expandable rows) ===================== */
.exp-list { display: flex; flex-direction: column; gap: .7rem; }

.exp { overflow: hidden; }
.exp[open] { border-color: var(--border-strong); }

.exp__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  list-style: none;                 /* hide the default triangle */
}
.exp__head::-webkit-details-marker { display: none; }
.exp__head:hover .exp__role { color: var(--accent); }

.exp__year {
  display: block;
  font-family: var(--font-display); font-weight: 600;
  color: var(--accent); font-size: .74rem; letter-spacing: .04em;
}
.exp__role {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.02rem; margin: .2rem 0 .1rem;
  transition: color .2s var(--ease);
}
.exp__org { display: block; color: var(--muted); font-size: .78rem; }
.exp__chev {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--accent);
  display: grid; place-items: center;
  font-size: .95rem; line-height: 1;
}
.exp__chev::before { content: "+"; }
.exp[open] .exp__chev { border-color: var(--accent); }
.exp[open] .exp__chev::before { content: "\2212"; }  /* minus sign */

.exp__detail {
  padding: 0 1.25rem 1.2rem;
  border-top: 1px solid var(--border);
  margin-top: .25rem; padding-top: 1rem;
}
.exp__context {
  font-family: var(--font-display); font-weight: 600;
  font-size: .8rem; color: var(--accent);
  margin-bottom: .6rem;
}
.exp__detail ul { list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.exp__detail li {
  position: relative; padding-left: 1rem;
  color: var(--sand); font-size: .86rem; line-height: 1.55;
}
.exp__detail li::before {
  content: ""; position: absolute; left: 0; top: .6em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.exp__tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .9rem; }
.exp__tags li {
  font-size: .7rem; padding: .22rem .6rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
  padding-left: .6rem;
}
.exp__tags li::before { display: none; }
/* figures on the Projects page - stacked, so wide screenshots stay readable */
.figs {
  display: flex; flex-direction: column;
  gap: 1.1rem; margin-top: 1.1rem;
}
.figs img { border-radius: 8px; border: 1px solid var(--border); }
.figs figcaption { color: var(--muted); font-size: .74rem; margin-top: .4rem; }

/* ===================== PROJECTS ===================== */
.project-list { display: flex; flex-direction: column; gap: 1.1rem; }
.project { padding: clamp(1.25rem, 3vw, 1.75rem); }
.project__year {
  display: block; font-family: var(--font-display); font-weight: 600;
  color: var(--accent); font-size: .76rem; letter-spacing: .04em;
}
.project h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem); margin: .3rem 0 .15rem;
}
.project__org { color: var(--muted); font-size: .8rem; }
.project__list { list-style: none; display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.project__list li {
  position: relative; padding-left: 1rem;
  color: var(--sand); font-size: .88rem; line-height: 1.6;
}
.project__list li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.project__actions { margin-top: 1.25rem; }

/* ===================== HOBBIES ===================== */
.hobby-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.1rem;
}
.hobby { overflow: hidden; display: flex; flex-direction: column; }
.hobby__photo { width: 100%; height: 165px; overflow: hidden; }
.hobby__photo img { width: 100%; height: 100%; object-fit: cover; }
.hobby__body { padding: 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.hobby h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.02rem; margin-bottom: .45rem;
}
.hobby p { color: var(--sand); font-size: .86rem; line-height: 1.6; }



/* ===================== SKILLS ===================== */
.skill-group { margin-top: 2rem; }
.skill-group:first-of-type { margin-top: 0; }
.skill-group__title {
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding-bottom: .5rem; margin-bottom: .9rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: .6rem;
}
.skill-group__title span { color: var(--muted); font-weight: 400; font-size: .78rem; }

.skill-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .8rem;
}
.skill-card { padding: 1rem 1.1rem; }
.skill-card h3, .skill-card h4 {
  font-family: var(--font-display); font-weight: 600;
  font-size: .95rem; margin-bottom: .15rem;
}
.skill-card p { color: var(--muted); font-size: .78rem; margin-bottom: .7rem; }
.skill-card__bar {
  display: block; height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); overflow: hidden;
}
.skill-card__bar i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--accent); transition: width .9s var(--ease);
}
.skill-card.in .skill-card__bar i { width: var(--lvl); }

/* ===================== FOOTER ===================== */
.footer {
  text-align: center; padding: 2.25rem 1rem 2.75rem;
  color: var(--muted); font-size: .82rem;
  border-top: 1px solid var(--border);
}
.footer__logo { margin-bottom: .6rem; display: flex; justify-content: center; }
.footer__fine { font-size: .75rem; opacity: .75; margin-top: .2rem; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: 0 0 0 auto; width: min(74vw, 280px);
    flex-direction: column; justify-content: center; gap: 1.4rem;
    background: var(--bg);
    transform: translateX(100%); transition: transform .3s var(--ease);
    z-index: 810;
  }
  .nav.open .nav__links { transform: translateX(0); }
  .nav__burger { display: block; z-index: 820; }
}

@media (max-width: 620px) {
  /* stack the Currently label above its value */
  .currently__row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  /* photo above the name instead of beside it */
  .id-card__row { flex-direction: column; align-items: stretch; }
  .id-card__photo { width: 100%; max-width: 280px; aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* stop the marquee and let it be scrolled by hand instead */
  .marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .marquee__track { animation: none !important; }
}
