:root {
    --pink-bg: #faf0ee;
    --pink-light: #f2c5c8;
    --pink-mid: #d98b9b;
    --pink-text: #222222;
    --green-dark: #4a5e3a;
    --green-mid: #6b7f52;
    --green-card: #5a6e45;
    --dusty-rose: #c98899;
    --dusty-rose-card: #d4909f;
    --warm-gold: #c9a86c;
    --warm-gold-card: #b8945a;
    --text-dark: #222222;
    --text-mid: #222222;
    --text-light: #8a7a74;
    --nav-link: #222222;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }

  body {
    background: linear-gradient(to bottom, #96b8df 0%, #ebdec3 100%);
    font-family: 'DM Sans', sans-serif;
    color: var(--text-dark);
    overflow-x: hidden;
  }

  /* ── NAV ── */
  nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.2rem 3rem;
    background: transparent;
  }

  .nav-links { display: flex; gap: 2.5rem; }
  .nav-links a {
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    letter-spacing: 0.05em;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    border-radius: 25px;
    padding: 0.9rem 1.8rem;
    background: transparent;
  }
  .nav-links a:hover {
    background: #ffffff;
    color: #96b8df;
  }

  /* ── HERO ── */
  #home {
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }
  .hero-title {
    position: relative;
    font-family: 'Playfair Display', serif;
    font-size: 150px;
    font-weight: 700;
    color: #fcfcfc;
    letter-spacing: -0.02em;
    z-index: 0;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    margin: 0;
    margin-top: 2rem;
    margin-bottom: -6rem;
  }
  .desk-scene {
    position: relative;
    z-index: 1;
    width: 750px;
    height: 480px;
    cursor: default;
  }
  .desk-img {
    width: 750px;
    height: 480px;
    object-fit: default;
  }

 

   /* Sparkle stars scattered */
  .sparkle {
    position: absolute;
    width: 14px; height: 14px;
    color: var(--warm-gold);
    animation: twinkle 3s ease-in-out infinite;
  }
  .sparkle svg { width: 100%; height: 100%; fill: var(--warm-gold); }
  @keyframes twinkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
  }

  /* ── ABOUT ── */
  #about {
    padding: 6rem 3rem;
    max-width: 1000px;
    margin: 0 auto;
  }
  .about-heading {
    font-family: 'DM Mono', monospace;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }
  .about-heading.visible { opacity: 1; transform: none; }
  .about-cols {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .about-col p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-mid);
    margin-bottom: 1rem;
  }
  .cta-link {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--pink-text);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    background: none; border: none;
    padding: 0;
    transition: opacity 0.2s;
  }
  .cta-link:hover { opacity: 0.7; }

  /* Expandable skills section */
  .skills-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .skills-expand.open { max-height: 1200px; }
  .skills-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--pink-light);
  }
  .skills-heading {
    font-family: 'DM Mono', monospace;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 2rem;
  }
  .skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  .skill-cat h4 {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pink-text);
    margin-bottom: 0.8rem;
    letter-spacing: 0.05em;
  }
  .skill-cat ul {
    list-style: none;
  }
  .skill-cat li {
    font-size: 0.88rem;
    color: var(--text-mid);
    line-height: 1.7;
    padding-left: 1em;
    position: relative;
  }
  .skill-cat li::before {
    content: '·';
    position: absolute; left: 0;
    color: var(--pink-mid);
  }
  .skills-note {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-light);
    margin-top: 1.5rem;
  }

  /* ── SECTION LABEL ── */
  .section-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .section-label.visible { opacity: 1; transform: none; }

  /* ── SELECTED PROJECTS ── */
  #work {
    padding: 5rem 3rem;
    max-width: 1000px;
    margin: 0 auto;
  }
  .projects-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  .project-card {
    opacity: 1 !important;
    transform: none !important;
    border-radius: 20px;
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(40px);
  }
  .project-card.visible {
    opacity: 1;
    transform: translateY(0);
  }
  .project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  }
  .card-green  { background: var(--green-card); }
  .card-rose   { background: var(--dusty-rose-card); }
  .card-placeholder { background: #e8e4df; }

  .card-content h2 {
    font-family: 'DM Mono', monospace;
    font-size: 1.6rem;
    font-weight: 500;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 1rem;
  }
  .card-placeholder .card-content h2 { color: var(--text-mid); }
  .card-content p {
    font-size: 0.85rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.8);
  }
  .card-placeholder .card-content p { color: var(--text-light); }
  .card-images {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    justify-content: flex-end;
    height: 200px;
    position: relative;
  }
  .card-img-wrap {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
  }
  .card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .img-tall { width: 110px; height: 170px; }
  .img-mid  { width: 120px; height: 145px; }
  .img-phone { width: 80px; height: 160px; }

  .project-card:hover .card-img-wrap { transform: translateY(-20px); }
  .project-card:hover .card-img-wrap:nth-child(2) { transform: translateY(-30px); }
  .project-card:hover .card-img-wrap:nth-child(3) { transform: translateY(-15px); }
  .project-card:hover .tidsalder-img1 { transform: rotate(-8deg) translateY(-50px) !important; }
  .project-card:hover .tidsalder-img2 { transform: rotate(7deg) translateY(-50px) !important; }
  .project-card:hover .skrald-img1 { transform: rotate(-4deg) translateY(-45px) !important; }
  .project-card:hover .skrald-img2 { transform: rotate(4deg) translateY(-45px) !important; }

  /* "More on the way" note */
  .more-note {
    text-align: center;
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 1.5rem;
    font-style: italic;
  }

  /* ── CLOSING QUOTE ── */
  .closing-quote {
    padding: 6rem 3rem;
    text-align: center;
  }
  .closing-quote p {
    font-family: 'DM Mono', monospace;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--text-mid);
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.8s ease;
  }
  .closing-quote p.visible { opacity: 1; }

  /* ── FOOTER ── */
  footer {
    padding: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-top: 1px solid var(--pink-light);
    max-width: 1000px;
    margin: 0 auto;
  }
  .footer-logo {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 2rem;
    color: var(--pink-text);
    cursor: pointer;
  }
  .footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: right;
  }
  .footer-links a {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
  }
  .footer-links a:hover { color: var(--pink-text); }

  /* ── PROJECT PAGE ── */
  #project-page {
    display: none;
    min-height: 100vh;
    background: var(--pink-bg);
  }
  #project-page.active { display: block; }
  .project-hero {
    padding: 8rem 3rem 4rem;
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
  }
  .project-hero h1 {
    font-family: 'DM Mono', monospace;
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--green-dark);
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  .project-hero p {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-mid);
  }
  .project-body {
    padding: 0 3rem 6rem;
    max-width: 1000px;
    margin: 0 auto;
  }
  .project-section {
    margin-bottom: 4rem;
  }
  .project-section h2 {
    font-family: 'DM Mono', monospace;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
  }
  .project-section p, .project-section li {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-mid);
    margin-bottom: 0.8rem;
  }
  .insight-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
  }
  .insight-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem;
    border: 1px solid var(--pink-light);
  }
  .insight-card h4 {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--green-dark);
    margin-bottom: 0.6rem;
    font-weight: 500;
  }
  .insight-card p {
    font-size: 0.78rem;
    color: var(--text-mid);
    line-height: 1.6;
    margin: 0;
  }
  .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: var(--pink-text);
    background: none;
    border: 1px solid var(--pink-light);
    border-radius: 20px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 2rem;
    text-decoration: none;
  }
  .back-btn:hover { background: var(--pink-light); }
  .quote-block {
    background: #fff;
    border-left: 3px solid var(--pink-mid);
    border-radius: 0 12px 12px 0;
    padding: 1.5rem 2rem;
    margin: 1rem 0;
  }
  .quote-block p {
    font-style: italic;
    font-size: 0.88rem;
    color: var(--text-mid);
    margin: 0 0 0.4rem;
  }
  .quote-block span {
    font-size: 0.75rem;
    color: var(--text-light);
    font-family: 'DM Mono', monospace;
  }

  /* ── LIBRARY PAGE ── */
  #library-page {
    display: none;
    min-height: 100vh;
    background: var(--pink-bg);
  }
  #library-page.active { display: block; }
  .library-header {
    padding: 8rem 3rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
  }
  .library-header h1 {
    font-family: 'DM Mono', monospace;
    font-size: 2.8rem;
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 0.5rem;
  }
  .library-header p {
    font-size: 0.9rem;
    color: var(--text-light);
    font-family: 'DM Mono', monospace;
  }
  .bookshelf-wrap {
    padding: 2rem 3rem 6rem;
    max-width: 1000px;
    margin: 0 auto;
  }
  .shelf-section { margin-bottom: 3rem; }
  h2.shelf-label { font-weight: 400; }
  .shelf-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-align: center;
  }
  .shelf {
    background: linear-gradient(to bottom, #c8a97a 0%, #a8844e 20%, #c8a97a 20%, #c8a97a 85%, #8a6535 85%, #7a5525 100%);
    border-radius: 4px;
    padding: 0.8rem 1.5rem 0.4rem;
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    min-height: 120px;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .book-item {
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
  }
  .book-item:hover,
  .book-item:focus-visible { transform: translateY(-12px); }
  .book-item {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
  }
  .book-item:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 3px; }
  .book-spine {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 46px;
    height: 120px;
    padding: 0.5rem 0;
    border-radius: 3px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    color: #fff;
    overflow: hidden;
  }
  .book-spine-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 80px;
  }
  @media (prefers-reduced-motion: reduce) {
    .book-item { transition: none; }
  }
  .book-item img {
    height: 120px;
    width: auto;
    border-radius: 2px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    display: block;
  }
  .shelf-plant img {
    height: 75px;
    width: auto;
    opacity: 0.9;
  }
  /* ── BOOK DETAIL ── */
  #book-page {
    display: none;
    min-height: 100vh;
    background: var(--pink-bg);
    padding: 8rem 3rem 6rem;
  }
  #book-page.active { display: block; }
  .book-detail {
    max-width: 700px;
    margin: 0 auto;
  }
  .book-detail-inner {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 3rem;
    align-items: start;
  }
  .book-detail img {
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  }
  .book-info h1 {
    font-family: 'DM Mono', monospace;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 0.5rem;
  }
  .book-info .author {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
  }
  .book-info p {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-mid);
  }

  /* Transitions */
  .page { transition: opacity 0.3s ease; }

  /* Scroll animations */
  .fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }
  .fade-up.visible { opacity: 1; transform: none; }


  .sparkle-img {
    position: absolute;
    pointer-events: none;
    animation: twinkle 3s ease-in-out infinite;
  }
  .desk-layer { position: absolute; pointer-events: none; }
  .nav-logo-img, .footer-logo-img { cursor: pointer; }

  @media (max-width: 768px) {
    nav { padding: 1rem 1.5rem; }
    .about-cols, .skills-grid, .project-hero, .book-detail-inner { grid-template-columns: 1fr; }
    .insight-grid { grid-template-columns: 1fr 1fr; }
    .desk-scene { width: 320px; height: 260px; }
    .hero-title { font-size: 4.5rem; }
    #about, #work, #side-projects { padding: 4rem 1.5rem; }
  }

  /* ── PROJECT PAGE LAYOUT ── */
  .proj-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    max-width: 1100px;
    margin: 0 auto;
    padding: 7rem 2rem 6rem;
    align-items: start;
  }
  .proj-sidebar {
    position: sticky;
    top: 7rem;
    padding-right: 2rem;
  }
  .proj-sidebar .back-btn {
    margin-bottom: 2rem;
    display: inline-flex;
  }
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .sidebar-link {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-light);
    text-decoration: none;
    padding: 0.6rem 0 0.6rem 1rem;
    border-left: 2px solid var(--pink-light);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    background: none;
    border-top: none; border-right: none; border-bottom: none;
    text-align: left;
    line-height: 1.4;
  }
  .sidebar-link:hover { color: var(--pink-text); border-left-color: var(--pink-mid); }
  .sidebar-link.active { color: var(--green-dark); border-left-color: var(--green-dark); font-weight: 500; }

  .proj-content { min-width: 0; }

  /* Hero image */
  .proj-hero-img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 3rem;
    display: block;
  }
  .proj-hero-placeholder {
    width: 100%;
    height: 420px;
    background: linear-gradient(135deg, #76844E 0%, #4a5e3a 100%);
    border-radius: 16px;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .proj-hero-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    margin: 1.5rem 0 3rem;
  }

  .proj-section-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    margin-top: 1.5rem;
  }

  .proj-atelier-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 0.8rem;
  }

  /* Project title */
  .proj-title {
    font-family: 'DM Mono', monospace;
    font-size: 2.4rem;
    font-weight: 400;
    color: var(--green-dark);
    line-height: 1.2;
    margin-bottom: 0.5rem;
  }
  .proj-tagline {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: var(--warm-gold);
    font-size: 1rem;
    margin-bottom: 3rem;
    display: block;
  }

  /* Content sections */
  .proj-section {
    margin-bottom: 4rem;
    scroll-margin-top: 7rem;
  }
  .proj-section h2 {
    font-family: 'DM Mono', monospace;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--pink-light);
  }
  .proj-section p {
    font-size: 0.92rem;
    line-height: 1.85;
    color: var(--text-mid);
    margin-bottom: 1rem;
  }
  /* Section image */
  .proj-section-img {
    width: 100%;
    border-radius: 12px;
    margin: 1.5rem 0;
    display: block;
    object-fit: cover;
  }
  .proj-img-placeholder {
    width: 100%;
    height: 280px;
    background: #ede8e4;
    border-radius: 12px;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-light);
    letter-spacing: 0.1em;
    border: 2px dashed var(--pink-light);
  }

  /* Insight cards */
  .proj-insights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
  }
  .proj-insight-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem;
    border: 1px solid var(--pink-light);
  }
  .proj-insight-card h4 {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: var(--green-dark);
    margin-bottom: 0.5rem;
    font-weight: 500;
  }
  .proj-insight-card p {
    font-size: 0.8rem;
    color: var(--text-mid);
    line-height: 1.6;
    margin: 0;
  }
  /* Quote */
  .proj-quote {
    background: #fff;
    border-left: 3px solid var(--pink-mid);
    border-radius: 0 10px 10px 0;
    padding: 1.2rem 1.5rem;
    margin: 1rem 0;
  }
  .proj-quote p { font-style: italic; margin: 0 0 0.3rem; }
  .proj-quote span { font-family: 'DM Mono', monospace; font-size: 0.72rem; color: var(--text-light); }
  /* ── VALUES ── */
  .values-section {
    padding: 6rem 1rem 9rem;
    max-width: 1200px;
    margin: 0 auto;
  }
  .values-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
  .values-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #222222;
    margin-bottom: 1rem;
  }
  .values-section p {
    font-size: 0.95rem;
    line-height: 1.85;
    color: #222222;
  }
  @media (max-width: 768px) {
    .values-grid { grid-template-columns: 1fr; }
  }

  /* ── BACKGROUND STARS ── */
  #values, #work, #side-projects, #applications, #about { position: relative; }
  /* sections have no stacking context, so -1 paints the stars behind all section content */
  .bg-star { z-index: -1; }
  @media (prefers-reduced-motion: reduce) {
    .sparkle-img { animation: none; }
  }
