/* THEME
   Dark is the default. Light is switched on with body.light (see port.js). */
:root {
  --paper: #09090c;
  --ink: #ECE8F0;
  --forest: #A58AD8;          /* section labels / accents */
  --clay: #B79CE6;            /* hover + links */
  --line: rgba(236, 232, 240, 0.13);
  --frame: #141318;           /* cards / project frames */
  --card-hover: #1A1820;
  --card-shadow: none;
  --muted: #A29BA8;
  --year: #8E8695;
  --tag: #B2A6BF;
  --button-bg: rgba(9, 9, 12, 0.9);
  --node-bg: #6D4BC0;
  --node-ink: #FFFFFF;
  --focus: #C2A9F0;

  /* duck */
  --d-body: #F6C93B;
  --d-light: #FFE58A;
  --d-wing: #E0A91F;
  --d-belly: #E8B72E;
  --d-beak: #F28B2B;
  --d-eye: #14101A;
  --glow-near: rgba(246, 201, 59, 0.5);
  --glow-far: rgba(246, 201, 59, 0.2);
  --spark: #8E6FD8;
}

body.light {
  --paper: #F7F4EF;
  --ink: #221E27;
  --forest: #6A45A6;
  --clay: #5B3794;
  --line: rgba(34, 30, 39, 0.14);
  --frame: #FFFFFF;
  --card-hover: #FFFFFF;
  --card-shadow: 0 1px 2px rgba(60, 40, 90, 0.05), 0 8px 24px -12px rgba(60, 40, 90, 0.12);
  --muted: #6A6371;
  --year: #6E6676;
  --tag: #5E5468;
  --button-bg: rgba(247, 244, 239, 0.94);
  --node-bg: #6A45A6;
  --node-ink: #FFFFFF;
  --focus: #5B3794;

  --d-body: #F4BC2C;
  --d-light: #FFDB73;
  --d-wing: #DB9A12;
  --d-belly: #E6AE1E;
  --d-beak: #E8731A;
  --d-eye: #1E1724;
  --glow-near: rgba(226, 160, 20, 0.34);
  --glow-far: rgba(226, 160, 20, 0.14);
  --spark: #8B66CC;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Section anchors land below the top edge */
section, footer[id] { scroll-margin-top: 28px; }

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

.skip-link:focus:not(:focus-visible) {
    top: -60px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus { top: 16px; }

.wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 80px 50px 130px;
}

/* HEADER */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 34px;
  margin-bottom: 90px;
  gap: 100px;
}

.name {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 56px;
  letter-spacing: -0.01em;
  line-height: 0.95;
}

.header-right { display: flex; align-items: center; gap: 34px; }

nav { display: flex; align-items: center; gap: 28px; font-size: 14px; }

nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

nav a:hover,
nav a[aria-current="true"] { color: var(--clay); border-bottom-color: var(--clay); }

#theme-toggle {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, background-color 0.3s ease;
}

#theme-toggle:hover { color: var(--clay); border-color: var(--clay); transform: rotate(10deg); }

/* SECTION HEADINGS */
.section-label {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--forest);
  margin-bottom: 38px;
}

.section-title {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 26px;
}

.section-intro {
  max-width: 56ch;
  margin: -8px 0 38px;
  color: var(--muted);
  font-size: 15px;
}

/* WORK SECTION */
.work {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 35px;
  margin-bottom: 120px;
}

/* PROJECT */
.piece { position: relative; }

.project-link { display: block; text-decoration: none; }

.piece .frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--frame);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.3s ease;
}

.piece .frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transition: transform 0.4s ease;
}

.piece .frame:hover,
.project-link:focus-visible .frame { border-color: var(--forest); transform: translateY(-2px); }

.piece .frame:hover img { transform: scale(1.02); }

.view-project {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 7px 11px;
  background: var(--button-bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.25s ease, background-color 0.3s ease;
}

.piece .frame:hover .view-project,
.project-link:focus-visible .view-project { opacity: 1; }

.piece .cap {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 10px;
  font-size: 13px;
}

.piece .cap strong { display: block; font-weight: 500; margin-bottom: 4px; }

.piece .cap small {
  display: block;
  max-width: 48ch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.piece .cap .year { flex-shrink: 0; color: var(--year); font-size: 12px; }

.technologies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.technologies span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--tag);
  font-size: 10px;
  line-height: 1.3;
}


/* PROJECT ACTIONS */
.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 16px;
}

.project-action {
    color: var(--clay);
    font-size: 12px;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.project-action:hover,
.project-action:focus-visible {
    color: var(--forest);
    border-bottom-color: var(--forest);
}

/* DATA ANALYSIS PROJECT COVERS */
.data-frame {
    background:
        radial-gradient(
            ellipse at 85% 15%,
            rgba(165, 138, 216, 0.13),
            transparent 55%
        ),
        var(--frame);
}

.data-frame-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: clamp(20px, 4vw, 38px);
    overflow: hidden;
}

.data-frame-kicker {
    color: var(--forest);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    margin-bottom: 18px;
}

.data-frame-mark {
    position: absolute;
    top: 10px;
    right: 24px;
    color: var(--forest);
    opacity: 0.12;
    font-family: 'Fraunces', serif;
    font-size: clamp(60px, 9vw, 100px);
    line-height: 1;
}

.data-frame-title {
    position: relative;
    z-index: 1;
    max-width: 12ch;
    color: var(--ink);
    font-family: 'Fraunces', serif;
    font-size: clamp(25px, 3vw, 38px);
    font-weight: 500;
    line-height: 1.15;
}

.data-frame-detail {
    margin-top: 16px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.12em;
}

.project-category {
    display: block;
    margin-bottom: 7px;
    color: var(--forest);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* PROJECT POSITIONS: 2 x 2 grid on desktop */
.p1 { grid-column: 1 / 4; }
.p2 { grid-column: 4 / 7; }
.p3 { grid-column: 1 / 4; }
.p4 { grid-column: 4 / 7; }
.p5 { grid-column: 1 / 4; }
.p6 { grid-column: 4 / 7; }

/* ABOUT */
.about {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 70px;
  align-items: center;
  margin-bottom: 120px;
}

.about-text p {
  max-width: 52ch;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.about-text p:first-of-type { color: var(--ink); }

.about-art { display: flex; justify-content: center; }

.duck {
  width: 100%;
  max-width: 340px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 14px var(--glow-near)) drop-shadow(0 0 44px var(--glow-far));
  animation: duck-bob 4.5s ease-in-out infinite;
  transition: filter 0.3s ease;
}

.d-body  { fill: var(--d-body); }
.d-light { fill: var(--d-light); }
.d-wing  { fill: var(--d-wing); }
.d-belly { fill: var(--d-belly); }
.d-beak  { fill: var(--d-beak); }
.d-eye   { fill: var(--d-eye); }

.sparkles path,
.sparkles rect { fill: var(--spark); }

.spark-a, .spark-b, .spark-c {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 3.2s ease-in-out infinite;
}

.spark-b { animation-delay: 1s; }
.spark-c { animation-delay: 2s; }

@keyframes duck-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.8); }
}

/* CARDS (skills + timeline) */
.card {
  background: var(--frame);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  padding: 22px 22px 24px;
  transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.3s ease;
}

.card:hover { border-color: var(--forest); transform: translateY(-2px); }

.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }

.card p { color: var(--muted); font-size: 14px; line-height: 1.65; }

/* SKILLS */
#skills { margin-bottom: 120px; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
  list-style: none;
}

.chips li {
  padding: 3px 11px;
  border: 1px solid var(--forest);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
}

/* JOURNEY TIMELINE */
#journey { margin-bottom: 120px; }

.timeline { list-style: none; }

.t-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 24px;
  padding-bottom: 22px;
}

.t-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 25px;
  top: 52px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.t-node {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--node-bg);
  color: var(--node-ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.t-meta { margin-bottom: 8px; color: var(--forest) !important; font-size: 13px !important; }

.t-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--clay);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.t-link:hover { border-bottom-color: var(--clay); }

/* CONTACT */
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  border-top: 1px solid var(--line);
  padding-top: 40px;
}

.footer-grid h2 {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-transform: lowercase;
}

.footer-grid p, .footer-grid a { color: var(--ink); font-size: 15px; }

.footer-grid p { max-width: 38ch; }

.footer-grid a {
  display: block;
  width: fit-content;
  margin-bottom: 6px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-grid a:hover { color: var(--clay); }

/* TABLET */
@media (max-width: 900px) {
    .wrap { padding: 70px 36px 120px; }

    header { gap: 40px; }

    .about { gap: 40px; }
}

/* MOBILE */
@media (max-width: 700px) {

    .wrap {
        padding: 65px 24px 110px;
    }

    /* HEADER */
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 34px;
        padding-bottom: 34px;
        margin-bottom: 70px;
    }

    .name {
        font-size: 44px;
        line-height: 1;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
        align-items: flex-start;
        gap: 20px;
    }

    nav {
        flex-wrap: wrap;
        gap: 8px 20px;
        font-size: 15px;
    }

    #theme-toggle {
        width: 38px;
        height: 38px;
    }

    /* WORK */
    .section-label {
        font-size: 24px;
        margin-bottom: 45px;
    }

    .work {
        grid-template-columns: 1fr;
        gap: 70px;
        margin-bottom: 100px;
    }

    .p1,
    .p2,
    .p3,
    .p4,
    .p5,
    .p6 {
        grid-column: span 1;
    }

    /* PROJECT INFO */
    .piece .cap {
        flex-direction: column;
        gap: 14px;
        margin-top: 18px;
    }

    .piece .cap strong {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .piece .cap small {
        font-size: 13px;
        line-height: 1.7;
    }

    .technologies {
        margin-top: 15px;
        gap: 7px;
    }

    .technologies span {
        padding: 4px 9px;
        font-size: 11px;
    }

    /* ABOUT */
    .about {
        grid-template-columns: 1fr;
        margin-bottom: 90px;
    }

    .duck { max-width: 230px; }

    .section-title { font-size: 26px; }

    #skills, #journey { margin-bottom: 90px; }

    /* TIMELINE */
    .t-item { grid-template-columns: 40px 1fr; gap: 14px; }

    .t-node { width: 40px; height: 40px; font-size: 12px; }

    .t-item:not(:last-child)::before { left: 19px; top: 40px; }

    /* FOOTER */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 45px;
        padding-top: 42px;
    }

    .footer-grid h2 {
        font-size: 14px;
        margin-bottom: 14px;
    }

    .footer-grid p,
    .footer-grid a {
        font-size: 16px;
        line-height: 1.7;
        overflow-wrap: anywhere;
    }
}

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

    *, *::before, *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}


/* MOBILE REFINEMENT */
@media (max-width: 700px) {

    .wrap {
        padding: 52px 22px 90px;
    }

    header {
        gap: 26px;
        margin-bottom: 58px;
        padding-bottom: 28px;
    }

    .name {
        font-size: clamp(38px, 10vw, 44px);
    }

    .header-right {
        align-items: center;
    }

    nav {
        gap: 12px 17px;
        font-size: 14px;
    }

    /* More balanced section spacing */
    .section-label {
        font-size: 23px;
        margin-bottom: 25px;
    }

    .section-title {
        font-size: 27px;
        margin-bottom: 18px;
    }

    .section-intro {
        font-size: 14px;
        line-height: 1.7;
        margin-bottom: 30px;
    }

    /* Projects */
    .work {
        gap: 52px;
        margin-bottom: 90px;
    }

    .piece .frame {
        aspect-ratio: 16 / 10;
    }

    .piece .cap {
        margin-top: 14px;
        gap: 10px;
    }

    /* About illustration */
    .about {
        gap: 28px;
        margin-bottom: 90px;
    }

    .about-art {
        position: relative;
        min-height: 290px;
        align-items: center;
    }

    .about-art::before {
        content: "";
        position: absolute;
        width: 240px;
        height: 240px;
        border-radius: 50%;
        background: radial-gradient(
            circle,
            var(--glow-near),
            var(--glow-far) 45%,
            transparent 72%
        );
        filter: blur(12px);
    }

    .duck {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 280px;
        filter:
            drop-shadow(0 0 18px var(--glow-near))
            drop-shadow(0 0 48px var(--glow-far));
    }

    /* Skills */
    #skills,
    #journey {
        margin-bottom: 90px;
    }

    .skills-grid {
        gap: 14px;
    }

    .card {
        padding: 20px;
    }

    /* Journey */
    .t-item {
        gap: 16px;
        padding-bottom: 26px;
    }

    .t-node {
        width: 42px;
        height: 42px;
    }

    .t-item:not(:last-child)::before {
        left: 20px;
        top: 42px;
    }

    /* Contact */
    .footer-grid {
        gap: 32px;
        padding-top: 32px;
    }
}
