/* ==========================================================================
   FONTS
   Using font-display: swap so text is visible immediately while fonts load.
   ========================================================================== */

@font-face {
  font-family: 'Calibre';
  src: url('../assets/Calibre-Regular-b0d4cbb1201155ddccc21d1b8059a670.woff2') format('woff2'),
    url('../assets/Calibre-Regular-98526589fa32315c552129869e08427e.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibre';
  src: url('../assets/Calibre-Medium-568dce56f869a519a015d3b69443b067.woff2') format('woff2'),
    url('../assets/Calibre-Medium-46693d9b57a6b8a657b5393258f6e899.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibre';
  src: url('../assets/Calibre-Semibold-94fc73852539d6733dc0d80252c5e3fb.woff2') format('woff2'),
    url('../assets/Calibre-Semibold-6972688a249bd53a6c7e69a89e50cdd6.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Calibre';
  src: url('../assets/Calibre-RegularItalic-5f875bd7b669f1e11b622d4d6d71b5b0.woff2') format('woff2'),
    url('../assets/Calibre-RegularItalic-57371b9e514dbbe9da31dad1a298de2d.woff') format('woff');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Calibre';
  src: url('../assets/Calibre-MediumItalic-7aa140573fd9ed30ae01e117c418b12b.woff2') format('woff2'),
    url('../assets/Calibre-MediumItalic-aa285f95879aa2c2d26b228d5e422da6.woff') format('woff');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Calibre';
  src: url('../assets/Calibre-SemiboldItalic-5f04bffe7ce988169806d66e417a966a.woff2') format('woff2'),
    url('../assets/Calibre-SemiboldItalic-ad4bd95abee7bca1bdd6a93398f84a04.woff') format('woff');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('../assets/SFMono-Regular-8799e6387338d58f2f137df821c86eb4.woff2') format('woff2'),
    url('../assets/SFMono-Regular-e36fa5257c93fc7711eae342068f9eda.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('../assets/SFMono-Semibold-6e6f6c93f4bdf9cbd090c60e97a017e2.woff2') format('woff2'),
    url('../assets/SFMono-Semibold-ee054046915420413d0068fb1e7105c3.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('../assets/SFMono-RegularItalic-a596917f86217b40000ff1b894cd0e52.woff2') format('woff2'),
    url('../assets/SFMono-RegularItalic-3a20a00dfdeb4ba538473fa7bf625cbd.woff') format('woff');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('../assets/SFMono-SemiboldItalic-9a0ae6382e12c5e28a7342ffb41cf4da.woff2') format('woff2'),
    url('../assets/SFMono-SemiboldItalic-10eb596e904940cd1aebb2cc6286015c.woff') format('woff');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

/* ==========================================================================
   DESIGN TOKENS
   All CSS custom properties live here. Dark mode overrides follow immediately.
   ========================================================================== */

:root {
  /* --- Color palette (light mode) --- */
  --dark-navy: #FFFFFF;
  --navy: #FAFAF8;
  --light-navy: #F0F0EE;
  --lightest-navy: rgba(0, 0, 0, 0.1);
  --navy-shadow: rgba(0, 0, 0, 0.1);
  --slate: #4B5563;
  --light-slate: #374151;
  --lightest-slate: #111827;
  --white: #111827;
  --primary: #FF9900;
  --primary-tint: rgba(255, 153, 0, 0.1);

  /* --- Theming helpers --- */
  /* The vertical line drawn below social icons and the email link */
  --line-color: rgba(0, 0, 0, 0.4);
  /* Semi-transparent nav background for the frosted-glass effect */
  --header-bg: rgba(255, 255, 255, 0.85);
  /* Tint overlay color applied over project/about images */
  --image-tint-bg: var(--primary);

  /* --- Typography --- */
  --font-sans: 'Calibre', 'San Francisco', 'SF Pro Text', -apple-system, system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  --fz-xxs: 12px;
  --fz-xs: 13px;
  --fz-sm: 14px;
  --fz-md: 16px;
  --fz-lg: 18px;
  --fz-xl: 20px;
  --fz-xxl: 22px;
  --fz-heading: 32px;

  /* --- Layout & animation --- */
  --border-radius: 4px;
  --nav-height: 100px;
  --nav-scroll-height: 70px;
  --tab-height: 42px;
  --tab-width: 120px;
  --hamburger-width: 30px;
  --easing: cubic-bezier(0.645, 0.045, 0.355, 1);
  --transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Dark mode overrides — only values that actually differ from light mode */
[data-theme="dark"] {
  --dark-navy: #121212;
  --navy: #121212;
  --light-navy: #1E1E1E;
  --lightest-navy: rgba(115, 115, 115, 1);
  --navy-shadow: rgba(0, 0, 0, 0.7);
  --slate: #E2E8F0;
  --light-slate: #F1F5F9;
  --lightest-slate: #F8FAFC;
  --white: #e6f1ff;
  --line-color: rgba(255, 255, 255, 0.4);
  --header-bg: rgba(18, 18, 18, 0.85);
}

/* ==========================================================================
   BASE / RESET
   ========================================================================== */

html {
  box-sizing: border-box;
  width: 100%;
  scroll-behavior: smooth;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

::selection {
  background-color: var(--slate);
  color: var(--lightest-slate);
}

body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  background-color: var(--navy);
  color: var(--slate);
  font-family: var(--font-sans);
  font-size: var(--fz-xl);
  line-height: 1.3;
}

@media (max-width: 480px) {
  body {
    font-size: var(--fz-lg);
  }
}

/* #9 — Improve line-height for mobile readability */
@media (max-width: 768px) {
  body {
    line-height: 1.5;
  }
}

/* The main content wrapper. fillHeight removes top/bottom padding
   so sections control their own spacing. */
main {
  margin: 0 auto;
  width: 100%;
  max-width: 1600px;
  min-height: 100vh;
  padding: 200px 150px;
}

@media (max-width: 1080px) {
  main {
    padding: 200px 100px;
  }
}

@media (max-width: 768px) {
  main {
    padding: 150px 50px;
  }
}

@media (max-width: 480px) {
  main {
    padding: 125px 25px;
  }
}

main.fillHeight {
  padding: 0 150px;
  counter-reset: section;
  /* drives the 01. 02. 03. section numbers */
}

@media (max-width: 1080px) {
  main.fillHeight {
    padding: 0 100px;
  }
}

@media (max-width: 768px) {
  main.fillHeight {
    padding: 0 50px;
  }
}

@media (max-width: 480px) {
  main.fillHeight {
    padding: 0 25px;
  }
}

section {
  margin: 0 auto;
  padding: 100px 0;
  max-width: 1000px;
  scroll-margin-top: var(--nav-height);
}

@media (max-width: 768px) {
  section {
    padding: 80px 0;
  }
}

@media (max-width: 480px) {
  section {
    padding: 60px 0;
  }
}

/* --- Typography --- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: var(--lightest-slate);
  line-height: 1.1;
}

.big-heading {
  margin: 0;
  font-size: clamp(40px, 8vw, 80px);
}

/* #10 — Reduce subtitle size on small screens for visual hierarchy */
@media (max-width: 480px) {
  .big-heading.sub-heading {
    font-size: clamp(28px, 6vw, 40px);
  }
}

.medium-heading {
  margin: 0;
  font-size: clamp(40px, 8vw, 60px);
}

/* Section headings with auto-incrementing counter prefix (e.g. "01.") */
.numbered-heading {
  display: flex;
  align-items: center;
  position: relative;
  margin: 10px 0 40px;
  width: 100%;
  font-size: clamp(26px, 5vw, var(--fz-heading));
  white-space: nowrap;
}

.numbered-heading:before {
  position: relative;
  bottom: 4px;
  counter-increment: section;
  content: '0' counter(section) '.';
  margin-right: 10px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: clamp(var(--fz-md), 3vw, var(--fz-xl));
  font-weight: 400;
}

@media (max-width: 480px) {
  .numbered-heading:before {
    margin-bottom: -3px;
    margin-right: 5px;
  }
}

@media (max-width: 768px) {
  .numbered-heading {
    margin-bottom: 25px;
  }
}

/* Decorative horizontal rule after each section heading */
.numbered-heading:after {
  content: '';
  display: block;
  position: relative;
  top: -5px;
  width: 300px;
  height: 1px;
  margin-left: 20px;
  background-color: var(--lightest-navy);
}

@media (max-width: 1080px) {
  .numbered-heading:after {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .numbered-heading:after {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .numbered-heading:after {
    margin-left: 10px;
  }
}

img,
svg {
  width: 100%;
  max-width: 100%;
  vertical-align: middle;
}

.nav .logo a svg {
  width: 42px;
  height: 42px;
}

a {
  display: inline-block;
  text-decoration: none;
  text-decoration-skip-ink: auto;
  color: inherit;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}

a:hover,
a:focus {
  color: var(--primary);
}

p {
  margin: 0 0 15px 0;
}

p:last-child,
p:last-of-type {
  margin: 0;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 0;
}

ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Inline text link with an animated underline on hover */
.inline-link {
  display: inline-block;
  text-decoration: none;
  text-decoration-skip-ink: auto;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  color: var(--primary);
}

.inline-link:hover,
.inline-link:focus,
.inline-link:active {
  color: var(--primary);
  outline: 0;
}

.inline-link:after {
  content: '';
  display: block;
  width: 0;
  height: 1px;
  position: relative;
  bottom: 0.37em;
  background-color: var(--primary);
  transition: var(--transition);
  opacity: 0.5;
}

.inline-link:hover:after,
.inline-link:focus:after,
.inline-link:active:after {
  width: 100%;
}

/* Scroll-triggered fade-up animation.
   JS adds .fade-enter to elements, then .fade-enter-active when they enter the viewport. */
.fade-enter {
  opacity: 0.01;
  transform: translateY(20px);
  transition: opacity 300ms var(--easing), transform 300ms var(--easing);
}

.fade-enter-active {
  opacity: 1;
  transform: translateY(0px);
}

/* Center a block element with top margin — used under the projects grid */
.center-mt {
  text-align: center;
  margin-top: 50px;
}

/* ==========================================================================
   HEADER & NAV
   ========================================================================== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  z-index: 11;
  padding: 0px 50px;
  width: 100%;
  height: var(--nav-height);
  background-color: var(--header-bg);
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

/* Shrinks and sticks to top when scrolling up */
.header.scroll-up {
  height: var(--nav-scroll-height);
  transform: translateY(0px);
  box-shadow: 0 10px 30px -10px var(--navy-shadow);
}

/* Slides off-screen when scrolling down */
.header.scroll-down {
  height: var(--nav-scroll-height);
  transform: translateY(calc(var(--nav-scroll-height) * -1));
  box-shadow: 0 10px 30px -10px var(--navy-shadow);
}

@media (max-width: 1080px) {
  .header {
    padding: 0 40px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 25px;
  }
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  width: 100%;
  color: var(--lightest-slate);
  font-family: var(--font-mono);
  counter-reset: item 0;
  /* drives the 01. 02. prefixes on nav links */
  z-index: 12;
}

.nav .logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav .logo a {
  color: var(--primary);
  width: 42px;
  height: 42px;
}

.nav .logo a:hover,
.nav .logo a:focus {
  transform: translateY(-3px);
}

.nav-links {
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    /* replaced by the hamburger + sidebar on mobile */
  }
}

.nav-links ol {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-links ol li {
  margin: 0 5px;
  position: relative;
  counter-increment: item 1;
  font-size: var(--fz-xs);
}

.nav-links ol li a {
  padding: 10px;
}

.nav-links ol li a:before {
  content: '0' counter(item) '.';
  margin-right: 5px;
  color: var(--primary);
  font-size: var(--fz-xxs);
  text-align: right;
}

/* Highlight the nav link whose section is currently in view (set by JS scrollspy) */
.nav-links ol li a.active-link,
.sidebar nav ol li a.active-link {
  color: var(--primary);
}

/* ==========================================================================
   MOBILE MENU (hamburger button + slide-in sidebar)
   ========================================================================== */

/* The .menu wrapper is hidden on desktop; visible on mobile */
.menu {
  display: none;
}

@media (max-width: 768px) {
  .menu {
    display: flex;
    align-items: center;
    gap: 4px;
  }
}

.hamburger-button {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 10;
  margin-right: -15px;
  /* #5 — Minimum 48x48 tap target per Apple HIG */
  min-width: 48px;
  min-height: 48px;
  padding: 15px;
  border: 0;
  background-color: transparent;
  color: inherit;
  text-transform: none;
  transition-timing-function: linear;
  transition-duration: 0.15s;
  transition-property: opacity, filter;
}

/* Three-bar hamburger icon built entirely from CSS pseudo-elements */
.ham-box {
  display: inline-block;
  position: relative;
  width: var(--hamburger-width);
  height: 24px;
}

.ham-box-inner {
  position: absolute;
  top: 50%;
  right: 0;
  width: var(--hamburger-width);
  height: 2px;
  border-radius: var(--border-radius);
  background-color: var(--primary);
  transition-duration: 0.22s;
  transition-property: transform;
  transition-delay: 0s;
  transform: rotate(0deg);
  transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
}

.ham-box-inner:before,
.ham-box-inner:after {
  content: '';
  display: block;
  position: absolute;
  left: auto;
  right: 0;
  width: var(--hamburger-width);
  height: 2px;
  border-radius: 4px;
  background-color: var(--primary);
  transition-timing-function: ease;
  transition-duration: 0.15s;
  transition-property: transform;
}

/* Top bar — slightly wider than center for visual rhythm */
.ham-box-inner:before {
  width: 120%;
  top: -10px;
  opacity: 1;
  transition: var(--transition);
}

/* Bottom bar — slightly narrower for visual rhythm */
.ham-box-inner:after {
  width: 80%;
  bottom: -10px;
  transform: rotate(0deg);
  transition: var(--transition);
}

/* Slide-in sidebar panel */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  padding: 50px 10px;
  width: min(75vw, 400px);
  height: 100vh;
  outline: 0;
  background-color: var(--light-navy);
  box-shadow: -10px 0px 30px -15px var(--navy-shadow);
  z-index: 9;
  transform: translateX(100%);
  /* off-screen by default */
  visibility: hidden;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.sidebar nav {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex-direction: column;
  color: var(--lightest-slate);
  font-family: var(--font-mono);
  text-align: center;
}

.sidebar ol {
  padding: 0;
  margin: 0;
  list-style: none;
  width: 100%;
}

.sidebar ol li {
  position: relative;
  margin: 0 auto 20px;
  font-size: clamp(var(--fz-sm), 4vw, var(--fz-lg));
}

/* #6 — Symmetrical padding for balanced touch targets */
.sidebar ol li a {
  display: inline-block;
  padding: 12px 20px;
  width: 100%;
}

/* When the menu is open: lock body scroll, slide in the sidebar, animate hamburger to ✕ */
body.menu-open {
  overflow: hidden;
}

body.menu-open .sidebar {
  transform: translateX(0%);
  visibility: visible;
}

body.menu-open .hamburger-button .ham-box-inner {
  transform: rotate(225deg);
  transition-delay: 0.12s;
  transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}

body.menu-open .hamburger-button .ham-box-inner:before {
  width: 100%;
  top: 0;
  opacity: 0;
  transition: top 0.1s ease-out, opacity 0.1s ease-out 0.12s;
}

body.menu-open .hamburger-button .ham-box-inner:after {
  width: 100%;
  bottom: 0;
  transform: rotate(-90deg);
  transition: bottom 0.1s ease-out, transform 0.22s cubic-bezier(0.215, 0.61, 0.355, 1) 0.12s;
}

/* ==========================================================================
   FIXED SIDEBARS (social icons left, email right)
   Only visible on wider screens — hidden on mobile via media query.
   ========================================================================== */

.side-element {
  width: 40px;
  position: fixed;
  bottom: 0;
  z-index: 10;
  color: var(--light-slate);
}

.side-element.left {
  left: 40px;
  right: auto;
}

.side-element.right {
  left: auto;
  right: 40px;
}

@media (max-width: 1080px) {
  .side-element.left {
    left: 20px;
  }

  .side-element.right {
    right: 20px;
  }
}

@media (max-width: 768px) {
  .side-element {
    display: none;
  }
}

/* Vertical list of social icons with a line extending down to the page edge */
.social-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-list:after {
  content: '';
  display: block;
  width: 1px;
  height: 90px;
  margin: 0 auto;
  background-color: var(--line-color);
}

.social-list li {
  padding: 10px;
}

.social-list li a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  width: 20px;
  height: 20px;
}

.social-list li a:hover,
.social-list li a:focus {
  transform: translateY(-3px);
}

.social-list li a svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
}

/* Vertical email link with a line extending down to the page edge */
.email-link-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.email-link-wrapper:after {
  content: '';
  display: block;
  width: 1px;
  height: 90px;
  margin: 0 auto;
  background-color: var(--line-color);
}

.email-link-wrapper a {
  margin: 20px auto;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: var(--fz-sm);
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  color: var(--light-slate);
}

.email-link-wrapper a:hover,
.email-link-wrapper a:focus {
  transform: translateY(-3px);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.hero {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: flex-start;
  /* #12 — Use dvh to account for mobile browser chrome */
  min-height: 100dvh;
  min-height: 100vh; /* fallback for older browsers */
  padding: var(--nav-height) 0 0;
}

@media (max-width: 768px) {
  .hero {
    min-height: 85dvh;
    min-height: 85vh;
  }
}

.hero h1 {
  margin: 0 0 30px 4px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: clamp(var(--fz-sm), 5vw, var(--fz-md));
  font-weight: 400;
}

.hero h3 {
  margin-top: 10px;
  color: #9CA3AF;
  line-height: 0.9;
}

.hero p {
  margin: 20px 0 0;
  max-width: 500px;
}

/* Strikethrough-style muted text used for the "Web3 products" span */
.hero .disabled {
  color: var(--slate);
}

/* ==========================================================================
   SHARED BUTTON STYLE — "email-link" / CTA buttons
   Used in the hero, contact section, and projects "Show More" button.
   ========================================================================== */

.hero-badge {
  color: var(--primary);
  background-color: var(--primary-tint);
  border: 1px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 0.75rem 1.25rem;
  font-size: var(--fz-sm);
  font-family: var(--font-mono);
  font-weight: bold;
  line-height: 1;
  display: inline-block;
  cursor: default;
  /* #2 — Prevent overflow on narrow screens */
  max-width: 90vw;
  white-space: normal;
  text-align: center;
}

@media (max-width: 480px) {
  .hero-badge {
    font-size: var(--fz-xxs);
    padding: 0.5rem 1rem;
  }
}

.email-link,
.more-button {
  color: var(--primary);
  background-color: transparent;
  border: 1px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 1.25rem 1.75rem;
  font-size: var(--fz-sm);
  font-family: var(--font-mono);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.email-link:hover,
.email-link:focus,
.email-link:active,
.more-button:hover {
  background-color: var(--primary-tint);
  outline: none;
}

/* Hero button needs extra top margin to sit below the paragraph */
.hero .email-link {
  margin-top: 50px;
  align-self: center;
}
@media (max-width: 480px) {
  .hero .email-link {
    display: block;
    width: 100%;
    max-width: 280px;
    text-align: center;
  }
}
.hero-scroll-indicator {
  align-self: center;
  margin-top: 40px;
  color: var(--primary);
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Contact button also needs extra top margin */
.contact .email-link {
  margin-top: 50px;
}

/* ==========================================================================
   ABOUT SECTION
   ========================================================================== */

/* Two-column layout: text on the left, photo on the right */
.about .inner {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 50px;
}

@media (max-width: 768px) {
  .about .inner {
    display: block;
  }
}

/* Two-column grid of tech skills with arrow bullets */
.about-text ul.skills-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 200px));
  gap: 0 10px;
  padding: 0;
  margin: 20px 0 0 0;
  overflow: hidden;
  list-style: none;
}

.about-text ul.skills-list li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 20px;
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
}

.about-text ul.skills-list li:before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: var(--fz-sm);
  line-height: 12px;
}

.about-text .table-wrapper {
  overflow-x: auto;
  margin-top: 10px;
  -webkit-overflow-scrolling: touch;
}

.about-text .synthesis-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
  min-width: 450px;
  margin-top: 30px;
}

.about-text .synthesis-table th,
.about-text .synthesis-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--lightest-navy);
}

.about-text .synthesis-table th {
  color: var(--lightest-slate);
  font-family: var(--font-mono);
  font-weight: 600;
  border-bottom-width: 2px;
}

.about-text .synthesis-table td {
  color: var(--slate);
  vertical-align: top;
  line-height: 1.4;
}

.about-text .synthesis-table tbody tr:last-of-type td {
  border-bottom: none;
}

/* #11 — Replace horizontal-scroll table with stacked cards on mobile */
@media (max-width: 600px) {
  .about-text .table-wrapper {
    overflow-x: visible;
  }

  .about-text .synthesis-table,
  .about-text .synthesis-table thead,
  .about-text .synthesis-table tbody,
  .about-text .synthesis-table th,
  .about-text .synthesis-table td,
  .about-text .synthesis-table tr {
    display: block;
    min-width: 0;
  }

  .about-text .synthesis-table thead {
    display: none;
  }

  .about-text .synthesis-table tbody tr {
    background-color: var(--light-navy);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    padding: 12px;
    border-bottom: none;
  }

  .about-text .synthesis-table td {
    border-bottom: none;
    padding: 4px 0;
    position: relative;
  }

  .about-text .synthesis-table td:before {
    content: attr(data-label);
    display: block;
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: var(--fz-xxs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
  }
}

/* Profile photo with a coloured border offset and hover effect */
.about-pic-mobile {
  display: none;
  margin-bottom: 30px;
  max-width: 150px;
  margin-left: auto;
  margin-right: auto;
}
.about-pic-mobile img {
  border-radius: 50%;
  border: 2px solid var(--primary);
}
@media (max-width: 768px) {
  .about-pic-mobile {
    display: block;
  }
}

.about-caption {
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
  color: var(--light-slate);
  text-align: center;
  margin-top: 15px;
}

.about-pic {
  position: relative;
  max-width: 300px;
}

@media (max-width: 768px) {
  .about-pic {
    margin: 50px auto 0;
    width: 70%;
  }
}

/* #3 — Reduce decorative border offset on mobile to avoid clipping */
@media (max-width: 480px) {
  .about-pic .wrapper:after {
    top: 10px;
    left: 10px;
  }
}

.about-pic .wrapper {
  display: block;
  position: relative;
  width: 100%;
  border-radius: var(--border-radius);
  background-color: var(--primary);
}

/* Tint overlay: covers the image with the primary colour in normal blend mode */
.about-pic .wrapper:before {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
  transition: var(--transition);
  top: 0;
  left: 0;
  z-index: 3;
  background-color: var(--image-tint-bg);
  opacity: 0.2;
}

/* Decorative offset border */
.about-pic .wrapper:after {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
  transition: var(--transition);
  border: 2px solid var(--primary);
  top: 20px;
  left: 20px;
  z-index: -1;
}

.about-pic .wrapper:hover:after,
.about-pic .wrapper:focus:after {
  top: 15px;
  left: 15px;
}

.about-pic .wrapper .img {
  position: relative;
  border-radius: var(--border-radius);
  mix-blend-mode: normal;
  filter: grayscale(0%) contrast(1);
  transition: var(--transition);
}

/* On hover: remove grayscale and tint to show full colour */
.about-pic .wrapper:hover .img,
.about-pic .wrapper:focus .img {
  filter: none;
  mix-blend-mode: normal;
}

.about-pic .wrapper:hover:before,
.about-pic .wrapper:focus:before {
  opacity: 0;
}

/* ==========================================================================
   EXPERIENCE / JOBS SECTION
   ========================================================================== */

.jobs .inner {
  display: flex;
}

@media (max-width: 600px) {
  .jobs .inner {
    display: block;
  }
}

.tab-list {
  position: relative;
  z-index: 3;
  width: max-content;
  padding: 0;
  margin: 0;
  list-style: none;
  background-color: var(--light-navy);
  border-radius: var(--border-radius);
  padding: 10px 0;
}

@media (max-width: 600px) {
  .tab-list {
    display: flex;
    overflow-x: auto;
    width: calc(100% + 50px);
    padding-left: 0;
    margin-left: 0;
    margin-bottom: 30px;
    /* #8 — Hide scrollbar visually but keep scroll functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Fade-out right edge to hint at scrollability */
    -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
    mask-image: linear-gradient(to right, black 80%, transparent 100%);
  }

  .tab-list::-webkit-scrollbar {
    display: none;
  }
}

.tab-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--tab-height);
  padding: 0 20px 2px;
  border-left: 2px solid var(--lightest-navy);
  background-color: transparent;
  color: var(--light-slate);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
  text-align: left;
  white-space: nowrap;
  transition: var(--transition);
}

@media (max-width: 600px) {
  .tab-button {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 120px;
    padding: 0 15px;
    border-left: 0;
    border-bottom: 2px solid var(--lightest-navy);
    text-align: center;
  }
}

.tab-button:hover,
.tab-button:focus {
  background-color: var(--light-navy);
  color: var(--primary);
  outline: none;
}

.tab-button.active {
  color: var(--primary);
}

/* Animated highlight bar that tracks the active tab button */
.tab-list .highlight {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 2px;
  height: var(--tab-height);
  border-radius: var(--border-radius);
  background: var(--primary);
  transition: transform 0.25s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
  transform: translateY(0);
}

/* On mobile the highlight sits at the bottom of the horizontal tabs */
@media (max-width: 600px) {
  .tab-list .highlight {
    top: auto;
    bottom: 0;
    height: 2px;
  }
}

.tab-content {
  width: 100%;
  height: auto;
  padding-top: 10px;
  padding-left: 30px;
  display: none;
}

.tab-content.active {
  display: block;
}

@media (max-width: 600px) {
  .tab-content {
    padding-left: 0;
    padding-top: 20px;
  }
}

.tab-content h3 {
  margin-bottom: 2px;
  font-size: var(--fz-xxl);
  font-weight: 500;
  line-height: 1.3;
}

.tab-content h3 .company {
  color: var(--primary);
}

.tab-content .range {
  margin-bottom: 25px;
  color: var(--light-slate);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
}

.tab-content ul {
  padding: 0;
  margin: 0;
  list-style: none;
  font-size: var(--fz-lg);
}

@media (max-width: 600px) {
  .tab-content ul {
    font-size: var(--fz-md);
  }
}

.tab-content ul li {
  position: relative;
  padding-left: 30px;
  margin-bottom: 10px;
}

.tab-content ul li:before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* ==========================================================================
   PROJECTS SECTION — Featured (large grid) + Others (card grid)
   ========================================================================== */

.project-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Each featured project uses a 12-column grid so content and image overlap */
.featured-project {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(12, 1fr);
  align-items: center;
  margin-bottom: 100px;
}

@media (max-width: 768px) {
  .featured-project {
    margin-bottom: 70px;
    align-items: flex-start;
  }
}

.featured-project:last-of-type {
  margin-bottom: 0;
}

/* Left-aligned project: content spans columns 1-7, image spans 6-12 */
.project-content {
  position: relative;
  grid-area: 1 / 1 / -1 / 8;
  z-index: 2;
}

/* Right-aligned project (.right): content spans 7-12, image spans 1-8 */
.featured-project.right .project-content {
  grid-column: 7 / -1;
  text-align: right;
}

@media (max-width: 1080px) {
  .project-content {
    grid-column: 1 / 9;
  }

  .featured-project.right .project-content {
    grid-column: 5 / -1;
  }
}

@media (max-width: 768px) {
  /* #1 — Stack projects vertically: image on top, content below */
  .featured-project {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .project-content {
    order: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: auto;
    grid-column: 1 / -1;
    padding: 20px 0 0;
    z-index: 5;
  }

  .featured-project.right .project-content {
    grid-column: 1 / -1;
    padding: 20px 0 0;
    text-align: left;
    order: 2;
  }
}

.project-overline {
  margin: 10px 0;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
  font-weight: 400;
}

.project-title {
  color: var(--lightest-slate);
  font-size: clamp(24px, 5vw, 28px);
}

@media (min-width: 768px) {
  .project-title {
    margin: 0 0 20px;
  }
}

.project-description {
  box-shadow: 0 10px 30px -10px var(--navy-shadow);
  transition: var(--transition);
  position: relative;
  z-index: 2;
  padding: 25px;
  border-radius: var(--border-radius);
  background-color: var(--navy);
  border: 1px solid var(--lightest-navy);
  color: var(--light-slate);
  font-size: var(--fz-lg);
}

@media (max-width: 768px) {
  /* #1 — Restore proper description background when stacked */
  .project-description {
    padding: 16px;
    background-color: var(--light-navy);
    box-shadow: 0 4px 20px -10px var(--navy-shadow);
  }
}

.project-tech-list {
  display: flex;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  margin: 25px 0 10px;
  padding: 0;
  list-style: none;
}

.featured-project.right .project-tech-list {
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .featured-project.right .project-tech-list {
    justify-content: flex-start;
  }
}

.project-tech-list li {
  margin: 0 10px 10px 0;
  color: var(--light-slate);
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
  white-space: nowrap;
  background-color: var(--light-navy);
  padding: 4px 12px;
  border-radius: 20px;
}

.featured-project.right .project-tech-list li {
  margin: 0 0 5px 20px;
}

@media (max-width: 768px) {
  .featured-project.right .project-tech-list li {
    margin: 0 10px 5px 0;
  }
}

.project-links {
  display: flex;
  align-items: center;
  position: relative;
  margin-top: 10px;
  margin-left: -10px;
  color: var(--lightest-slate);
}

.featured-project.right .project-links {
  justify-content: flex-end;
  margin-left: 0;
  margin-right: -10px;
}

@media (max-width: 768px) {
  .featured-project.right .project-links {
    justify-content: flex-start;
    margin-left: -10px;
    margin-right: 0;
  }
}

.project-links a {
  padding: 10px;
  display: inline-flex;
  align-items: center;
}

.view-project-btn {
  font-family: var(--font-mono);
  font-size: var(--fz-xs);
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 8px 16px;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.project-links a:hover .view-project-btn {
  background-color: var(--primary-tint);
}

.project-links a svg {
  width: 20px;
  height: 20px;
}

/* Project screenshot with a coloured tint overlay that clears on hover */
.project-image {
  box-shadow: 0 10px 30px -10px var(--navy-shadow);
  transition: var(--transition);
  grid-area: 1 / 6 / -1 / -1;
  position: relative;
  z-index: 1;
}

.featured-project.right .project-image {
  grid-column: 1 / 8;
}

@media (max-width: 1080px) {
  .project-image {
    grid-column: 5 / -1;
  }

  .featured-project.right .project-image {
    grid-column: 1 / 9;
  }
}

@media (max-width: 768px) {
  /* #1 — Image is now stacked above content, show it at full opacity */
  .project-image {
    grid-column: 1 / -1;
    height: auto;
    opacity: 1;
    order: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
  }
}

.project-image a {
  width: 100%;
  height: 100%;
  background-color: var(--primary);
  border-radius: var(--border-radius);
  vertical-align: middle;
}

/* Tint overlay on the project image link */
.project-image a:before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  transition: var(--transition);
  background-color: var(--image-tint-bg);
  opacity: 0.2;
}

.project-image .img {
  border-radius: var(--border-radius);
  mix-blend-mode: normal;
  filter: grayscale(0%) contrast(1) brightness(90%);
}

@media (max-width: 768px) {
  /* #1 — Full-fidelity image in stacked layout */
  .project-image .img {
    object-fit: cover;
    width: 100%;
    height: auto;
    max-height: 220px;
    filter: grayscale(0%) contrast(1) brightness(90%);
  }
}

/* On hover: reveal full-colour image and hide tint overlay */
.project-image a:hover,
.project-image a:focus {
  background: transparent;
  outline: 0;
}

.project-image a:hover .img,
.project-image a:focus .img {
  filter: none;
  mix-blend-mode: normal;
}

.project-image a:hover:before,
.project-image a:focus:before {
  opacity: 0;
}

/* --- Other Noteworthy Projects header --- */
.section-header-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 100px;
  margin-bottom: 20px;
}

.section-header-text h2 {
  font-size: clamp(26px, 5vw, var(--fz-heading));
  font-weight: 600;
  color: var(--lightest-slate);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  position: relative;
  white-space: nowrap;
}

.section-header-text h2:before {
  content: '04.';
  margin-right: 10px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: clamp(var(--fz-md), 3vw, var(--fz-xl));
  font-weight: 400;
}

.section-header-text .archive-link {
  font-family: var(--font-mono);
  font-size: var(--fz-sm);
  color: var(--primary);
}

/* Responsive card grid for the smaller projects */
/* #14 — Lower minmax to support 320px screens */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 50px;
}

.project-card {
  cursor: default;
  transition: var(--transition);
}

.project-card .project-inner {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  height: 100%;
  padding: 2rem 1.75rem;
  border-radius: var(--border-radius);
  background-color: var(--light-navy);
  transition: var(--transition);
  box-shadow: 0 10px 30px -15px var(--navy-shadow);
  border: 1px solid transparent;
}

@media (max-width: 600px) {
  .project-card .project-inner {
    padding: 1.5rem 1.25rem;
  }
}

.project-card .project-inner:hover {
  transform: translateY(-7px);
  box-shadow: 0 20px 30px -15px var(--navy-shadow);
  border-color: var(--primary);
}

.project-card .project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  width: 100%;
}

.project-card .folder svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.project-card .project-links a {
  padding: 5px 7px;
}

.project-card .project-links svg {
  width: 20px;
  height: 20px;
  color: var(--light-slate);
}

.project-card .project-links svg:hover {
  color: var(--primary);
}

.project-card .project-title {
  margin: 0 0 10px;
  color: var(--lightest-slate);
  font-size: var(--fz-xxl);
}

/* Reset the featured .project-description styles inside cards */
.project-card .project-description {
  color: var(--light-slate);
  font-size: 17px;
  background-color: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  position: static;
  z-index: auto;
}

.project-card footer {
  margin-top: 20px;
}

.project-card .project-tech-list {
  display: flex;
  align-items: flex-end;
  flex-grow: 1;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  list-style: none;
}

.project-card .project-tech-list li {
  font-family: var(--font-mono);
  font-size: var(--fz-xxs);
  line-height: 1.75;
  color: var(--slate);
  margin-right: 15px;
}

/* ==========================================================================
   CONTACT SECTION
   ========================================================================== */

.contact {
  max-width: 600px;
  margin: 0 auto 50px;
  text-align: center;
}

@media (max-width: 768px) {
  .contact {
    margin: 0 auto 50px;
  }
}

/* #15 — Full-width CTA button on mobile for stronger thumb target */
@media (max-width: 480px) {
  .contact .email-link {
    display: block;
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
}

/* "What's Next?" overline — shares .numbered-heading but needs tweaks */
.contact .overline {
  display: block;
  margin-bottom: 20px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: var(--fz-md);
  font-weight: 400;
}

.contact .overline:before {
  bottom: 0;
  font-size: var(--fz-sm);
}

/* Hide the decorative rule that .numbered-heading normally draws */
.contact .overline:after {
  display: none;
}

.contact .title {
  font-size: clamp(40px, 5vw, 60px);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  height: auto;
  min-height: 70px;
  padding: 15px;
  text-align: center;
}

/* Social links in the footer are only shown on mobile
   (on desktop the fixed side-element handles this) */
.social-links-footer {
  display: none;
}

@media (max-width: 768px) {
  .social-links-footer {
    display: block;
    width: 100%;
    max-width: 270px;
    margin: 0 auto 10px;
    color: var(--light-slate);
  }

  .social-links-footer ul {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .social-links-footer ul a {
    padding: 10px;
  }

  .social-links-footer ul a svg {
    width: 20px;
    height: 20px;
  }
}

.footer-credit {
  color: var(--light-slate);
  font-family: var(--font-sans);
  font-size: var(--fz-sm);
  line-height: 1;
}

.footer-credit a {
  padding: 10px;
}

/* ==========================================================================
   THEME TOGGLE BUTTON
   ========================================================================== */

.theme-toggle-btn {
  background: transparent;
  color: var(--primary);
  border: none;
  cursor: pointer;
  padding: 10px;
  margin-left: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle-btn svg {
  width: 24px;
  height: 24px;
}

.theme-toggle-btn:hover {
  transform: translateY(-3px);
}

/* #4 — Mobile theme toggle (shown only on mobile, hidden on desktop) */
.theme-toggle-mobile {
  display: none;
  margin-left: 0;
  margin-right: 4px;
}

@media (max-width: 768px) {
  .theme-toggle-mobile {
    display: flex;
  }
}

/* #7 — Sidebar backdrop overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 8;
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}

body.menu-open .sidebar-overlay {
  display: block;
  opacity: 1;
}