/* =========================================================
   James Costello — Portfolio
   Editorial / refined. Fraunces + IBM Plex.
   ========================================================= */

:root {
  /* Light theme — white / grey / blue */
  --paper:      #ffffff;
  --paper-2:    #eef1f6;
  --ink:        #0e1218;
  --ink-soft:   #444c57;
  --ink-faint:  #8a929e;
  --line:       #e1e5ec;
  --accent:     #1f5fe0;   /* blue */
  --accent-2:   #11317a;   /* deep navy */
  --card:       #ffffff;
  --card-edge:  #e3e7ee;
  --shadow:     28px 28px 60px rgba(20, 35, 70, 0.10);

  --font-display: "Libre Franklin", system-ui, sans-serif;
  --font-body:    "Libre Franklin", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --paper:      #0b0e13;
  --paper-2:    #151a22;
  --ink:        #eef2f8;
  --ink-soft:   #aab3c0;
  --ink-faint:  #6a7382;
  --line:       #232a35;
  --accent:     #5b8cff;
  --accent-2:   #9bb8ff;
  --card:       #11151c;
  --card-edge:  #232b37;
  --shadow:     28px 28px 70px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

::selection { background: var(--accent); color: #fff; }

/* ---- grain / texture overlay ---- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.05; }

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 64px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), background 0.5s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--line); }

.monogram {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  border: 1.5px solid var(--ink);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.4s var(--ease);
}
.monogram:hover { background: var(--ink); color: var(--paper); transform: rotate(-8deg); }

.nav-links { display: flex; gap: clamp(18px, 3vw, 38px); }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color 0.3s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-toggle {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color 0.3s var(--ease), transform 0.4s var(--ease);
}
.theme-toggle:hover { border-color: var(--ink); transform: rotate(40deg); }
.theme-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset -5px -5px 0 0 var(--paper);
  transition: all 0.4s var(--ease);
}
html[data-theme="dark"] .theme-dot { box-shadow: none; background: var(--accent); }

/* =========================================================
   HERO
   ========================================================= */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px); }

.hero { padding: clamp(56px, 11vh, 130px) 0 clamp(60px, 12vh, 130px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(36px, 6vw, 80px);
  align-items: center;
  margin-bottom: 56px;
}
.hero-main { min-width: 0; }

.hero-portrait {
  margin: 0;
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 340px;
}
.hero-portrait img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--card-edge);
  box-shadow: var(--shadow);
  filter: grayscale(0.12) contrast(1.02);
  transition: filter 0.5s var(--ease), transform 0.5s var(--ease);
}
.hero-portrait:hover img { filter: none; transform: translateY(-4px); }

.status-chip {
  position: absolute;
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--card-edge);
  box-shadow: 0 12px 28px rgba(20, 35, 70, 0.14);
  padding: 9px 17px;
  border-radius: 100px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-meta { display: flex; align-items: center; gap: 16px; margin-bottom: 36px; }
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.kicker-rule { flex: 0 0 64px; height: 1px; background: var(--line); }

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(52px, 8.5vw, 116px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-bottom: 36px;
}
.hero-title .line { display: block; }
.hero-title em {
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
  margin-left: 0;
}

.hero-lede {
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.5;
  max-width: 640px;
  color: var(--ink-soft);
  margin-bottom: 44px;
}
.hero-lede .hl {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -0.5em 0 color-mix(in srgb, var(--accent) 16%, transparent);
}

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 15px 28px;
  border-radius: 100px;
  border: 1.5px solid var(--ink);
  transition: all 0.35s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-3px); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); transform: translateY(-3px); }

.focus {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.focus li {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.focus li:not(:last-child)::after { content: "·"; margin-left: 14px; color: var(--line); }

/* =========================================================
   SECTION HEADERS
   ========================================================= */
.section-head { margin-bottom: 52px; }
.section-index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 10px 0 8px;
}
.section-note { color: var(--ink-faint); font-size: 16px; max-width: 440px; }

.work, .about { padding: clamp(50px, 9vh, 110px) 0; }

/* =========================================================
   PROJECT GRID
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 18px;
  padding: 34px 32px 30px;
  overflow: hidden;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.5s var(--ease);
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--card-edge));
}
.card:hover::before { opacity: 1; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.card-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}
.badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge.live    { color: var(--accent); }
.badge.public  { color: var(--ink-soft); }
.badge.private { color: var(--ink-faint); }

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.card-desc {
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.62;
  margin-bottom: 22px;
  flex: 1;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
}

.card-links { display: flex; gap: 18px; margin-top: auto; }
.card-link {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.3s var(--ease), gap 0.3s var(--ease);
}
.card-link .arrow { transition: transform 0.3s var(--ease); }
.card-link:hover { color: var(--accent); gap: 10px; }
.card-link:hover .arrow { transform: translate(2px, -2px); }
.card-link.muted { color: var(--ink-faint); cursor: default; }
.card-link.muted:hover { color: var(--ink-faint); gap: 7px; }

.cold-note {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* =========================================================
   SHOWCASE + PROJECT LIST  (strength-categorized)
   ========================================================= */
:root      { --s-technical:#0e8f80; --s-business:#b06a12; --s-data:var(--accent); }
html[data-theme="dark"] { --s-technical:#3fd0bd; --s-business:#e3a44f; --s-data:var(--accent); }

/* strength chip — shared by showcase + list */
.strength {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px 5px 11px;
  border-radius: 100px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.strength::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.strength.technical { color: var(--s-technical); }
.strength.business  { color: var(--s-business); }
.strength.data      { color: var(--s-data); }

/* ---- showcase (live apps with screenshots) ---- */
.showcase-wrap { display: flex; flex-direction: column; gap: 30px; margin-bottom: 76px; }
.showcase {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: clamp(26px, 4vw, 54px);
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  padding: clamp(20px, 2.8vw, 32px);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.5s var(--ease);
}
.showcase:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--card-edge));
}
.showcase.flip .showcase-media { order: 2; }

.showcase-media {
  position: relative;
  height: clamp(360px, 42vw, 500px);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--card-edge);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--card)), var(--card));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3.5vw, 36px);
}
.showcase-media::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 0 24px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 2.4vw, 26px);
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--ink) 32%, transparent);
}
.showcase-media:has(img)::after { display: none; } /* hide fallback label once a screenshot loads */
.showcase-media img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  box-shadow: 0 18px 46px rgba(20, 35, 70, 0.28);
}
.live-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  padding: 6px 12px;
  border-radius: 100px;
  backdrop-filter: blur(6px);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #46e08a; animation: livepulse 2.4s var(--ease) infinite; }
@keyframes livepulse {
  0%   { box-shadow: 0 0 0 0 rgba(70, 224, 138, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(70, 224, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(70, 224, 138, 0); }
}

.showcase-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.showcase-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(25px, 3vw, 33px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.showcase-desc { color: var(--ink-soft); font-size: 15.5px; line-height: 1.62; }
.showcase-body .tags { margin-bottom: 0; }
.showcase-body .card-links { margin-top: 2px; }

/* ---- compact project list (non-live) ---- */
.subhead {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.plist { display: flex; flex-direction: column; }
.plist-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 36px;
  align-items: start;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.plist-item:last-child { border-bottom: 0; padding-bottom: 0; }
.plist-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.01em;
  margin-bottom: 11px;
}
.plist-desc { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; margin-bottom: 15px; max-width: 62ch; }
.plist-main .tags { margin-bottom: 0; }
.plist-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}
.plist-side .card-links { margin-top: 0; }

/* =========================================================
   ABOUT
   ========================================================= */
.about-body { max-width: 820px; }
.about-text > p { font-size: clamp(18px, 2.2vw, 22px); line-height: 1.6; margin-bottom: 26px; color: var(--ink-soft); }
.about-text > p:last-child { margin-bottom: 0; }
.about-text > p strong { color: var(--ink); font-weight: 700; }

.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.skill-col h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.skill-col ul { list-style: none; }
.skill-col li {
  font-size: 15px;
  color: var(--ink-soft);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

/* =========================================================
   CONTACT
   ========================================================= */
.contact {
  margin: clamp(40px, 8vh, 90px) 0 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: 28px 28px 0 0;
}
.contact-inner { max-width: var(--maxw); margin: 0 auto; padding: clamp(60px, 12vh, 130px) clamp(24px, 5vw, 64px); }
.contact .section-index { color: var(--accent); }
.contact-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 7vw, 84px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 18px 0 56px;
}
.contact-links { display: flex; flex-wrap: wrap; gap: 18px; }
.contact-link {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 30px;
  border: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
  border-radius: 16px;
  text-decoration: none;
  color: var(--paper);
  transition: background 0.4s var(--ease), transform 0.4s var(--ease), border-color 0.4s var(--ease);
}
.contact-link:hover {
  background: color-mix(in srgb, var(--paper) 8%, transparent);
  border-color: var(--accent);
  transform: translateY(-4px);
}
.cl-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: color-mix(in srgb, var(--paper) 55%, transparent); }
.cl-value { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 3vw, 28px); }

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  background: var(--ink);
  color: color-mix(in srgb, var(--paper) 55%, transparent);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 28px clamp(24px, 5vw, 64px) 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* =========================================================
   REVEAL ANIMATION
   ========================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
.bio-photo {
  margin: 24px 0 0;
  border-radius: 10px;
  overflow: hidden;
  max-width: 340px;
  aspect-ratio: 4/3;
}
.bio-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform .4s ease;
}
.bio-photo:hover img { transform: scale(1.03); }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; gap: 12px; }
  .nav-links { display: none; }
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .hero-portrait { order: -1; justify-self: start; max-width: 200px; margin-bottom: 40px; }
  .status-chip { left: 0; transform: none; }

  .showcase { grid-template-columns: 1fr; gap: 24px; }
  .showcase.flip .showcase-media { order: 0; }
  .plist-item { grid-template-columns: 1fr; gap: 16px; }
  .plist-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { text-align: center; }
  .bio-photo { max-width: 100%; }
  .plist-side { flex-direction: column; align-items: flex-start; gap: 14px; }
}
