:root {
  --bg: #F8F8F6;
  --bg-card: #FFFFFF;
  --text: #050505;
  --text-muted: #7E7E82;
  --text-dim: #9E9EA2;
  --line: #E6E6E6;
  --line-strong: #C4C4C6;
  --pill-bg: #EDEDEA;
  --pill-text: #222224;
  --badge-bg: rgba(46, 125, 50, 0.08);
  --badge-text: #2E7D32;
  --dot-color: #2E7D32;
  --hover-line: #050505;
  --toast-bg: #18181A;
  --toast-text: #F5F5F5;

  --sans: "Helvetica Now Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  --mono: "Consolas", "Courier New", monospace;

  --content-width: 760px;
  --transition-theme: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

[data-theme="dark"] {
  --bg: #0B0B0C;
  --bg-card: #141416;
  --text: #F2F2F0;
  --text-muted: #8E8E93;
  --text-dim: #5C5C60;
  --line: #222226;
  --line-strong: #38383E;
  --pill-bg: #1A1A1D;
  --pill-text: #D2D2D4;
  --badge-bg: rgba(74, 222, 128, 0.12);
  --badge-text: #4ADE80;
  --dot-color: #4ADE80;
  --hover-line: #F2F2F0;
  --toast-bg: #EAEAEA;
  --toast-text: #111111;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

html {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 10px;
  scroll-behavior: smooth;
  transition: var(--transition-theme);
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  transition: var(--transition-theme);
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

/* Preloader */
.preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  transition: opacity 0.75s ease, visibility 0.75s ease;
}

.preloader__name {
  font-family: var(--serif);
  font-size: clamp(22px, 5vw, 28px);
  letter-spacing: -0.02em;
  color: var(--text);
}

.preloader__status {
  font-family: var(--sans);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.preloader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Page wrapper & Grid */
.page {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 60px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  column-gap: 12px;
  padding-left: 24px;
  padding-right: 24px;
  max-width: 1680px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Links & Hover underlines */
.link-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: max-content;
  white-space: nowrap;
}

.link-hover::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.link-hover:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Pulsing status dot */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--dot-color);
  position: relative;
  flex-shrink: 0;
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background-color: var(--dot-color);
  opacity: 0.4;
  animation: pulse-ring 2.2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.7; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Header */
.header {
  padding-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.header__brand {
  grid-column: 1 / span 5;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.header__name {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header__tagline {
  font-size: 12px;
  color: var(--text-muted);
}

.header__location {
  grid-column: 7 / span 5;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.header__clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--pill-bg);
  padding: 3px 8px;
  border-radius: 4px;
}

.header__actions {
  grid-column: 13 / 17;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--mono);
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.theme-toggle-btn:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.theme-icon {
  font-size: 13px;
}

.header__cv-btn {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* Hero Section */
.hero {
  padding-top: 130px;
  padding-bottom: 40px;
  align-items: start;
}

.hero__media {
  grid-column: 1 / span 5;
  position: relative;
}

.hero__portrait-wrapper {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.hero__portrait-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: contrast(1.02);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero__portrait-wrapper:hover img {
  transform: scale(1.03);
}

.hero__portrait-caption {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 300px;
}

.hero__portrait-caption strong {
  color: var(--text);
  font-weight: 600;
}

.hero__content {
  grid-column: 8 / span 9;
  max-width: var(--content-width);
}

.hero__statement {
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.035em;
  color: var(--text);
}

.hero__sub {
  margin-top: 28px;
  font-family: var(--serif);
  font-size: clamp(20px, 1.9vw, 25px);
  line-height: 1.36;
  color: var(--text-muted);
  letter-spacing: -0.02em;
}

.hero__badges {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 30px;
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.hero-pill:hover {
  border-color: var(--text);
  transform: translateY(-1px);
}

.hero-pill--highlight {
  background: var(--badge-bg);
  color: var(--badge-text);
  border-color: transparent;
  font-weight: 600;
}

/* Sections */
.section {
  padding-top: 90px;
}

.section__content {
  grid-column: 8 / span 9;
  max-width: var(--content-width);
}

.section__label {
  margin-bottom: 36px;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Lists */
.list {
  border-top: 1px solid var(--line);
}

.list__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
  transition: background-color 0.2s ease;
}

.list__row h3 {
  font-family: var(--serif);
  font-size: clamp(22px, 2.3vw, 28px);
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--text);
}

.list__row p {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.list__row span {
  font-family: var(--serif);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  white-space: nowrap;
  justify-self: end;
}

.work-link {
  font-family: var(--serif);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
  justify-self: end;
  color: var(--text);
}

.work-link::after {
  content: " ↗";
  font-family: var(--sans);
  font-size: 14px;
}

.work-link-disabled {
  font-family: var(--serif);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
  justify-self: end;
  color: var(--text-dim);
}

/* Selected Work Items (Clean Editorial Style without images) */
.work-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.work-item > .list__row {
  border-bottom: 0;
  padding-bottom: 8px;
}

.work-desc {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.work-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.work-tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--pill-bg);
  color: var(--pill-text);
  line-height: 1.4;
}

/* Skills Grid */
.skills-container {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.skill-category {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.skill-category:last-child {
  border-bottom: none;
}

.skill-category__title {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.skill-category__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  font-family: var(--serif);
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

.skill-tag:not(:last-child)::after {
  content: "•";
  margin-left: 10px;
  color: var(--line-strong);
  font-family: var(--sans);
  font-size: 11px;
}

/* Honors / Certifications Grid */
.honors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.honor-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.honor-item h4 {
  font-family: var(--serif);
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.25;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}

.honor-item p {
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-muted);
}

/* Footer */
.footer {
  padding-top: 160px;
  padding-bottom: 24px;
  row-gap: 32px;
  border-top: 1px solid var(--line);
  margin-top: 100px;
}

.footer__left {
  grid-column: 1 / span 6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.footer__cta {
  font-family: var(--serif);
  font-size: clamp(26px, 2.5vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
}

.footer__copy {
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer__links {
  grid-column: 8 / span 9;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer__links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

.footer-link {
  font-family: var(--serif);
  font-size: clamp(18px, 1.8vw, 22px);
  letter-spacing: -0.02em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
}

.footer__btn-copy {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--pill-bg);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.footer__btn-copy:hover {
  background: var(--text);
  color: var(--bg);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 10px 18px;
  border-radius: 30px;
  font-family: var(--sans);
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Fade animation targets */
.js-fade-page,
.js-fade-section {
  will-change: opacity, transform;
}

/* ==========================================================
   MOBILE & TABLET RESPONSIVE SYSTEM
   ========================================================== */

/* 1. Medium Tablets (<= 1024px) */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
    padding-left: 20px;
    padding-right: 20px;
  }

  .header__brand {
    grid-column: 1 / span 5;
  }

  .header__location {
    grid-column: 6 / span 4;
  }

  .header__actions {
    grid-column: 10 / 13;
  }

  .hero__media {
    grid-column: 1 / span 4;
  }

  .hero__content {
    grid-column: 5 / 13;
  }

  .section__content {
    grid-column: 5 / 13;
  }

  .footer__left {
    grid-column: 1 / span 4;
  }

  .footer__links {
    grid-column: 5 / 13;
  }
}

/* 2. Small Tablets & Phablets (<= 768px) */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(8, 1fr);
    padding-left: 18px;
    padding-right: 18px;
  }

  .header {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .header__brand {
    grid-column: 1 / span 4;
  }

  .header__location {
    grid-column: 5 / span 4;
    justify-self: end;
  }

  .header__actions {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 10px;
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    padding-top: 70px;
    row-gap: 28px;
  }

  .hero__media {
    grid-column: 1 / -1;
  }

  .hero__portrait-wrapper {
    max-width: 200px;
  }

  .hero__content {
    grid-column: 1 / -1;
  }

  .section {
    padding-top: 60px;
  }

  .section__content {
    grid-column: 1 / -1;
  }

  .honors-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .footer {
    padding-top: 80px;
    margin-top: 60px;
    row-gap: 24px;
  }

  .footer__left {
    grid-column: 1 / -1;
  }

  .footer__links {
    grid-column: 1 / -1;
  }
}

/* 3. Mobile Phones (<= 600px) */
@media (max-width: 600px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .grid {
    display: flex;
    flex-direction: column;
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Header mobile */
  .header {
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 12px;
  }

  .header__brand {
    width: 100%;
  }

  .header__name {
    font-size: 16px;
  }

  .header__location {
    width: 100%;
    justify-content: flex-start;
    font-size: 12px;
  }

  .header__actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
  }

  .theme-toggle-btn {
    padding: 6px 14px;
    font-size: 12px;
  }

  .header__cv-btn {
    font-size: 13px;
    padding: 6px 0;
  }

  /* Hero mobile */
  .hero {
    padding-top: 44px;
    padding-bottom: 20px;
    gap: 20px;
  }

  .hero__media {
    width: 100%;
  }

  .hero__portrait-wrapper {
    width: 140px;
    max-width: 140px;
    aspect-ratio: 4 / 5;
    border-radius: 4px;
  }

  .hero__portrait-caption {
    font-size: 11.5px;
    margin-top: 10px;
  }

  .hero__statement {
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.03em;
  }

  .hero__sub {
    font-size: 17px;
    line-height: 1.4;
    margin-top: 16px;
  }

  .hero__badges {
    margin-top: 24px;
    gap: 6px;
  }

  .hero-pill {
    font-size: 11px;
    padding: 5px 11px;
  }

  /* Sections mobile */
  .section {
    padding-top: 50px;
  }

  .section__label {
    margin-bottom: 20px;
    font-size: 11.5px;
    letter-spacing: 0.1em;
  }

  /* List rows mobile: stack title and link to prevent collision */
  .list__row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px 0 14px;
  }

  .list__row h3 {
    font-size: 21px;
    line-height: 1.24;
  }

  .list__row p {
    font-size: 12.5px;
    margin-top: 4px;
  }

  .list__row span,
  .work-link,
  .work-link-disabled {
    align-self: flex-start;
    justify-self: flex-start;
    font-size: 16px;
    margin-top: 2px;
  }

  .work-item {
    padding-bottom: 14px;
  }

  .work-desc {
    font-size: 13px;
    line-height: 1.5;
    margin: 10px 0;
  }

  .work-pills {
    gap: 5px;
    margin-bottom: 4px;
  }

  .work-tag {
    font-size: 10.5px;
    padding: 2.5px 7px;
  }

  /* Skills mobile */
  .skills-container {
    gap: 20px;
  }

  .skill-category {
    padding-bottom: 16px;
  }

  .skill-category__title {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .skill-tag {
    font-size: 17px;
    line-height: 1.35;
  }

  .skill-tag:not(:last-child)::after {
    margin-left: 8px;
    font-size: 10px;
  }

  /* Honors mobile */
  .honor-item {
    padding: 12px 0;
  }

  .honor-item h4 {
    font-size: 18px;
    line-height: 1.25;
  }

  .honor-item p {
    font-size: 12px;
  }

  /* Footer mobile */
  .footer {
    padding-top: 60px;
    margin-top: 48px;
    gap: 28px;
  }

  .footer__cta {
    font-size: 26px;
    line-height: 1.2;
  }

  .footer__copy {
    font-size: 12px;
  }

  .footer__links {
    gap: 16px;
  }

  .footer__links-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .footer-link {
    font-size: 18px;
    padding: 4px 0;
    min-height: 36px;
  }

  .footer__btn-copy {
    padding: 7px 16px;
    font-size: 12px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }
}

/* 4. Very Narrow Phones (<= 360px) */
@media (max-width: 360px) {
  .hero__statement {
    font-size: 23px;
  }

  .hero__sub {
    font-size: 15px;
  }

  .list__row h3 {
    font-size: 19px;
  }
}
