/* ==============================================================================
   MBP VFX Portfolio: home page design layer
   Design layer of the home page only: about as a bento grid, calmer project
   cards, the overview of used software and time split, the student work
   accordion, the project popup sheet, the selected work card stack and the
   contact call to action. Few accents: the accent colour (--brand-primary)
   appears only in small details. Fonts are Inter and JetBrains Mono.

   Loaded by: index.html only, after styles.css and redesign.css.
   home-redesign.js builds the markup these rules style. Removing its link
   element switches the layer off.
   Depends on: the shared variables (--rd-line, --rd-r, --rd-glass, --rd-dim,
   --rd-ease, --rd-mono, --rd-sans, --rd-t-*) defined in redesign.css.

   This is an override layer: rule order matters and must not be changed
   without checking the cascade.

   TABLE OF CONTENTS
   --------------------------------------------------------------------------
   1.  SHARED HELPERS AND BENTO CARD
   2.  ABOUT BENTO
   3.  PROJECT CARDS
   4.  WHAT I USE, AND HOW MUCH
   5.  CONTACT CALL TO ACTION
   6.  STUDENT WORK
   7.  UNIFIED TYPOGRAPHY
   8.  PROJECT POPUP
   9.  SELECTED WORK CARD STACK
   10.  RESPONSIVE RULES
   11.  ACCENTS AND CORNERS
   ============================================================================== */

/* ==============================================================================
   1. SHARED HELPERS AND BENTO CARD
   Mono font helper, page width wrapper and the bento card cell that the home
   page sections share.
   ============================================================================== */

.rd-mono { font-family: var(--rd-mono); }
.rd-wrap { position: relative; max-width: 1320px; margin: 0 auto; }

/* Card (bento cell) */
/* The entrance class .scroll-animate keeps every element permanently in its own
   graphics layer (will-change, translateZ(0), perspective, backface-visibility). For
   the large cells (rounding, overflow: hidden and children) this cost about four times
   more frame time while scrolling in the measurement (median 16 to 21 ms instead of 4
   ms) in About, Projects and Software. Here the layers exist only during the entrance;
   afterwards the cell is a normal element. */
.rd-cell {
    will-change: auto !important;
    perspective: none !important;
    -webkit-perspective: none !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
}
.rd-cell.scroll-animate.animate-in { transform: none !important; }
.rd-cell {
    position: relative;
    border-radius: var(--rd-r-lg, 26px);
    border: 1px solid var(--rd-line);
    background: var(--rd-glass);
    box-shadow: inset 0 1px 0 var(--white-alpha-06);
    overflow: hidden;
    padding: clamp(20px, 2.2vw, 34px);
    min-width: 0;
}

.rd-lbl {
    font-family: var(--rd-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rd-dim);
}

/* ==============================================================================
   2. ABOUT BENTO
   About section as a bento grid: narrower portrait and three equally wide
   cells below it.
   ============================================================================== */
.story-section--v2 .story-container { max-width: 1320px; }

.rd-bento {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(12px, 1.4vw, 20px);
    align-items: stretch;
}
.rd-portrait { grid-column: 1 / 5;  grid-row: 1; padding: 0; margin: 0; min-height: 0; }
.rd-text     { grid-column: 5 / 13; grid-row: 1; }
.rd-stat     { grid-column: 1 / 5;  grid-row: 2; }
.rd-award    { grid-column: 5 / 9;  grid-row: 2; }
.rd-school   { grid-column: 9 / 13; grid-row: 2; }

/* Portrait */
.rd-portrait-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 24%;
    filter: grayscale(0.45) contrast(1.05) brightness(0.96);
    transform: scale(1.04);
    transition: transform 1.3s var(--rd-ease), filter 0.9s var(--rd-ease);
}
.rd-portrait:hover .rd-portrait-img { transform: scale(1.08); filter: grayscale(0) contrast(1.08) brightness(1); }
.rd-portrait::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to top, var(--surface-0-alpha-88) 0%, var(--surface-0-alpha-26) 34%, transparent 58%);
}
.rd-portrait-cap { position: absolute; left: clamp(18px, 2vw, 28px); bottom: clamp(16px, 2vw, 26px); z-index: 3; display: grid; gap: 7px; }
.rd-portrait-cap b { font-family: var(--rd-sans); font-size: clamp(19px, 1.7vw, 27px); font-weight: 650; letter-spacing: -0.03em; color: var(--text-primary); }
.rd-portrait-cap span { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--white-alpha-60); }

/* Text (stays .story-content-v2, so heading and paragraph animation and translation
   keep working) */
.story-section--v2 .rd-text.story-content-v2 {
    max-width: none;
    padding: clamp(24px, 3vw, 46px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.story-section--v2 .rd-text .story-heading { font-size: clamp(44px, 5.2vw, 80px); margin-bottom: 20px; }
.story-section--v2 .rd-text .story-paragraphs { margin-bottom: 30px; max-width: 64ch; }
.story-section--v2 .rd-text .story-paragraphs p { margin-bottom: 14px; }

/* The three small cells */
.rd-stat, .rd-award, .rd-school { padding: clamp(16px, 1.55vw, 24px); }

/* Number of projects */
.rd-stat { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.rd-num {
    display: block;
    font-family: var(--rd-sans);
    font-size: clamp(48px, 5vw, 76px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.055em;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.rd-stat-t { font-family: var(--rd-sans); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.rd-stat i { font-style: normal; font-family: var(--rd-mono); font-size: 9.5px; letter-spacing: 0.1em; white-space: nowrap; color: var(--rd-dim); }

/* Award */
.rd-award { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; color: inherit; text-decoration: none; }
.rd-award img { width: clamp(58px, 5.6vw, 84px); height: auto; transition: transform 1s var(--rd-ease); }
.rd-award:hover img { transform: rotate(-8deg) scale(1.08); }
.rd-award p { margin: 0; font-family: var(--rd-sans); font-size: var(--rd-t-small); line-height: 1.35; letter-spacing: -0.005em; }
.rd-award p strong { display: block; font-weight: 600; color: var(--text-primary); }
.rd-award p span { color: var(--rd-dim); }

/* School (the logo is a transparent WebP, see Images/About_Me_Page/PIXLVISN-logo.webp) */
.rd-school { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.rd-school img { width: min(100%, 210px); height: auto; margin-block: 4px; }
.rd-school p { margin: 0; font-family: var(--rd-sans); font-size: var(--rd-t-small); line-height: 1.4; color: var(--rd-dim); }

/* Wide screens: the three small cells are wide and flat, so the content sits side by side */
@media (min-width: 1081px) {
    .rd-stat { display: grid; grid-template-columns: auto 1fr; column-gap: 22px; align-items: center; }
    .rd-stat .rd-num { grid-row: 1 / 3; }
    .rd-stat .rd-stat-t { align-self: end; }
    .rd-stat i { align-self: start; }
    .rd-award, .rd-school { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; column-gap: 20px; row-gap: 10px; }
    .rd-award .rd-lbl, .rd-school .rd-lbl { grid-column: 1 / -1; }
    .rd-award img { grid-row: 2; align-self: center; width: clamp(56px, 4.6vw, 72px); }
    .rd-award p, .rd-school p { grid-row: 2; align-self: center; }
    .rd-school img { grid-row: 2; align-self: center; margin: 0; width: clamp(118px, 10.5vw, 160px); }
}

/* ==============================================================================
   3. PROJECT CARDS
   Modern but calm look of the project cards. Structure, tilt, glow, like
   button and popup stay as defined in styles.css.
   ============================================================================== */
.projects-section .projects-grid { gap: clamp(22px, 2.6vw, 38px); }

.projects-section .project-card-wrapper .project-card {
    border-radius: 24px !important;
    border: 1px solid var(--white-alpha-09) !important;
    padding: 9px !important;
    background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-0-alt) 100%) !important;
    box-shadow: inset 0 1px 0 var(--white-alpha-07) !important;
}
.projects-section .project-card .project-image-container {
    border-radius: 17px !important;
    overflow: hidden;
}
.projects-section .project-card .project-card-image { border-radius: 17px !important; }
/* No image pop: no zoom on hover and no blur or scale effect while loading
   (.lazy-load:not(.loaded) from styles.css); the image simply appears without movement */
.projects-section .project-card .project-card-image,
.projects-section .project-card .project-card-image.lazy-load:not(.loaded),
.projects-section .project-card:hover .project-card-image { filter: none !important; transform: none !important; transition: opacity 0.4s ease !important; }

.projects-section .project-card .project-info { padding: 18px 12px 6px !important; }
.projects-section .project-card .project-role {
    font-family: var(--rd-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    margin-bottom: 9px;
}
.projects-section .project-card .project-name {
    font-size: clamp(19px, 1.7vw, 25px);
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1.14;
    margin-bottom: 11px;
}
.projects-section .project-card .project-description {
    font-size: 12.5px;
    line-height: 1.6;
    opacity: 1;
    color: var(--white-alpha-60);
    margin-bottom: 16px;
}

/* Footer: only the like button, centred */
.projects-section .project-card .project-like-section {
    justify-content: center !important;
    align-items: center;
    padding-top: 14px !important;
    border-top: 1px solid var(--white-alpha-08) !important;
}

/* ==============================================================================
   4. WHAT I USE, AND HOW MUCH
   Plain overview of the software in use and the time split.
   ============================================================================== */
.rd-tools { position: relative; padding: clamp(80px, 12vw, 150px) clamp(20px, 5vw, 70px); }
.rd-h2 {
    font-family: var(--rd-sans);
    font-size: clamp(36px, 5.4vw, 88px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.045em;
    max-width: 16ch;
    text-wrap: balance;
    margin: 0 0 clamp(14px, 2vw, 24px);
    color: var(--text-primary);
}
.rd-h2 em, .rd-cta-t em { font-style: normal; color: var(--white-alpha-40); }
.rd-lead { max-width: 56ch; margin: 0 0 clamp(32px, 5vw, 64px); font-family: var(--rd-sans); font-size: var(--rd-t-body); line-height: 1.7; color: var(--white-alpha-70); }

.rd-tools-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 20px); align-items: stretch; }
.rd-t-list { grid-column: 1 / 8; display: flex; flex-direction: column; }
.rd-t-disc { grid-column: 8 / 13; }
.rd-panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 24px; }
/* Note under the title of the time split: the ring is a preview of a typical project */
.rd-t-disc .rd-panel-h { margin-bottom: 12px; }
.rd-panel-note { margin: 0 0 28px; max-width: 46ch; font-family: var(--rd-sans); font-size: 13.5px; line-height: 1.6; color: var(--rd-dim); }

/* Software: only an overview of what is used, without bars or weighting. Names as calm
   tiles, alphabetical, three columns (two on phones). Every tile links to the vendor
   page; on hover the accent colour and a small arrow appear. */
.rd-tlist {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
}
.rd-trow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 58px;
    padding: 10px 16px;
    border-radius: var(--rd-rb);
    border: 1px solid var(--rd-line);
    background: var(--white-alpha-04);
    font-family: var(--rd-sans);
    font-size: 14.5px;
    font-weight: 550;
    line-height: 1.25;
    letter-spacing: -0.005em;
    color: var(--text-primary);
    text-decoration: none;
    overflow-wrap: anywhere;
    /* Entrance: only when the area becomes visible (.rd-in), the tiles one after another */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.7s var(--rd-ease), transform 0.7s var(--rd-ease), background-color 0.35s, border-color 0.35s, color 0.35s;
    transition-delay: calc(var(--k, 0) * 45ms), calc(var(--k, 0) * 45ms), 0s, 0s, 0s;
}
.rd-t-list.rd-in .rd-trow { opacity: 1; transform: none; }
.rd-trow::after {
    content: '\2197';          /* Arrow to the upper right (link to the vendor page) */
    flex: none;
    font-size: 13px;
    color: var(--rd-acc);
    opacity: 0;
    transform: translate(-4px, 4px);
    transition: opacity 0.35s, transform 0.5s var(--rd-ease);
}
.rd-trow:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: 2px; background: var(--rd-acc-soft); border-color: var(--rd-acc-line); color: var(--rd-acc); }
@media (hover: hover) {
    .rd-trow:hover { background: var(--rd-acc-soft); border-color: var(--rd-acc-line); color: var(--rd-acc); }
    .rd-trow:hover::after { opacity: 1; transform: none; }
}

/* Time split: the ring is sorted by percentage, colours run from light to dark
   (largest share in the accent colour) */
.rd-disc-body { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: clamp(20px, 2.4vw, 34px); align-items: center; }
.rd-donut-wrap { position: relative; width: 100%; aspect-ratio: 1; }
.rd-donut { width: 100%; height: 100%; transform: rotate(-90deg); }
.rd-donut .trk { fill: none; stroke: var(--white-alpha-05); stroke-width: 11; }
.rd-donut .seg {
    fill: none;
    stroke-width: 11;
    stroke-dasharray: 0 400;
    stroke-dashoffset: var(--off);
    transition: stroke-dasharray 1.5s var(--rd-ease), opacity 0.35s ease;
    transition-delay: calc(var(--k, 0) * 0.12s), 0s;
}
.rd-t-disc.rd-in .rd-donut .seg { stroke-dasharray: var(--len) 400; }
.rd-donut .seg.is-dim { opacity: 0.25; }
.rd-donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }   /* Only the percentage stands in the ring */
.rd-donut-c b { font-family: var(--rd-sans); font-size: clamp(26px, 2.6vw, 38px); font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.rd-dleg { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-family: var(--rd-sans); font-size: 13.5px; }
.rd-dleg li { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; color: var(--rd-dim); cursor: default; transition: background 0.3s, opacity 0.3s, color 0.3s; }
.rd-dleg li b { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.rd-dleg li i { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.rd-dleg li.is-on { background: var(--white-alpha-06); color: var(--text-primary); }
.rd-dleg li.is-dim { opacity: 0.5; }

/* ==============================================================================
   5. CONTACT CALL TO ACTION
   Wide, flat call to action without ASCII art.
   ============================================================================== */
.rd-cta { padding: 0 clamp(20px, 5vw, 70px) clamp(60px, 8vw, 110px); }
.rd-cta-wrap { position: relative; max-width: 1320px; margin: 0 auto; }
.rd-cta-card {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(26px, 4vw, 72px);
    padding: clamp(28px, 3.8vw, 58px) clamp(24px, 4.6vw, 80px);
    border-radius: clamp(26px, 3vw, 42px);
}
.rd-kicker { margin: 0 0 16px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--rd-dim); }
.rd-cta-t {
    font-family: var(--rd-sans);
    font-size: clamp(32px, 4.3vw, 68px);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.05em;
    margin: 0 0 16px;
    color: var(--text-primary);
    text-wrap: balance;
}
.rd-cta-sub { margin: 0; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.7; color: var(--rd-dim); }
.rd-cta-side { display: grid; gap: 22px; justify-items: start; }
.rd-btn {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 9px 9px 9px 28px;
    border-radius: 99px;
    background: var(--text-primary);
    color: var(--surface-0-alt);
    font-family: var(--rd-sans);
    font-size: clamp(15px, 1.4vw, 18px);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.7s var(--rd-ease), background 0.4s;
}
.rd-btn:hover { transform: scale(1.03); background: var(--near-white); }
.rd-btn i { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-0-alt); color: var(--text-primary); font-style: normal; transition: transform 0.7s var(--rd-ease); }
.rd-btn:hover i { transform: rotate(45deg); }
.rd-soc { display: flex; flex-wrap: wrap; gap: 10px; }
.rd-soc a {
    padding: 11px 18px;
    border-radius: 99px;
    font-family: var(--rd-sans);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    background: var(--white-alpha-06);
    border: 1px solid var(--rd-line);
    transition: background 0.5s var(--rd-ease), transform 0.6s var(--rd-ease), border-color 0.5s;
}
.rd-soc a:hover { background: var(--white-alpha-15); border-color: var(--white-alpha-30); transform: translateY(-3px); }

/* ==============================================================================
   6. STUDENT WORK
   Centred term accordion: heading, demo reel and the term rows stand in the
   middle of a narrow column. One row per term with the number of films; a
   tap opens the term and shows its tiles while everything else stays closed
   (on phones this needs almost no space). A click or tap on a tile opens the
   video window (below). Data: the videos array of the site script. Markup:
   buildStudent in home-redesign.js.
   ============================================================================== */
.rd-student { position: relative; padding: clamp(70px, 10vw, 130px) clamp(20px, 5vw, 70px) clamp(30px, 5vw, 70px); }
.rd-st-head { text-align: center; margin-bottom: clamp(22px, 3vw, 38px); }
.rd-st-head .rd-kicker { margin-bottom: 14px; }
.rd-st-head .rd-h2 { margin: 0 auto; max-width: none; }

.rd-sw { width: min(840px, 100%); margin: 0 auto; display: grid; gap: clamp(14px, 2vw, 24px); }
.rd-sw-reel {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    aspect-ratio: 16 / 9;
    border-radius: var(--rd-r);
    overflow: hidden;
    background: var(--rd-surf);
    border: 1px solid var(--rd-line);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
}
.rd-sw-reel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.3s var(--rd-ease); }
.rd-sw-reel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(var(--surface-0-alpha-00) 42%, var(--surface-0-alpha-87)); pointer-events: none; }
.rd-sw-play {
    position: absolute; z-index: 3; right: clamp(14px, 1.8vw, 24px); top: clamp(14px, 1.8vw, 24px);
    width: 56px; height: 56px;
    border-radius: 12px; background: var(--rd-acc);
    transition: transform 0.6s var(--rd-ease), background 0.4s;
}
.rd-sw-play::before { content: ''; position: absolute; left: 22px; top: 17px; border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent var(--rd-on-acc); }
.rd-sw-reel:hover .rd-sw-play { transform: scale(1.08); background: var(--rd-acc-2); }
.rd-sw-reel:hover img { transform: scale(1.035); }
.rd-sw-reelcap { position: absolute; z-index: 3; left: clamp(16px, 2vw, 28px); right: clamp(16px, 2vw, 28px); bottom: clamp(14px, 1.8vw, 24px); display: grid; gap: 7px; }
.rd-sw-reelcap .rd-lbl { color: var(--rd-acc); }
.rd-sw-reelcap b { font-family: var(--rd-sans); font-size: clamp(18px, 2vw, 28px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; color: var(--text-primary); }

/* Accordion: one row per term, content centred, plus field on the right */
.rd-acc { border-top: 1px solid var(--rd-line); }
.rd-acc-row { border-bottom: 1px solid var(--rd-line); }
.rd-acc-btn {
    width: 100%;
    margin: 0;
    background: none;
    border: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 20px 2px;
    text-align: center;
    color: var(--text-primary);
    font-family: var(--rd-sans);
    cursor: pointer;
    transition: color 0.35s;
}
.rd-acc-c { grid-column: 2; display: grid; gap: 7px; justify-items: center; }
.rd-acc-c b { font-size: clamp(22px, 2.6vw, 34px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.rd-acc-n { font-family: var(--rd-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rd-dim); }
.rd-acc-btn i {
    grid-column: 3;
    justify-self: end;
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border-radius: var(--rd-rb);
    border: 1px solid var(--rd-line);
    font-style: normal; font-size: 19px; line-height: 1;
    transition: background-color 0.4s, border-color 0.4s, color 0.4s;
}
.rd-acc-btn:focus-visible { color: var(--rd-acc); }
@media (hover: hover) {
    .rd-acc-btn:hover { color: var(--rd-acc); }
    .rd-acc-btn:hover i { border-color: var(--rd-acc-line); background: var(--rd-acc-soft); }
}
.rd-acc-btn:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: -2px; border-radius: var(--rd-rb); }
.rd-acc-btn i span { display: block; transition: transform 0.6s var(--rd-ease); }
.rd-acc-row.open .rd-acc-btn i { background: var(--rd-acc); border-color: var(--rd-acc); color: var(--rd-on-acc); }
.rd-acc-row.open .rd-acc-btn i span { transform: rotate(45deg); }   /* Only the plus turns into an X, the field stays a rectangle */
/* Opening without a fixed height: row height 0fr to 1fr; while closed the content is
   invisible and cannot be reached by tab */
.rd-acc-body { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 0.7s var(--rd-ease), visibility 0s 0.7s; }
.rd-acc-row.open .rd-acc-body { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows 0.7s var(--rd-ease), visibility 0s; }
.rd-acc-body > div { overflow: hidden; min-height: 0; }
/* Tiles centred, also the last (incomplete) row */
.rd-acc-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 4px 0 22px; }
.rd-sw-t {
    position: relative;
    display: block;
    flex: 0 0 calc((100% - 3 * 8px) / 4);
    min-width: 0;
    padding: 0;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    overflow: hidden;
    background: var(--rd-surf);
    border: 1px solid var(--rd-line);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: border-color 0.4s;
}
.rd-sw-t img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--rd-ease); }
.rd-sw-t::after { content: ''; position: absolute; inset: 0; background: linear-gradient(var(--surface-0-alpha-00) 38%, var(--surface-0-alpha-87)); pointer-events: none; }
.rd-sw-cap { position: absolute; z-index: 2; left: 10px; right: 10px; bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--rd-sans); font-size: 12px; line-height: 1.2; text-shadow: 0 1px 8px var(--black-alpha-80); }
.rd-sw-cap b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rd-sw-cap i { flex: none; font-style: normal; font-family: var(--rd-mono); font-size: 10px; letter-spacing: 0.05em; color: var(--white-alpha-70); }
@media (hover: hover) {
    .rd-sw-t:hover { border-color: var(--rd-acc-line); }
    .rd-sw-t:hover img { transform: scale(1.06); }
}
.rd-sw-t:focus-visible, .rd-sw-reel:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: 2px; }

/* Scroll animation: the demo reel grows from 90 % to 100 % while scrolling up and
   becomes opaque, the image inside zooms out slightly (parallax). home-redesign.js
   (initStudentScroll) sets the values directly coupled to the scroll position:
   transform and opacity on the reel, --zi on the image. The parallax zoom uses the
   standalone scale property so the hover zoom (transform with a transition) stays
   independent. The term rows glide in one by one as they come into view while
   scrolling (class .rd-row-in). Without the script everything stays visible. */
.rd-sw-reel { transform-origin: 50% 100%; }
.rd-sw-reel img { scale: var(--zi, 1); }
.rd-sw.rd-live .rd-sw-reel { will-change: transform, opacity; }
.rd-sw.rd-js .rd-acc-row { transition: opacity 0.85s var(--rd-ease), transform 0.95s var(--rd-ease); }
.rd-sw.rd-js .rd-acc-row:not(.rd-row-in) { opacity: 0; transform: translate3d(0, 36px, 0); }

@media (max-width: 900px) {
    .rd-sw-t { flex-basis: calc((100% - 2 * 8px) / 3); }
}
@media (max-width: 560px) {
    .rd-sw-t { flex-basis: calc((100% - 8px) / 2); }
    .rd-sw-play { width: 48px; height: 48px; }
    .rd-sw-play::before { left: 19px; top: 14px; border-width: 10px 0 10px 15px; }
    .rd-sw-cap { font-size: 12.5px; }
    .rd-acc-btn { padding: 16px 0; gap: 10px; }
    .rd-acc-btn i { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    .rd-acc-body, .rd-acc-row.open .rd-acc-body { transition: none; }
}

/* Video window */
.rd-lb {
    position: fixed; inset: 0; z-index: 10020;
    display: grid; place-items: center;
    padding: max(clamp(14px, 3vw, 40px), env(safe-area-inset-top, 0px)) max(clamp(14px, 3vw, 40px), env(safe-area-inset-right, 0px)) max(clamp(14px, 3vw, 40px), env(safe-area-inset-bottom, 0px)) max(clamp(14px, 3vw, 40px), env(safe-area-inset-left, 0px));
    background: var(--black-alpha-90);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.45s var(--rd-ease), visibility 0s 0.45s;
}
.rd-lb.open { opacity: 1; visibility: visible; transition: opacity 0.45s var(--rd-ease); }
.rd-lb-in { width: min(1100px, 100%); transform: translateY(24px) scale(0.97); transition: transform 0.7s var(--rd-ease); }
.rd-lb.open .rd-lb-in { transform: none; }
.rd-lb video { display: block; width: 100%; max-height: 68vh; border-radius: 18px; background: var(--brand-black); border: 1px solid var(--rd-line); }
.rd-lb-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-top: 18px; }
.rd-lb-text { flex: 1 1 360px; min-width: 0; }
.rd-lb-text .rd-lbl { display: block; margin-bottom: 8px; }
.rd-lb-text b { display: block; font-family: var(--rd-sans); font-size: clamp(22px, 2.4vw, 34px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.08; color: var(--text-primary); }
.rd-lb-text p { margin: 10px 0 0; max-width: 70ch; font-family: var(--rd-sans); font-size: var(--rd-t-small); line-height: 1.65; color: var(--white-alpha-65); max-height: 7.6em; overflow-y: auto; }
.rd-lb-nav { display: flex; gap: 8px; }
.rd-lb-nav button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--rd-line); background: var(--white-alpha-05); color: var(--text-primary); font-size: 18px; cursor: pointer; transition: background 0.35s, border-color 0.35s; }
.rd-lb-nav button:hover { background: var(--white-alpha-15); border-color: var(--white-alpha-40); }
.rd-lb-x { position: absolute; top: max(clamp(12px, 2.4vw, 28px), env(safe-area-inset-top, 0px)); right: max(clamp(12px, 2.4vw, 28px), env(safe-area-inset-right, 0px)); width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--rd-line); background: var(--white-alpha-06); color: var(--text-primary); font-size: 18px; cursor: pointer; transition: background 0.35s, border-color 0.35s; }
.rd-lb-x:hover { background: var(--white-alpha-15); border-color: var(--white-alpha-40); }

/* ==============================================================================
   7. UNIFIED TYPOGRAPHY
   Headings in Inter Bold at one size, body text in Inter in one grey at one
   size, small text in Inter 13.5 px. Mono only for small capital labels
   (role, kicker, term and duration). Applies to the home page only.
   ============================================================================== */
.story-section--v2 .story-heading,
.projects-section .projects-title,
.rd-h2 {
    font-family: var(--rd-sans) !important;
    font-size: clamp(40px, 5.4vw, 84px) !important;
    font-weight: 700 !important;
    letter-spacing: -0.045em !important;
    line-height: 1.02 !important;
}
.projects-section .projects-title { margin-bottom: clamp(16px, 2vw, 26px) !important; }
.story-section--v2 .rd-text .story-heading { margin-bottom: 20px; }

.story-section--v2 .story-paragraphs p,
.projects-section .projects-description {
    font-family: var(--rd-sans) !important;
    font-size: var(--rd-t-body) !important;
    line-height: 1.7 !important;
    color: var(--white-alpha-70) !important;
}
/* Fully opaque once the entrance has run. Before it the text is hidden (styles.css), so it fades in instead of just sliding. */
.story-section--v2 .story-content-v2.animate-in .story-paragraphs p,
.projects-section .projects-description.animate-in { opacity: 1 !important; }
.projects-section .projects-description { max-width: 64ch !important; margin-bottom: clamp(40px, 6vw, 80px) !important; }
.story-section--v2 .story-subhead {
    font-family: var(--rd-mono) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    letter-spacing: 0.16em !important;
    color: var(--rd-dim) !important;
}
/* "Get to know me" label: fades in and slides up together with the paragraphs (the text cell itself only acts as the trigger, see styles.css). */
.story-section--v2 .story-subhead { transition: opacity 0.5s ease, translate 0.6s var(--rd-ease); }
.story-section--v2 .story-content-v2:not(.animate-in) .story-subhead { opacity: 0; translate: 0 12px; }
/* "Read more" button: appears after the paragraphs. The generic button rule in styles.css sets its whole transition list with !important,
   which would drop this delay and the slide, so the entrance has to be restated here (the hover transitions keep their own timing). */
.story-section--v2 .story-content-v2.animate-in a.read-more-btn {
    transition: opacity 0.5s ease 0.4s, translate 0.6s var(--rd-ease) 0.4s, background-color 0.18s ease-out, color 0.18s ease-out, border-color 0.18s ease-out, transform 0.18s ease-out !important;
}
.story-section--v2 .read-more-btn { font-family: var(--rd-sans) !important; font-size: 14.5px !important; letter-spacing: 0 !important; }
.projects-section .project-card .project-description {
    font-family: var(--rd-sans) !important;
    font-size: var(--rd-t-small) !important;
    line-height: 1.6 !important;
    color: var(--white-alpha-60) !important;
}

/* ==============================================================================
   8. PROJECT POPUP
   Calm popup: Inter instead of mono in the text, key facts as a list, little
   accent colour, no glow. Structure and script of the popup stay; the sheet
   layout comes through the class .rd-sheet (home-redesign.js).
   ============================================================================== */
/* Base (also without .rd-sheet): flush at the bottom, rounded only at the top, no
   shadow or glow */
#projectModal .project-modal-container { border-radius: 20px 20px 0 0 !important; background: var(--surface-0-alt) !important; border: 1px solid var(--rd-line) !important; border-bottom: 0 !important; box-shadow: none !important; }
#projectModal.active .project-modal-container { box-shadow: none !important; }
/* No glow on images, buttons and heart (the script sets it through an inline style on
   hover or play) */
#projectModal .gallery-item, #projectModal .gallery-item:hover { box-shadow: none !important; border-color: var(--rd-line) !important; transform: none !important; }
#projectModal .modal-action-btn { box-shadow: none !important; border-color: var(--white-alpha-15) !important; background: var(--rd-veil-2) !important; border-radius: 8px !important; }
#projectModal .modal-action-btn:hover { border-color: var(--rd-acc-line) !important; }
#projectModal .modal-action-btn svg { color: var(--text-primary) !important; }
/* No download or enlarge buttons on the main image at the very top, only on the images
   below (videos never have them) */
#projectModal #projectModalGallery .gallery-item:first-child .modal-image-actions { display: none !important; }
#projectModal .gallery-play-button { background: var(--rd-acc) !important; color: var(--rd-on-acc) !important; box-shadow: none !important; border-radius: 14px !important; }
#projectModal .heart-outline, #projectModal .heart-svg path, #projectModal .project-modal-like-btn svg { filter: none !important; }
#projectModal .project-modal-header { background: transparent !important; border-bottom: 1px solid var(--white-alpha-07) !important; }
#projectModal .project-modal-title { font-family: var(--rd-sans) !important; font-size: clamp(24px, 2.6vw, 38px) !important; font-weight: 700 !important; letter-spacing: -0.035em !important; line-height: 1.05 !important; }
#projectModal .project-modal-close { border-radius: var(--rd-rb) !important; }
#projectModal .project-modal-close:hover { background: var(--white-alpha-15) !important; border-color: var(--rd-acc-line) !important; color: var(--rd-acc) !important; transform: none !important; }
#projectModal .project-modal-category {
    font-family: var(--rd-mono) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    letter-spacing: 0.16em !important;
    color: var(--rd-acc) !important;
}
#projectModal .project-modal-description {
    font-family: var(--rd-sans) !important;
    font-size: var(--rd-t-body) !important;
    line-height: 1.75 !important;
    color: var(--rd-text) !important;
    white-space: pre-line;               /* Makes paragraphs (blank lines) of the descriptions in the site script visible */
}
#projectModal #projectModalLinkContainer { text-align: left !important; }
#projectModal .project-modal-link {
    background: var(--rd-acc) !important;
    color: var(--rd-on-acc) !important;
    border-radius: var(--rd-rb) !important;
    padding: 12px 20px !important;
    font-family: var(--rd-sans) !important;
    font-weight: 650 !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}
#projectModal .project-modal-link:hover { background: var(--rd-acc-2) !important; }
#projectModal .project-modal-details { background: transparent !important; border: 0 !important; border-top: 1px solid var(--rd-line) !important; border-radius: 0 !important; padding: 0 !important; gap: 0 !important; }
#projectModal .project-detail-item {
    display: grid !important;
    grid-template-columns: 7.4em minmax(0, 1fr);
    gap: 14px;
    align-items: baseline;
    padding: 14px 0 !important;
    border-bottom: 1px solid var(--rd-line) !important;
}
#projectModal .project-detail-label { font-family: var(--rd-mono) !important; font-size: 10.5px !important; font-weight: 500 !important; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rd-dim) !important; }
#projectModal .project-detail-value { font-family: var(--rd-sans) !important; font-size: 14px !important; font-weight: 500 !important; text-align: left !important; }
#projectModal .project-tag { background: var(--white-alpha-04) !important; color: var(--white-alpha-90) !important; border: 1px solid var(--white-alpha-15) !important; border-radius: var(--rd-rs) !important; font-family: var(--rd-mono) !important; font-size: 11px !important; }
/* Language button and like: plain slightly rounded rectangles of equal height */
#projectModal .project-modal-language-section,
#projectModal .project-modal-like-section { display: flex !important; justify-content: flex-start !important; align-items: center; background: transparent !important; border: 0 !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; width: auto !important; }
#projectModal .project-modal-lang-btn { font-family: var(--rd-mono) !important; font-size: 11.5px !important; letter-spacing: 0.1em !important; min-height: 44px !important; height: 44px !important; min-width: 58px !important; padding: 0 16px !important; border: 1px solid var(--white-alpha-20) !important; border-radius: var(--rd-rb) !important; background: var(--white-alpha-04) !important; box-shadow: none !important; }
#projectModal .project-modal-lang-btn:hover { border-color: var(--rd-acc-line) !important; background: var(--rd-acc-soft) !important; }
#projectModal .project-modal-like-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 10px !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 12px 0 14px !important;
    border: 1px solid var(--white-alpha-20) !important;
    border-radius: var(--rd-rb) !important;
    background: var(--white-alpha-04) !important;
    box-shadow: none !important;
    font-family: var(--rd-sans) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
}
#projectModal .project-modal-like-btn svg { width: 18px !important; height: 18px !important; }
/* Hover is white instead of the theme colour and has no shine stripe (styles.css lets
   a light band run across the button on hover: ::before); liked is clearly red */
#projectModal .project-modal-like-btn::before { content: none !important; display: none !important; }
#projectModal .project-modal-like-btn.liked { border-color: var(--brand-error) !important; background: var(--error-alpha-20) !important; color: var(--brand-error) !important; box-shadow: none !important; }
@media (hover: hover) {   /* Hover only with a mouse (on phones it would stay stuck after a tap) */
    #projectModal .project-modal-like-btn:hover { background: var(--white-alpha-10) !important; border-color: var(--white-alpha-60) !important; color: var(--text-primary) !important; box-shadow: none !important; transform: none !important; }
    #projectModal .project-modal-like-btn.liked:hover { border-color: var(--brand-error) !important; background: var(--error-alpha-30) !important; color: var(--brand-error) !important; }
}
#projectModal .project-modal-like-btn.liked .project-modal-like-count { background: var(--error-alpha-25) !important; color: var(--brand-error) !important; }
#projectModal .project-modal-like-count { display: flex !important; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding: 0 8px !important; margin: 0 !important; line-height: 1 !important; border-radius: 6px; background: var(--white-alpha-10) !important; font-family: var(--rd-sans) !important; font-size: 12px !important; font-weight: 600 !important; font-variant-numeric: tabular-nums; transform: none !important; top: 0 !important; }
#projectModal .project-modal-like-text { line-height: 1 !important; }
/* The like button keeps its width after a click: when liking, the site script replaces
   the content with absolutely positioned wrappers (.modal-like-content-container and
   -wrapper); with width auto the button would shrink to about 28 px and the content
   would be gone. */
#projectModal .project-modal-like-btn { position: relative; min-width: 208px !important; justify-content: center !important; overflow: hidden; }
#projectModal .modal-like-content-container { position: absolute !important; inset: 0 !important; width: auto !important; height: auto !important; min-height: 0 !important; }
#projectModal .modal-like-content-wrapper { box-sizing: border-box; gap: 10px !important; justify-content: center; padding: 0 12px 0 14px; }
/* Heart at the top of the popup (next to close): counter and state like the like
   button in the info area */
#projectModal.rd-sheet .rd-pm-heart {
    pointer-events: auto;
    display: inline-flex; align-items: center; gap: 8px;
    height: 42px; padding: 0 14px 0 12px;
    border-radius: var(--rd-rb);
    background: var(--rd-veil);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--white-alpha-20);
    color: var(--text-primary); font-family: var(--rd-sans); font-size: 13px; font-weight: 650; line-height: 1;
    cursor: pointer;
    transition: border-color 0.35s, background-color 0.35s, color 0.35s, transform 0.5s var(--rd-ease);
}
.rd-pm-heart svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; transition: fill 0.3s, stroke 0.3s, transform 0.5s var(--rd-ease); }
#projectModal.rd-sheet .rd-pm-heart.liked { border-color: var(--brand-error); color: var(--brand-error); background: color-mix(in srgb, var(--brand-error) 18%, var(--rd-veil)); }   /* Fully red, including border and number */
.rd-pm-heart.liked svg { fill: var(--brand-error); stroke: var(--brand-error); }
.rd-pm-heart-n { min-width: 1ch; font-variant-numeric: tabular-nums; }
/* Hover effects: close button, heart at the top and the like button in the info area
   react visibly (mouse only; on phones a hover would stay stuck after a tap). The
   selectors carry #projectModal.rd-sheet because the base rules of the buttons are
   !important with the same weight. Keyboard focus shows the same as hover. */
#projectModal.rd-sheet .project-modal-close {
    transition: background-color 0.35s, border-color 0.35s, color 0.35s, transform 0.5s var(--rd-ease) !important;
}
#projectModal.rd-sheet .project-modal-close svg { transition: transform 0.55s var(--rd-ease); }
#projectModal.rd-sheet .project-modal-like-btn { transition: background-color 0.35s, border-color 0.35s, transform 0.5s var(--rd-ease) !important; }
#projectModal.rd-sheet .project-modal-like-btn svg { transition: transform 0.5s var(--rd-ease); }
#projectModal.rd-sheet .project-modal-lang-btn { transition: background-color 0.35s, border-color 0.35s, color 0.35s, transform 0.5s var(--rd-ease) !important; }
#projectModal.rd-sheet .rd-pm-heart:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: 2px; }
#projectModal.rd-sheet .project-modal-close:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: 2px; }
#projectModal.rd-sheet .rd-pm-heart:active { transform: scale(0.96); }
#projectModal.rd-sheet .project-modal-close:active { transform: scale(0.94) !important; }
#projectModal.rd-sheet .project-modal-like-btn:active { transform: scale(0.97) !important; }
#projectModal.rd-sheet .project-modal-like-btn:focus-visible,
#projectModal.rd-sheet .project-modal-lang-btn:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: 2px; }
@media (hover: hover) {
    #projectModal.rd-sheet .rd-pm-heart:hover { border-color: var(--white-alpha-60); background: color-mix(in srgb, var(--white-alpha-15), var(--rd-veil)); color: var(--text-primary); transform: translateY(-1px); }
    #projectModal.rd-sheet .rd-pm-heart:hover svg { transform: scale(1.18); }
    #projectModal.rd-sheet .rd-pm-heart.liked:hover { border-color: var(--brand-error); background: color-mix(in srgb, var(--brand-error) 28%, var(--rd-veil)); color: var(--brand-error); }
    #projectModal.rd-sheet .project-modal-close:hover { background: color-mix(in srgb, var(--brand-error) 20%, var(--rd-veil-2)) !important; border-color: var(--error-alpha-40) !important; color: var(--brand-error) !important; transform: scale(1.05) !important; }
    #projectModal.rd-sheet .project-modal-close:hover svg { transform: rotate(90deg); }
    #projectModal.rd-sheet .project-modal-like-btn:hover { transform: translateY(-1px) !important; }
    #projectModal.rd-sheet .project-modal-like-btn:hover svg { transform: scale(1.15); }
    #projectModal.rd-sheet .project-modal-lang-btn:hover { color: var(--rd-acc) !important; transform: translateY(-1px) !important; }
}

/* Sheet: slides up slowly from the bottom, the content builds up one after another */
/* Side padding at least as large as the safe area (iPhone in landscape: notch left and
   right); the main image stays edge to edge */
#projectModal.rd-sheet { --pm-pad: max(clamp(18px, 3.6vw, 56px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
#projectModal.rd-sheet .project-modal-container {
    width: min(1240px, 100%) !important;
    max-width: 100% !important;
    height: min(94vh, calc(100% - 20px)) !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: hidden !important;
    transition: transform 0.95s var(--rd-ease) !important;
}
#projectModal.rd-sheet.closing .project-modal-container { transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1) !important; }
#projectModal.rd-sheet.active .project-modal-backdrop { animation-duration: 0.9s !important; }
/* The header floats over the main image: only the close button, plus the grab handle */
#projectModal.rd-sheet .project-modal-header {
    position: absolute !important; top: 0; left: 0; right: 0; z-index: 30;
    display: flex !important; justify-content: flex-end !important; align-items: flex-start; gap: 8px;
    height: auto !important; margin: 0 !important; padding: 14px max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px)) !important;
    background: none !important; border: 0 !important;
    pointer-events: none;
}
#projectModal.rd-sheet .project-modal-header::before { top: 9px; width: 44px; background: var(--white-alpha-40); }
#projectModal.rd-sheet .project-modal-close {
    pointer-events: auto;
    width: 42px; height: 42px; min-width: 42px; min-height: 42px;
    background: var(--rd-veil) !important;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--white-alpha-20) !important;
    color: var(--text-primary) !important;
}
/* A single scroll area */
#projectModal.rd-sheet .project-modal-content {
    position: absolute !important; inset: 0 !important;
    display: block !important;
    height: auto !important; max-height: none !important;
    margin: 0 !important; padding: 0 !important;
    overflow-x: hidden !important; overflow-y: auto !important;
    border: 0 !important;
    overscroll-behavior: contain;
}
#projectModal.rd-sheet .project-modal-main { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; padding: 0 !important; }
#projectModal.rd-sheet .project-modal-content-mobile {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    row-gap: clamp(10px, 1.2vw, 14px);
    height: auto !important; max-height: none !important; overflow: visible !important;
    padding: 0 var(--pm-pad) clamp(36px, 5vw, 64px) !important;
}
/* Gallery items become children of the grid: the first is the main image at the very
   top, then the info, then the rest */
#projectModal.rd-sheet .project-modal-media,
#projectModal.rd-sheet .project-modal-gallery { display: contents !important; }
#projectModal.rd-sheet .gallery-item {
    order: 3;
    width: 100% !important;
    margin: 0 !important;
    min-height: 160px !important;
    border-radius: var(--rd-r) !important;
    border: 1px solid var(--rd-line) !important;
}
/* Tiles with the aspect ratio of their media (class mbp-fit, set by mbpFitTile in the
   site script) may be lower than the general min-height rules (160, 200 and 300 px),
   otherwise flat media (2.4:1 to 2.8:1) would be cropped on phones. */
#projectModal .project-modal-gallery .gallery-item.mbp-fit,
#projectModal.rd-sheet .gallery-item.mbp-fit { min-height: 0 !important; }
#projectModal.rd-sheet .gallery-item:first-child {
    order: 1;
    width: calc(100% + var(--pm-pad) * 2) !important;
    max-width: none !important;
    justify-self: start;
    margin: 0 calc(var(--pm-pad) * -1) !important;
    aspect-ratio: 16 / 9 !important;        /* The other tiles get the aspect ratio of their media (inline), the main image always
   fills this area */
    max-height: 56vh !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border-width: 0 0 1px 0 !important;
    background-color: var(--brand-black) !important;
}
/* The preview image is already the background, so the main image shows no grey loading flicker */
#projectModal.rd-sheet .gallery-item:first-child .gallery-item-skeleton { display: none !important; }
#projectModal.rd-sheet .gallery-item:first-child img,
#projectModal.rd-sheet .gallery-item:first-child video {
    position: absolute !important; inset: 0 !important;
    width: 100% !important; height: 100% !important; min-height: 0 !important;
    object-fit: cover !important;
}
/* Info: category, title and text on the left; key facts, tags and below them (small
   gap) like and language on the right. The right column stands as a whole in the
   middle next to the left text and adapts automatically to the length of the text. */
#projectModal.rd-sheet .project-modal-info {
    order: 2;
    display: grid !important;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    column-gap: clamp(26px, 5vw, 76px);
    row-gap: 30px;
    align-items: start;
    max-height: none !important; overflow: visible !important;
    margin: 0 !important;
    padding: clamp(28px, 3.6vw, 52px) 0 clamp(18px, 2.4vw, 30px) !important;
    border: 0 !important;
}
#projectModal.rd-sheet .project-modal-info > * { grid-column: auto; }
.rd-pm-main, .rd-pm-side { min-width: 0; }
.rd-pm-main { align-self: start; }
.rd-pm-side { align-self: center; }
.rd-pm-act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: clamp(30px, 3.4vw, 44px) 0 0; }   /* More room around the tags */
#projectModal.rd-sheet .project-modal-category { margin: 0 0 14px !important; }
#projectModal.rd-sheet .project-modal-title {
    display: block !important;
    margin: 0 0 22px !important;
    font-size: clamp(30px, 4.2vw, 58px) !important;
    font-weight: 700 !important;
    letter-spacing: -0.045em !important;
    line-height: 1.02 !important;
    white-space: normal !important; overflow: visible !important; text-overflow: clip !important;
    color: var(--text-primary);
}
#projectModal.rd-sheet .project-modal-description { max-width: 62ch; margin: 0 0 22px !important; }
#projectModal.rd-sheet .project-modal-tags { margin: 22px 0 0 !important; }
/* Further media: stacked at full width (large renderings), videos like images */
#projectModal.rd-sheet .gallery-item:not(:first-child) { background: var(--surface-0-alt) !important; }
/* Next project at the very bottom */
.rd-pm-next {
    order: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(120px, 18vw, 240px);
    align-items: center;
    gap: 20px;
    width: 100%;
    margin: clamp(18px, 2.6vw, 34px) 0 0;
    padding: clamp(14px, 1.8vw, 22px) clamp(16px, 2.2vw, 28px);
    text-align: left;
    border-radius: var(--rd-r);
    border: 1px solid var(--rd-line);
    background: var(--white-alpha-03);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.5s var(--rd-ease), border-color 0.5s;
}
.rd-pm-next[hidden] { display: none; }
.rd-pm-next:hover { background: var(--rd-acc-soft); border-color: var(--rd-acc-line); }
.rd-pm-next img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: var(--surface-0-alt); }
.rd-pm-next .rd-lbl { display: block; color: var(--rd-acc); }
.rd-pm-next b { display: block; margin-top: 8px; font-family: var(--rd-sans); font-size: clamp(18px, 2.2vw, 28px); font-weight: 650; letter-spacing: -0.035em; line-height: 1.1; color: var(--text-primary); }

/* Build animation (home-redesign.js sets the class .rd-build again on every opening
   and every project change) */
@keyframes rdPmUp   { from { opacity: 0; transform: translate3d(0, 26px, 0); } to { opacity: 1; transform: none; } }
@keyframes rdPmHero { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }
#projectModal.rd-sheet.rd-build .gallery-item:first-child { animation: rdPmHero 1.25s 0.3s var(--rd-ease) backwards; }
#projectModal.rd-sheet.rd-build .rd-pm-main > *,
#projectModal.rd-sheet.rd-build .rd-pm-side > * { animation: rdPmUp 0.95s var(--rd-ease) backwards; }
#projectModal.rd-sheet.rd-build .rd-pm-main > :nth-child(1) { animation-delay: 0.52s; }
#projectModal.rd-sheet.rd-build .rd-pm-main > :nth-child(2) { animation-delay: 0.6s; }
#projectModal.rd-sheet.rd-build .rd-pm-main > :nth-child(3) { animation-delay: 0.68s; }
#projectModal.rd-sheet.rd-build .rd-pm-main > :nth-child(4) { animation-delay: 0.76s; }
#projectModal.rd-sheet.rd-build .rd-pm-side > :nth-child(1) { animation-delay: 0.64s; }
#projectModal.rd-sheet.rd-build .rd-pm-side > :nth-child(2) { animation-delay: 0.72s; }
#projectModal.rd-sheet.rd-build .rd-pm-side > :nth-child(3) { animation-delay: 0.8s; }
#projectModal.rd-sheet.rd-build .gallery-item:nth-child(2) { animation: rdPmUp 1s 0.95s var(--rd-ease) backwards; }
#projectModal.rd-sheet.rd-build .gallery-item:nth-child(3) { animation: rdPmUp 1s 1.05s var(--rd-ease) backwards; }

/* Narrow: category, title, text, link, key facts, tags and finally like and language, stacked */
@media (max-width: 800px) {
    #projectModal.rd-sheet .project-modal-info { row-gap: 0; grid-template-columns: minmax(0, 1fr); }
    #projectModal.rd-sheet .rd-pm-main, #projectModal.rd-sheet .rd-pm-side { display: contents; }
    #projectModal.rd-sheet .project-modal-category { order: 1; margin: 0 0 12px !important; }
    #projectModal.rd-sheet .project-modal-title { order: 2; margin: 0 0 18px !important; }
    #projectModal.rd-sheet .rd-pm-act { order: 8; margin: 34px 0 0; }
    #projectModal.rd-sheet .project-modal-description { order: 4; margin: 0 0 20px !important; }
    #projectModal.rd-sheet #projectModalLinkContainer { order: 5; margin: 0 0 22px !important; }
    #projectModal.rd-sheet .project-modal-details { order: 6; }
    #projectModal.rd-sheet .project-modal-tags { order: 7; margin: 22px 0 0 !important; }
}
@media (max-width: 900px) {
    #projectModal.rd-sheet .project-modal-container { width: 100% !important; border-left: 0 !important; border-right: 0 !important; height: min(96vh, 100%) !important; }
    #projectModal.rd-sheet .project-modal-content-mobile { padding-left: var(--pm-pad) !important; padding-right: var(--pm-pad) !important; }
    #projectModal.rd-sheet .project-modal-info { grid-template-columns: minmax(0, 1fr); row-gap: 22px; }
    #projectModal.rd-sheet .project-modal-title { font-size: clamp(28px, 8.4vw, 42px) !important; }
    #projectModal.rd-sheet.active .project-modal-backdrop { animation: rdBackdropIn 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) forwards !important; }
    .rd-pm-next { grid-template-columns: minmax(0, 1fr) 110px; }
}
@media (max-width: 768px) {
    #projectModal.active .project-modal-backdrop { animation: rdBackdropIn 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) forwards !important; background: var(--rd-veil-3) !important; }
    #projectModal.closing .project-modal-backdrop { animation: rdBackdropOut 0.34s cubic-bezier(0.4, 0, 0.2, 1) forwards !important; }
}
@keyframes rdBackdropIn  { from { background: transparent; } to { background: var(--rd-veil-3); } }
@keyframes rdBackdropOut { from { background: var(--rd-veil-3); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
    #projectModal.rd-sheet.rd-build .gallery-item, #projectModal.rd-sheet.rd-build .rd-pm-main > *, #projectModal.rd-sheet.rd-build .rd-pm-side > * { animation: none !important; }
}

/* ==============================================================================
   9. SELECTED WORK CARD STACK
   Card stack while scrolling: the first three (or selected) projects large,
   each card slides over the previous one. The selection is made in
   home-redesign.js (DATA.showcase). A click opens the popup.
   ============================================================================== */
/* So that the stack stays pinned (position: sticky): with overflow-x: hidden and
   overflow-y: auto, body is a scroll container itself (though it never scrolls), and
   sticky would then refer to it and never take effect. overflow-x: clip cuts off
   horizontally in the same way but does not make body a scroll container. During the
   loading screen and the phone menu the !important rules from styles.css keep
   applying. */
/* the site script sets overflow: auto inline on body, so only !important beats it; it
   applies only after the loading screen (class curtain-cleared) so that its scroll
   lock stays untouched. The popup still locks through html (inline overflow: hidden). */
body.home-page.curtain-cleared:not(.mobile-menu-open) { overflow-x: clip !important; overflow-y: visible !important; }
.rd-showcase { position: relative; padding: clamp(70px, 10vw, 130px) clamp(20px, 5vw, 70px) clamp(30px, 6vw, 80px); }
.rd-sc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(22px, 3vw, 40px); }
.rd-sc-head .rd-kicker { margin-bottom: 14px; }
.rd-sc-head .rd-h2 { margin: 0; }
.rd-sc-stack { position: relative; padding-bottom: 6vh; }
.rd-sc {
    position: sticky;
    top: calc(86px + var(--i, 0) * 18px);
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    width: 100%;
    min-height: min(68vh, 560px);       /* Grows with the longer text of the recent works */
    margin: 0 0 7vh;
    padding: 0;
    text-align: left;
    color: var(--text-primary);
    border-radius: var(--rd-r);
    overflow: hidden;
    transform-origin: 50% 0;
    background: linear-gradient(180deg, var(--surface-1), var(--surface-0-alt));
    border: 1px solid var(--rd-line);
    box-shadow: 0 -26px 50px -30px var(--black-alpha-90);
    cursor: pointer;
    will-change: transform;
}
.rd-sc:last-child { margin-bottom: 0; }
.rd-sc-img { position: relative; overflow: hidden; background: var(--surface-0-alt); }
.rd-sc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.3s var(--rd-ease); }
.rd-sc:hover .rd-sc-img img { transform: scale(1.035); }
.rd-sc-t { display: flex; flex-direction: column; justify-content: space-between; gap: 22px; min-width: 0; padding: clamp(22px, 3.2vw, 48px); }
.rd-sc-r { display: block; font-family: var(--rd-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rd-acc); }
.rd-sc-b { display: block; margin: 14px 0 16px; font-family: var(--rd-sans); font-size: clamp(26px, 3.3vw, 50px); font-weight: 700; line-height: 1.02; letter-spacing: -0.045em; color: var(--text-primary); }
.rd-sc-p { display: block; margin: 0; max-width: 62ch; font-family: var(--rd-sans); font-size: var(--rd-t-body); line-height: 1.65; color: var(--rd-dim); white-space: pre-line; }   /* pre-line keeps the paragraphs of the recent works description */
.rd-sc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.rd-sc-chips span { padding: 5px 11px; border-radius: var(--rd-rs); border: 1px solid var(--white-alpha-15); background: var(--white-alpha-04); font-family: var(--rd-mono); font-size: 11px; color: var(--white-alpha-90); }
.rd-sc-more { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; border-radius: var(--rd-rb); background: var(--rd-acc); color: var(--rd-on-acc); font-family: var(--rd-sans); font-size: 14px; font-weight: 650; transition: background 0.4s var(--rd-ease), gap 0.5s var(--rd-ease); }
.rd-sc:hover .rd-sc-more { background: var(--rd-acc-2); gap: 14px; }
.rd-sc-sh { position: absolute; inset: 0; z-index: 4; background: var(--brand-black); opacity: 0; pointer-events: none; }
/* The card is an article. A transparent area over the whole card opens the popup
   (keyboard: it takes the focus). No download or enlarge buttons on the preview image. */
.rd-sc-hit { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.rd-sc-hit:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: -4px; }
/* Entrance: a card is held back (.rd-sc-pre) until it comes into view, then it fades in and slides up (.rd-sc-in). home-redesign.js sets
   .rd-sc-in when the card comes into view and takes it away again when the card has left the view, so the entrance repeats. The movement
   uses the standalone translate property so the scroll-linked scale of the stack (inline transform) stays untouched. */
.rd-sc.rd-sc-pre { opacity: 0; translate: 0 56px; transition: opacity 0.85s var(--rd-ease), translate 0.95s var(--rd-ease); }
.rd-sc.rd-sc-pre.rd-sc-in { opacity: 1; translate: 0 0; }
@media (max-width: 820px) {
    /* The card has no fixed height: a fixed 78 % of the screen height (max 640 px) would
       cut off the chips and View project on short phones, for example iPhone SE and many
       Android phones with 640 to 740 px. The image has a fixed height, the text sits below
       it at its natural height, and the card has a minimum height so that it looks
       unchanged on normal phones; it grows when the text needs more room. */
    .rd-sc { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: auto; min-height: min(78vh, 640px); top: calc(76px + var(--i, 0) * 12px); }
    .rd-sc-img { height: clamp(190px, 34vh, 300px); height: clamp(190px, 34svh, 300px); }
    .rd-sc-t { gap: 14px; padding: 20px 18px 18px; }
    .rd-sc-b { font-size: clamp(24px, 7.2vw, 34px); margin: 10px 0; }
    .rd-sc-p { font-size: 14px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
    .rd-sc-chips { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .rd-sc { position: relative; top: auto; }
    .rd-sc.rd-sc-pre { opacity: 1; translate: none; transition: none; }
}

/* ==============================================================================
   10. RESPONSIVE RULES
   Responsive rules for the sections above.
   ============================================================================== */
@media (max-width: 1080px) {
    .rd-portrait { grid-column: 1 / 13; grid-row: 1; min-height: 0; aspect-ratio: 16 / 10; }
    .rd-text     { grid-column: 1 / 13; grid-row: 2; }
    .rd-stat     { grid-column: 1 / 5;  grid-row: 3; }
    .rd-award    { grid-column: 5 / 9;  grid-row: 3; }
    .rd-school   { grid-column: 9 / 13; grid-row: 3; }
    .rd-t-list, .rd-t-disc { grid-column: 1 / 13; }
    .rd-disc-body { grid-template-columns: minmax(0, 200px) minmax(0, 1fr); }
    .rd-cta-card { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
/* Tablet in portrait: 2 instead of 3 cards per row (at about 800 px three cards would
   be only about 210 px wide) */
@media (min-width: 769px) and (max-width: 1000px) {
    .projects-section .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding: 0 4%; }
}
@media (max-width: 720px) {
    .rd-portrait { aspect-ratio: 4 / 4.3; }
    .rd-stat   { grid-column: 1 / 7;  grid-row: 3; }
    .rd-award  { grid-column: 7 / 13; grid-row: 3; }
    .rd-school { grid-column: 1 / 13; grid-row: 4; }
    .rd-tlist { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .rd-trow { min-height: 54px; padding: 8px 14px; font-size: 14px; }
    .rd-disc-body { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .rd-donut-wrap { max-width: 220px; }
    .rd-dleg { width: 100%; }
    .rd-soc a { padding: 10px 15px; font-size: 13px; }
}
@media (max-width: 420px) {
    /* Very narrow phones: the small line below the number may wrap instead of being cut off */
    .rd-stat i { white-space: normal; line-height: 1.5; letter-spacing: 0.06em; }
}
@media (prefers-reduced-motion: reduce) {
    .rd-donut .seg { transition-duration: 0.01s !important; transition-delay: 0s !important; }
    .rd-trow { opacity: 1 !important; transform: none !important; transition-duration: 0.01s !important; transition-delay: 0s !important; }
}

/* ==============================================================================
   11. ACCENTS AND CORNERS
   Light accents in the theme colour and slightly rounded corners (rectangles
   with a radius, no pills). It stays at the end of the file so that it
   overrides older rules of this file. The variables (--rd-acc, --rd-r,
   --rd-rb, --rd-rs) are defined in redesign.css.
   ============================================================================== */
/* Headings in the accent colour (gradient like Projects); em stays dimmed */
.rd-h2 {
    background: var(--rd-acc-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.rd-h2 em { -webkit-text-fill-color: var(--white-alpha-50); }
.rd-kicker { color: var(--rd-acc); }
.rd-num { color: var(--rd-acc); }

/* Cards and surfaces: about bento, project cards and the contact call to action keep
   their large rounding */
.rd-cell { border-radius: var(--rd-r-lg, 26px); }
.rd-dleg li { border-radius: var(--rd-rs); }

/* Contact call to action: the button matches the rounded card (22 px outside, 14 px
   inside, evenly nested), accent colour */
.rd-btn { border-radius: 22px; background: var(--rd-acc); color: var(--rd-on-acc); }
.rd-btn:hover { background: var(--rd-acc-2); transform: none; }
.rd-btn i { border-radius: 14px; background: var(--rd-on-acc); color: var(--rd-acc); }
.rd-soc a { border-radius: 14px; }
.rd-soc a:hover { background: var(--rd-acc-soft); border-color: var(--rd-acc-line); color: var(--rd-acc); transform: none; }
.rd-pill { border-radius: var(--rd-rb); }
.rd-pill.on { background: var(--rd-acc); border-color: var(--rd-acc); color: var(--rd-on-acc); }
/* Showcase: 30 px */
.rd-sc { border-radius: 30px; }

/* Video window */
.rd-lb video { border-radius: 12px; }
.rd-lb-nav button, .rd-lb-x { border-radius: var(--rd-rb); }
.rd-lb-nav button:hover { border-color: var(--rd-acc-line); background: var(--rd-acc-soft); color: var(--rd-acc); }
/* Close button of the video window: red like in the cookie banner and the project popup */
.rd-lb-x:hover { border-color: var(--error-alpha-40); background: var(--error-alpha-15); color: var(--brand-error); }
.rd-lb-x:focus-visible { outline: 2px solid var(--rd-acc); outline-offset: 2px; }
.rd-lb-text .rd-lbl { color: var(--rd-acc); }
