/* The TV frame: dark border, cream panel that scrolls on its own, corner notches
   with the social buttons, and the button bar at the bottom.
   Follows "TV frame — build spec" in the project's dev notes. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
:where(img[height]) { height: auto; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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

/* ---------- Sizes, changed only in the media queries ---------- */
:root {
  --tv-border: 20px;          /* dark border left, top and right */
  --tv-gap: 15px;             /* panel → bar and bar → screen bottom */
  --tv-radius: calc(46px * var(--s)); /* corner radius of the cream panel: same curve as the LinkedIn corner (C2, 30 Nov 2026) */
  --social: 54px;             /* LinkedIn / Instagram circle */
  --s: 1;                     /* scale of the corner notches (social / 54) */
  --bar-side: 0px;            /* bar padding: buttons line up with the panel edges (Figma, 13 Nov 2026) */
  --bs: 1;                    /* scale of the bar buttons */
}

/* ================= Desktop + tablet: the TV frame ================= */

@media (min-width: 700px) {
  html, body { height: 100%; overflow: hidden; }

  .tv {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--tv-gap);
    padding:
      calc(var(--tv-border) + env(safe-area-inset-top, 0px))
      calc(var(--tv-border) + env(safe-area-inset-right, 0px))
      calc(var(--tv-gap) + env(safe-area-inset-bottom, 0px))
      calc(var(--tv-border) + env(safe-area-inset-left, 0px));
  }

  .tv-panel {
    position: relative;
    min-height: 0;
    min-width: 0;
    background: var(--bg-beige);
    border-radius: var(--tv-radius);
  }

  /* The only element that scrolls. */
  .tv-scroll {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: var(--tv-radius);
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-300) transparent;
    -webkit-overflow-scrolling: touch;
    container-type: size;   /* lets a section be exactly one panel high (100cqh) */
    container-name: panel;
  }
  /* The panel gets focus only so arrow keys and space scroll it: no ring needed. */
  .tv-scroll:focus, .tv-scroll:focus-visible { outline: none; }
}

/* Tablet: bar buttons at 85 % */
@media (min-width: 700px) and (max-width: 1099px) {
  :root { --bs: .85; }
}

/* ================= Corner notches ================= */

/* Each notch is the same shape (C2: ring 46 around the button, joins 46), mirrored for the
   other corners. It overlaps the panel edge by 1 px so no seam shows. */
.notch {
  position: absolute;
  z-index: 3;
  /* the shape is drawn 1 px larger outwards (viewBox -1 -1), so it overlaps the panel
     edge without being stretched: the curves stay exactly the Figma curves */
  width: calc(116.8px * var(--s));
  height: calc(116.8px * var(--s));
  color: var(--bg-dark);
  pointer-events: none;
}
.notch svg { width: 100%; height: 100%; }
.notch > span { display: block; width: 100%; height: 100%; }
.notch .only-small-svg { display: none; }
.notch--tl { top: calc(-1px * var(--s)); left: calc(-1px * var(--s)); }
.notch--br { bottom: calc(-1px * var(--s)); right: calc(-1px * var(--s)); transform: scale(-1, -1); }

/* Social button (LinkedIn): centre 26 px from the panel corner on both axes. */
.social {
  position: absolute;
  z-index: 4;
  width: var(--social);
  height: var(--social);
  border-radius: 50%;
  pointer-events: auto;
}
.social--tl { top: calc(26px * var(--s) - var(--social) / 2); left: calc(26px * var(--s) - var(--social) / 2); }
.social--br { bottom: calc(26px * var(--s) - var(--social) / 2); right: calc(26px * var(--s) - var(--social) / 2); }
.social svg { width: 100%; height: 100%; transition: transform .25s var(--ease-out-back); }
@media (hover: hover) {
  .social:hover svg { transform: scale(.85); }
}

/* Wide notch top right (project pages): wraps the See next project button,
   so it follows the button width automatically. Shape from Figma "notch TR". */
.notch-wide {
  position: absolute;
  z-index: 3;
  top: -1px;
  right: -1px;
  display: inline-flex;
  padding: calc(3px + 1px) calc(3px + 1px) calc(15px * var(--s)) calc(15px * var(--s));
  background: var(--bg-dark);
  /* concentric with the pill: 27 (pill radius) + 15 (ring) */
  border-bottom-left-radius: var(--nw-r, calc(42px * var(--s)));
  pointer-events: none;
}
.notch-wide > * { pointer-events: auto; }
/* The two inverted radii where the notch meets the cream panel (C2, 30 Nov 2026).
   Under the notch: 46, the same curve as the panel corners.
   Left of the notch: 31. The dark strip is only 73 px tall (4 + 54 + 15), and this curve plus the
   42 px corner around the pill must fit in it to flow as one S-curve: 31 + 42 = 73. A 46 here
   left a sliver and a step at the join. Drawn as SVG masks (gradients get jagged edges in Safari),
   overlapping the notch by 1 px so no seam shows. */
.notch-wide::before,
.notch-wide::after {
  content: "";
  position: absolute;
  background: var(--bg-dark);
}
.notch-wide::before {
  top: 0; right: calc(100% - 1px);                                  /* left of the notch */
  /* Option 1 from Figma ("See next project corner", 30 Nov 2026): the panel turns down into the
     strip with its own 46 corner, which touches the 42 px ring around the round end of the pill.
     Same build as the LinkedIn corner, so nothing has to squeeze in. */
  width: var(--nw-w, calc(45.53px * var(--s))); height: var(--nw-h, calc(38.64px * var(--s))); /* measured by frame.js */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 45.53 38.64' preserveAspectRatio='none'%3E%3Cpath d='M0 1A46 46 0 0 1 45.23 38.64H45.53V0H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 45.53 38.64' preserveAspectRatio='none'%3E%3Cpath d='M0 1A46 46 0 0 1 45.23 38.64H45.53V0H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.notch-wide::after {
  top: calc(100% - 1px); right: 0;                                  /* under the notch */
  width: calc(46px * var(--s)); height: calc(46px * var(--s) + 1px);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 47' preserveAspectRatio='none'%3E%3Cpath d='M0 0H46V47A46 46 0 0 0 0 1Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 47' preserveAspectRatio='none'%3E%3Cpath d='M0 0H46V47A46 46 0 0 0 0 1Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

/* ================= Bottom bar ================= */

.tv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--bar-side);
  min-height: calc(54px * var(--bs));
}
.tv-bar--center { justify-content: center; }
.tv-bar__group { display: flex; gap: 16px; }

/* ================= Buttons ================= */

/* Pill + separate circle with arrow (component "Button" in Figma).
   Sizes: Large (desktop, tablet) and Small (mobile). */
.btn {
  --h: calc(54px * var(--bs));
  --px: calc(28px * var(--bs));
  --fs: calc(var(--fs-label-button) * var(--bs));
  display: inline-flex;
  align-items: center;
  flex: none;
  text-decoration: none;
  font: 500 var(--fs)/1 var(--font-text);
  white-space: nowrap;
  cursor: var(--cursor-pointer, pointer);
  border: 0;
  padding: 0;
  background: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.btn__pill,
.btn__bol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--h);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: var(--btn-border, 0) solid var(--btn-line, transparent);
  transition: background-color .2s, color .2s;
}
.btn__pill { padding: 0 var(--px); margin-right: -1px; }
.btn__bol { width: var(--h); }
.btn__arrow {
  width: 20px; height: 20px;
  overflow: visible; /* the arrow is 25 px long; on hover it sticks out of its 20 px box */
  /* Figma prototype: smart animate, ease out, 250 ms */
  transition: transform .25s cubic-bezier(0, 0, .58, 1);
  will-change: transform;
  backface-visibility: hidden;
}
.btn--back .btn__arrow { transform: rotate(-90deg); }
@media (hover: hover) {
  .btn:hover .btn__arrow { transform: rotate(45deg); }
  .btn--back:hover .btn__arrow { transform: rotate(-135deg); }
}

.btn--dark          { --btn-bg: var(--black); --btn-fg: var(--white); }
.btn--beige         { --btn-bg: var(--beige); --btn-fg: var(--text); }
.btn--outline       { --btn-bg: transparent; --btn-fg: var(--text); --btn-border: 1.5px; --btn-line: var(--border-strong); }
.btn--outline-dark  { --btn-bg: transparent; --btn-fg: var(--white); --btn-border: 1.5px; --btn-line: var(--border-on-dark); }

.btn--small {
  --h: 48px;
  --px: 14px;
  --fs: var(--fs-label-md);
}

/* Email button: copies the address. Same width in all states (197 px). */
.btn-email .btn__pill { width: calc(144px * var(--bs)); padding: 0; }
.btn-email.btn--small .btn__pill { width: auto; padding: 0 var(--px); }
.btn-email .btn__arrow { transition-duration: .2s; } /* Figma: Email button 200 ms */
.btn-email .btn__check { display: none; }
.btn-email.is-copied { --btn-bg: var(--beige); --btn-fg: var(--text); --btn-border: 0; }
.btn-email.is-copied .btn__arrow { display: none; }
.btn-email.is-copied .btn__check { display: block; }

/* Large buttons on desktop and tablet, Small ones on mobile */
.only-small, .only-small-block, .only-small-stack { display: none !important; }
@media (max-width: 699px) {
  .only-large { display: none !important; }
  .only-small { display: flex !important; }
  span.only-small { display: inline-flex !important; }
  .only-small-block { display: block !important; }
  .only-small-stack { display: block !important; }
}

/* ================= Mobile: below 700 px ================= */

@media (max-width: 699px) {
  :root {
    --tv-border: 8px;
    --tv-radius: 32px;
    --social: 48px;
    --s: calc(48 / 54);
    --bar-h: 72px;             /* 48 px buttons + 12 px above and below (Pauline, 13 Nov 2026) */
  }

  body { padding-bottom: calc(var(--bar-h) - var(--tv-border) + env(safe-area-inset-bottom, 0px)); } /* last panel ends exactly at the frame */

  .tv { padding: var(--tv-border); }
  .tv-panel {
    position: relative;
    background: var(--bg-beige);
    border-radius: var(--tv-radius);
  }
  .tv-scroll { border-radius: var(--tv-radius); }
  .tv-scroll:focus { outline: none; }

  /* Sticky bottom bar, always visible */
  .tv-bar {
    position: fixed;
    --bar-side: 12px;
    z-index: 10;
    left: 0; right: 0; bottom: 0;
    justify-content: center;
    gap: 8px;
    min-height: 0;
    height: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 calc(var(--bar-side) + env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) calc(var(--bar-side) + env(safe-area-inset-left, 0px));
    background: var(--bg-dark);
  }
  .tv-bar__group { gap: 8px; }

  /* Fixed frame on mobile too (Pauline, 13 Nov 2026): the page still scrolls normally, but a
     fixed dark frame with rounded inner corners sits on top, and the LinkedIn
     corner (and See next project) stay in place while the content scrolls underneath. */
  .tv::after {
    content: "";
    position: fixed;
    z-index: 5;
    top: calc(var(--tv-border) + env(safe-area-inset-top, 0px));
    left: var(--tv-border);
    right: var(--tv-border);
    bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
    border-radius: var(--tv-radius);
    box-shadow: 0 0 0 100vmax var(--bg-dark);
    pointer-events: none;
  }
  .tv-panel > .notch, .tv-panel > .social, .tv-panel > .notch-wide { position: fixed; }
  .tv-panel > .notch { z-index: 6; }
  .tv-panel > .social { z-index: 7; }
  .tv-panel > .notch-wide { z-index: 7; }
  .tv-panel > .notch--tl { top: calc(var(--tv-border) - 1px * var(--s) + env(safe-area-inset-top, 0px)); left: calc(var(--tv-border) - 1px * var(--s)); }
  .tv-panel > .social--tl { top: calc(var(--tv-border) + 26px * var(--s) - var(--social) / 2 + env(safe-area-inset-top, 0px)); left: calc(var(--tv-border) + 26px * var(--s) - var(--social) / 2); }
  .tv-panel > .notch-wide { top: calc(var(--tv-border) - 1px + env(safe-area-inset-top, 0px)); right: calc(var(--tv-border) - 1px); }
  .tv-panel > .notch--br { top: auto; left: auto; bottom: calc(var(--bar-h) - 1px + env(safe-area-inset-bottom, 0px)); right: calc(var(--tv-border) - 1px); }
  .tv-panel > .social--br { top: auto; left: auto; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); right: var(--tv-border); }

  /* Thinner dark ring around the corner buttons: 8 px, the same as the mobile frame border
     (Pauline, 17 Nov 2026). The buttons sit against the panel edge, 8 px from the screen edge. */
  .notch .only-large-svg { display: none; }
  .notch .only-small-svg { display: block; }
  .tv-panel > .notch--br { width: 88.5px; height: 88.5px; }
  .tv-panel > .notch--tl { width: 88.5px; height: 88.5px; left: calc(var(--tv-border) - 1px); top: calc(var(--tv-border) - 1px + env(safe-area-inset-top, 0px)); }
  .tv-panel > .social--tl { top: calc(var(--tv-border) + env(safe-area-inset-top, 0px)); left: var(--tv-border); }
  .notch-wide { padding: 1px 1px 8px 8px; border-bottom-left-radius: var(--nw-r, 32px); }
  /* under the notch: the panel's 32 corner; left of it: the panel's 32 corner hugging the 32 px ring
     around the pill (option 1, Figma "See next project corner") and 1 px overlap into the notch, so no seam shows */
  .notch-wide::before { width: var(--nw-w, 32.5px); height: var(--nw-h, 29px); right: calc(100% - 1px); }
  .notch-wide::after  { width: 32px; height: 33px; top: calc(100% - 1px); }
  /* SVG masks instead of a radial gradient: iPhone Safari draws hard-edged gradients jagged */
  .notch-wide::before {
    background: var(--bg-dark);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32.5 29' preserveAspectRatio='none'%3E%3Cpath d='M0 1A32 32 0 0 1 31.75 29H32.5V0H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32.5 29' preserveAspectRatio='none'%3E%3Cpath d='M0 1A32 32 0 0 1 31.75 29H32.5V0H0Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  }
  .notch-wide::after {
    background: var(--bg-dark);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 33' preserveAspectRatio='none'%3E%3Cpath d='M0 0H32V33A32 32 0 0 0 0 1Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 33' preserveAspectRatio='none'%3E%3Cpath d='M0 0H32V33A32 32 0 0 0 0 1Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  }

  /* Small buttons a bit narrower so two always fit with room at the screen edges */
  .tv-bar .btn--small { --px: 12px; }
  /* No back button on mobile: visitors use the browser back gesture. */
  .tv-bar__back { display: none; }
}

/* Very narrow phones (iPhone 12 mini, small Androids): smaller bar labels so the buttons keep their margin */
@media (max-width: 389px) {
  .tv-bar .btn--small { --px: 10px; --fs: 15px; }
}

/* Page changes: dissolve, ease out, 250 ms (Figma: card click → project page) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; animation-timing-function: cubic-bezier(0, 0, .58, 1); }



/* ---------- Temporary placeholder content (removed page by page) ---------- */
.stub { padding: 120px; min-height: 160%; display: grid; align-content: start; gap: 24px; }
.stub p { color: var(--text-muted); max-width: 60ch; }
@media (max-width: 1099px) { .stub { padding: 100px 56px; } }
@media (max-width: 699px) { .stub { padding: 96px 20px 40px; min-height: 120vh; } }

/* See next project notch: the measured hug shape from frame.js wins over the static fallback masks */
.notch-wide[style*="--nw-mask"]::before {
  -webkit-mask: var(--nw-mask) 0 0 / 100% 100% no-repeat;
          mask: var(--nw-mask) 0 0 / 100% 100% no-repeat;
}
