/* ------------------------------
   Base + theme tokens
-------------------------------- */

:root {
  color-scheme: light dark;

  /* layout */
  --max: 1200px;
  --pad: 1.2rem;

  /* typography */
  --font-heading: "Montserrat", sans-serif;
  --font-body: "Open Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 18px;

  /* brand (blue) */
  --brand:   210 85% 46%;
  --brand-2: 210 85% 38%;

  /* light defaults */
  --bg: 210 60% 96%;
  --surface: 0 0% 100%;
  --text: 222 22% 12%;
  --muted: 222 10% 40%;
  --border: 220 15% 88%;

  --shadow: 0 12px 30px hsl(222 25% 20% / 0.10);
}

:root[data-theme="dark"] {
  --bg: 222 25% 10%;
  --surface: 222 22% 14%;
  --text: 210 18% 92%;
  --muted: 210 10% 70%;
  --border: 220 12% 24%;
  --shadow: 0 18px 40px hsl(0 0% 0% / 0.35);
}

/* Dark mode background glow */
:root[data-theme="dark"] body {
  position: relative;
  background: hsl(var(--bg));
}

:root[data-theme="dark"] body::before {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: -1;

  /* layered soft glows */
  background:
    radial-gradient(900px 600px at 15% 10%, hsl(var(--brand) / 0.18), transparent 60%),
    radial-gradient(700px 500px at 85% 20%, hsl(180 90% 55% / 0.12), transparent 60%),
    radial-gradient(900px 700px at 60% 85%, hsl(260 90% 60% / 0.10), transparent 60%);

  filter: blur(22px);
  opacity: 0.95;
}


@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: hsl(var(--bg));
  color: hsl(var(--text));
  line-height: 1.6;
}

/* ------------------------------
   Utilities
-------------------------------- */

.container {
  width: min(var(--max), 100%);
  margin-inline: auto;
  padding-inline: var(--pad);
  text-align: center;
}

.muted { color: hsl(var(--muted)); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: hsl(var(--surface));
  color: hsl(var(--text));
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
}
.skip-link:focus { left: 0.5rem; z-index: 9999; }

/* ------------------------------
   Header
-------------------------------- */

h1, h2, h3, h4,
.brand-text,
.site-nav a,
.btn {
  font-family: var(--font-heading);
}

h1 {
  font-weight: 700;
}

h2 {
  font-weight: 600;
}

h3 {
  font-weight: 600;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: hsl(var(--bg) / 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid hsl(var(--border));
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 64px;
  padding-block: 0.6rem;
}

.brand {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: hsl(var(--brand) / 0.12);
  color: hsl(var(--brand));
}

.site-nav {
  display: none;
  gap: 0.9rem;
  align-items: center;
}

.site-nav a {
  text-decoration: none;
  color: hsl(var(--muted));
  font-weight: 600;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
}

.site-nav a[aria-current="page"] {
  color: hsl(var(--text));
  background: hsl(var(--brand) / 0.10);
}

.site-nav a:hover { color: hsl(var(--text)); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--surface));
  color: hsl(var(--text));
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  box-shadow: none;
}

.theme-toggle:hover {
  border-color: hsl(var(--brand) / 0.35);
}

.theme-toggle__icon {
  font-size: 1.05rem;
  line-height: 1;
}

/* Show nav on wider screens */
@media (min-width: 720px) {
  .site-nav { display: inline-flex; }
}

/* ------------------------------
   Hero
-------------------------------- */

.hero {
  padding: 3.2rem 0 2.2rem;
}

.hero-inner {
  display: grid;
  gap: 1.2rem;
  text-align: center;
}

.hero-kicker {
  margin: 0;
  color: hsl(var(--muted));
  font-weight: 600;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.1rem, 3.8vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.6px;
  text-shadow: 0 0 10px hsl(var(--brand) / 0.15);
}

.typewrap{
  display: inline-block;      /* shrink-wrap the whole typed area */
  max-width: 100%;
  text-align: left;
  width: 455px;
  min-height: 122px;
  margin-left: 1.3rem;
}

.typewriter{
  display: inline;            /* ensure it doesn't act like a block */
  white-space: pre;           /* keep your newline, no wrapping within a line */
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.5px;
}

.typewriter::after{
  content: "█";
  color: hsl(var(--brand));
  margin-left: 0.15ch;
  animation: caretBlink 1s steps(2,end) infinite;
}

@keyframes caretBlink {
  50% { opacity: 0; }
}


.hero-subtitle {
  margin: 0;
  color: hsl(var(--muted));
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.6rem;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  text-decoration: none;
  font-weight: 700;
}

.btn.primary {
  background: hsl(var(--brand));
  border-color: hsl(var(--brand));
  color: white;
}

.btn.primary:hover { background: hsl(var(--brand-2)); border-color: hsl(var(--brand-2)); }

.btn.ghost {
  background: hsl(var(--surface));
  color: hsl(var(--text));
}

.btn.ghost:hover { border-color: hsl(var(--brand) / 0.45); }

/* ------------------------------
   Sections
-------------------------------- */

body {
  font-weight: 400;
}

.section {
  padding: 3rem 0;
}

.section-header {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.section-header h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.2px;
}

.section-header p {
  margin: 0;
}

.prose {
  max-width: 75ch;
  margin: 0 auto;
  text-align: center;
}

p a {
  color: hsl(var(--brand));
  text-decoration: none;
  font-weight: 600;
  transition: color 140ms ease;
}

p a:hover {
  color: hsl(var(--brand-2));
}

p a:focus-visible {
  outline: 2px solid hsl(var(--brand) / 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}


.card {
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  text-align: center;
  align-items: center;
}

.offer-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .offer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 980px) {
  .offer-grid { grid-template-columns: repeat(3, 1fr); }
}

/*
.card-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: hsl(var(--brand) / 0.12);
  color: hsl(var(--brand));
  font-size: 1.2rem;
  margin: 0 auto 0.75rem;
  margin-bottom: 0.55rem;
}
*/

.card-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.9rem;
  display: grid;
  place-items: center;
}

.icon-mask {
  width: 44px;
  height: 44px;
  display: block;

  background-color: #000; /* default (light mode) */

  /* Use the image as a mask */
  -webkit-mask-image: var(--icon-url);
  mask-image: var(--icon-url);

  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;

  -webkit-mask-position: center;
  mask-position: center;

  -webkit-mask-size: contain;
  mask-size: contain;
}

:root[data-theme="dark"] .icon-mask {
  background-color: #fff;
}

.card-icon img {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 0.75rem;
}

.card h3 {
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  position: relative;
  margin-bottom: 0rem;
  padding-bottom: 0.25rem;
}

.card h3::after {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  margin: 0.75rem auto 0;
  margin-bottom: 0.25rem;
  background: hsl(var(--brand) / 0.35);
}

.card ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  margin-top: 0rem;
}

.card ul li {
  margin: 0.5rem 0;
}


.cta-strip {
  margin-top: 2.6rem;
  padding: 1.2rem;
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--surface));
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  text-align: left;
}

.cta-strip h3 {
  margin: 0;
  font-size: 1.1rem;
}

.cta-strip p { margin: 0.2rem 0 0; }

@media (max-width: 719px){
  .cta-strip {
    text-align: center;
  }
  .cta-strip .btn {
    margin: 0 auto;
  }
}

/* Contact form */

.contact-card { max-width: 720px; margin: 0 auto; }

.contact-form { display: grid; gap: 1rem; text-align: left; }

.form-row label { display: block; font-weight: 600; margin-bottom: 0.4rem; padding-left: 0.7rem; }

.form-row input,
.form-row textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: inherit;
  outline: none;
}

:root[data-theme="light"] .form-row input,
:root[data-theme="light"] .form-row textarea {
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: hsl(var(--brand) / 0.6);
  box-shadow: 0 0 0 4px hsl(var(--brand) / 0.18);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.form-status { margin: 0; min-height: 1.5em; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.muted.small { font-size: 0.95rem; }

/* Honeypot hidden */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }


/* ------------------------------
   Portfolio Page
-------------------------------- */

/* Portfolio grid */
.portfolio-grid{
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  margin-top: 1.25rem;
}

@media (min-width: 720px){
  .portfolio-grid{
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px){
  .portfolio-grid{
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Clickable card */
.card--link{
  text-decoration: none;
  color: inherit;
  display: block;
}

/* Portfolio card layout */
.portfolio-card{
  padding: 0;               /* remove the padding so the image can be full-bleed */
  overflow: hidden;         /* clip image corners to card radius */
}

.portfolio-card__media{
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.portfolio-card__media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Body spacing */
.portfolio-card__body{
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  text-align: center;
}

.portfolio-card__title{
  margin: 0;
}

/* Keep button nicely sized and centered */
.portfolio-card__btn{
  justify-self: center;
}

/* Hover/focus polish */
.card--link:hover .portfolio-card__media img{
  transform: scale(1.02);
}

.portfolio-card__media img{
  transition: transform 180ms ease;
}

.card--link:focus-visible{
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}


/* ------------------------------
   Footer
-------------------------------- */

.site-footer {
  padding: 1.6rem 0 2rem;
  border-top: 1px solid hsl(var(--border));
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.footer-links a {
  text-decoration: none;
  color: hsl(var(--muted));
  font-weight: 600;
}

.footer-links a:hover { color: hsl(var(--text)); }




/* ------------------------------
   Project Page
-------------------------------- */

/* Project action buttons */
.project-actions{
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

.project-actions__left,
.project-actions__right{
  display: flex;
  gap: .75rem;
  align-items: center;
}

.project-actions__right{
  margin-left: auto;
}

/* Split section */
.project-split{
  display: grid;
  gap: 1.25rem;
  align-items: stretch;
  margin-top: 1.25rem;
}

@media (min-width: 900px){
  .project-split{
    grid-template-columns: 1.05fr .95fr;
  }
}

.project-split__media{
  position: relative;
  border-radius: 18px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  min-height: 280px;
  max-height: 640px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.project-split__media::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.project-media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  padding: 2rem 1.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;

  background: linear-gradient(
    to bottom,
    rgba(5, 10, 20, 1) 0%,
    rgba(5, 10, 20, 0.75) 50%,
    rgba(5, 10, 20, 0.3) 70%,
    rgba(5, 10, 20, 0) 100%
  );

  color: #fff;
  text-align: center;

  pointer-events: none;
  transition: opacity 0.3s ease;
}


.project-split__media:hover .project-media-overlay {
  opacity: 0;
}

.project-split__media img{
  width: 100%;
  height: auto;
  display: block;
}

.project-media-placeholder{
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: rgba(255,255,255,0.04);
}

/* Bullets */
.project-bullets{
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-bullets li {
  margin-bottom: 1rem !important;
  font-size: 1rem;
}

.project-split__content{
  height: 100%;
  text-align: center;
  padding: 1.1rem 2.2rem !important;
}

.project-split__content h3{
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

/* Gallery */
.project-gallery{
  display: grid;
  gap: .9rem;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 720px){
  .project-gallery{
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px){
  .project-gallery{
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery-tile{
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4 / 3; /* fixed tile size */
  background: var(--bg) center / cover no-repeat;
  background-color: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.gallery-tile:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.16);
}

.gallery-tile:focus-visible{
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.gallery-tile--placeholder{
  background: rgba(255,255,255,0.04);
}


/* Project Writeup */
.project-writeup__card{
  padding: 1.25rem;
}

.section.project-writeup{
  padding-bottom: 0rem;
}

.project-writeup__card .prose {
  max-width: 100ch;
}

.project-disclaimer{
  margin-top: 2.5rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}


/* ---------- Lightbox ---------- */
.t2-lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}
.t2-lightbox.is-open{ display: block; }

.t2-lightbox__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
}

.t2-lightbox__panel{
  position: absolute;
  inset: 2.5vh 2.5vw;
  border-radius: 18px;
  background: rgba(10,14,20,.55);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  overflow: hidden;
}

/* The scrollable image viewport */
.t2-lightbox__viewport{
  position: absolute;
  inset: 0;
  overflow: auto;                    /* key */
  -webkit-overflow-scrolling: touch; /* smooth iOS swipe */
  padding: 0;                        /* image flush */
}

/* Image behaves like your hero preview */
.t2-lightbox__img{
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Controls */
.t2-lightbox__close{
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  z-index: 2;
  cursor: pointer;
}

.t2-lightbox__nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
  cursor: pointer;
}
.t2-lightbox__nav--prev{ left: 12px; }
.t2-lightbox__nav--next{ right: 12px; }

.t2-lightbox__nav span {
  position: relative;
  top: -2px;
}

.t2-lightbox__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  text-align: center;
  font-size: .95rem;

  padding: 2rem 1rem 2.5rem;   /* bigger top/bottom padding */
  
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.6) 40%,
    rgba(0, 0, 0, 0) 100%
  );

  opacity: 1;
  pointer-events: none;
  z-index: 2;
}


@media (max-width: 720px){
  .t2-lightbox__panel{ inset: 1.25vh 1.25vw; border-radius: 14px; }
  .t2-lightbox__nav{ display: none; }
}

/* Optional: hide scrollbar but keep scroll */
.t2-lightbox__viewport{
  scrollbar-width: none;
}
.t2-lightbox__viewport::-webkit-scrollbar{
  width: 0;
  height: 0;
}