/* Portfolio styles: opening hero, profile/login state, typewriter and entrance choreography.
   Source: portfolio.html split for cacheability and ownership. */
    /* ============ HERO ============ */
    .hero {
      position: relative;
      min-height: 100vh;
      display: grid;
      align-items: center;
      padding: clamp(104px, 13vh, 132px) var(--section-pad-x) clamp(48px, 7vh, 72px);
      overflow: hidden;
      isolation: isolate;
    }

    /* hero is transparent so global backdrop shows through */
    .hero {
      background: transparent
    }

    .hero__shell {
      width: min(100%, 1500px);
      max-width: calc(100vw - (var(--section-pad-x) * 2));
      margin: 0 auto;
      display: grid;
      gap: clamp(14px, 2.2vh, 22px);
      justify-items: center;
      text-align: center;
      min-width: 0;
    }

    .nav.is-menu-open {
      z-index: var(--layer-header-menu);
    }

    .hero__return-login {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 38px;
      padding: 0 15px;
      border: 1px solid rgba(255, 181, 98, .24);
      border-radius: 999px;
      background:
        linear-gradient(180deg, rgba(255, 255, 255, .058), rgba(255, 255, 255, .018)),
        rgba(9, 9, 11, .58);
      color: rgba(255, 214, 156, .9);
      font: 850 10px/1 var(--mono);
      letter-spacing: .13em;
      text-transform: uppercase;
      cursor: pointer;
      box-shadow:
        0 14px 34px rgba(0, 0, 0, .32),
        inset 0 1px 0 rgba(255, 255, 255, .07);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transform: translateY(12px);
      transition:
        opacity .46s cubic-bezier(.22, 1, .36, 1),
        visibility .46s ease,
        transform .5s cubic-bezier(.22, 1, .36, 1),
        border-color .22s ease,
        background .22s ease,
        color .22s ease;
    }

    html[data-auth-state="guest"] .hero__return-login,
    html[data-auth-state="logged-in"] .hero__return-login {
      display: inline-flex;
    }

    .hero__return-login:hover {
      border-color: rgba(255, 181, 98, .42);
      background:
        linear-gradient(180deg, rgba(255, 181, 98, .12), rgba(255, 255, 255, .025)),
        rgba(13, 12, 13, .72);
      color: #ffd69c;
    }

    .hero__return-login:focus-visible {
      outline: 2px solid var(--amber);
      outline-offset: 4px;
    }

    .hero__return-login .arrow {
      display: inline-block;
      transform: translateY(-1px);
    }

    .hero__kicker {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      border: 1px solid rgba(243, 241, 236, .14);
      border-radius: 999px;
      background: rgba(8, 8, 10, .46);
      font-family: var(--mono);
      font-size: 11px;
      letter-spacing: .12em;
      text-transform: uppercase;
      color: rgba(243, 241, 236, .74);
      max-width: 100%;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      opacity: 0;
      transform: translateY(14px);
      transition: opacity 0.62s cubic-bezier(0.22, 1, 0.36, 1), transform 0.68s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .hero__kicker::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--amber);
      box-shadow: 0 0 16px rgba(255, 138, 61, .6);
    }

    .hero__kicker-text {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .hero__headline {
      width: 100%;
      max-width: min(100%, 1500px);
      font-size: min(clamp(30px, 4vw, 62px), calc((100vw - (var(--section-pad-x) * 2)) / 39));
      line-height: .94;
      letter-spacing: -.02em;
      font-weight: 600;
      text-wrap: balance;
      text-shadow: 0 10px 36px rgba(0, 0, 0, .48);
      overflow: hidden;
      opacity: 1;
    }

    .hero__headline span {
      display: block;
      white-space: nowrap;
      max-width: 100%;
      overflow: hidden;
      text-overflow: clip;
      opacity: 0;
      transform: translateY(30px);
      transition: opacity 0.62s cubic-bezier(0.22, 1, 0.36, 1), transform 0.70s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .hero__divider {
      width: min(220px, 42vw);
      height: 1px;
      margin: 0;
      background: linear-gradient(90deg, transparent, rgba(243, 241, 236, .48), transparent);
      opacity: 0;
      transform: scaleX(0);
      transform-origin: center;
      transition: opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1), transform 0.64s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .hero__value {
      width: min(760px, 100%);
      margin: 0;
      position: relative;
      font-family: var(--display);
      font-size: clamp(21px, 2.08vw, 31px);
      line-height: 1.16;
      letter-spacing: -.015em;
      font-weight: 520;
      color: rgba(243, 241, 236, .94);
      text-align: center;
      text-wrap: balance;
      text-shadow: 0 2px 24px rgba(0, 0, 0, .52);
      opacity: 0;
      transform: translateY(10px);
      transition: opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1), transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .hero__value-measure {
      display: block;
      visibility: hidden;
      pointer-events: none;
    }

    .hero__value-live {
      position: absolute;
      inset: 0;
      display: block;
      overflow: visible;
      text-align: center;
      pointer-events: none;
    }

    .hero__value-text {
      display: inline;
      white-space: normal;
    }

    .hero__value-caret-anchor {
      position: absolute;
      left: 0;
      top: 0;
      display: block;
      width: 0;
      height: 1em;
      transform: translate3d(var(--caret-x, 0px), var(--caret-y, 0px), 0);
      pointer-events: none;
      will-change: transform;
    }

    .hero__value-char {
      opacity: 0;
      transition: opacity 80ms linear;
    }

    .hero__value-char.is-visible {
      opacity: 1;
    }

    .hero__value-caret {
      position: absolute;
      left: .12em;
      top: .03em;
      display: block;
      width: .08em;
      height: .98em;
      transform: none;
      background: var(--amber);
      box-shadow: 0 0 16px rgba(255, 138, 61, .58);
      opacity: 0;
      transition: opacity .18s ease;
    }

    .hero__value.is-typing .hero__value-caret {
      opacity: 1;
      animation: caretBlink .82s steps(2, start) infinite;
    }

    .hero__value.is-typed .hero__value-caret {
      opacity: .28;
      animation: none;
    }

    @keyframes caretBlink {
      50% {
        opacity: .18;
      }
    }

    @keyframes rise {
      from {
        transform: translateY(110%);
        opacity: 0
      }

      to {
        transform: translateY(0);
        opacity: 1
      }
    }

    .hero__bottom {
      display: grid;
      gap: clamp(12px, 1.9vh, 18px);
      width: min(760px, 100%);
      margin: 0 auto;
      justify-items: center;
      font-family: var(--display);
      font-size: 14px;
      letter-spacing: 0;
      text-transform: none;
      color: rgba(243, 241, 236, .7);
      opacity: 1;
    }

    .hero__trust,
    .hero__links {
      opacity: 1;
    }

    .hero__reveal-item {
      --hero-item-reveal: 0;
      opacity: var(--hero-item-reveal);
      transform:
        translateY(calc((1 - var(--hero-item-reveal)) * -26px)) scale(calc(1 + ((1 - var(--hero-item-reveal)) * .24)));
      transform-origin: center;
      filter: blur(calc((1 - var(--hero-item-reveal)) * 3px));
      will-change: opacity, transform, filter;
    }

    .hero__statement {
      font-size: 18px;
      line-height: 1.55;
      color: rgba(243, 241, 236, .8);
      letter-spacing: -.005em;
      max-width: 60ch;
      font-weight: 400;
      text-wrap: pretty;
      text-align: center;
      opacity: 0;
      transform: translateY(12px);
      transition: opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1), transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .hero__statement em {
      font-family: inherit;
      font-style: normal;
      color: var(--ink);
      font-weight: 700
    }

    .hero__ctas {
      display: flex;
      gap: 12px;
      justify-content: center;
      flex-wrap: wrap
    }

    .hero__trust {
      width: min(920px, 100%);
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: clamp(8px, 1.1vw, 12px);
      margin-top: 2px;
    }

    .hero__pill {
      min-height: clamp(58px, 7vh, 68px);
      padding: clamp(12px, 1.5vh, 16px) 16px;
      border: 1px solid rgba(243, 241, 236, .1);
      border-radius: 8px;
      background: rgba(9, 9, 11, .52);
      display: grid;
      gap: 6px;
      text-align: left;
      opacity: 0;
      transform: translateY(18px);
      transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .hero__pill strong {
      font-size: 15px;
      color: var(--ink);
    }

    .hero__pill span {
      font-size: 13px;
      line-height: 1.45;
      color: rgba(243, 241, 236, .64);
    }

    .hero__links {
      display: flex;
      gap: 18px;
      flex-wrap: wrap;
      justify-content: center;
      font-family: var(--mono);
      font-size: 11px;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .hero__links a {
      color: rgba(243, 241, 236, .62);
      opacity: 0;
      transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
    }

    .hero__links a:hover {
      color: var(--ink)
    }

    /* ── Hero storytelling entrance sequence ── */

    .hero.is-title-revealing .hero__kicker {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0s;
    }

    .hero.is-title-revealing .hero__return-login {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: translateY(0);
      transition-delay: 0s;
    }

    .hero.is-title-revealing .hero__headline span:nth-child(1) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0.16s;
    }

    .hero.is-title-revealing .hero__headline span:nth-child(2) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0.34s;
    }

    .hero.is-title-revealing .hero__headline span:nth-child(3) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0.52s;
    }

    .hero.is-title-revealing .hero__divider {
      opacity: 1;
      transform: scaleX(1);
      transition-delay: 0.70s;
    }

    /* Value: wait for headline cascade to be underway (gates fire within ~90ms of each other) */
    .hero.is-subtitle-revealing .hero__value {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0.52s;
    }

    /* Rest elements: start after headline + divider complete (~0.70s title gate + 0.70s delay = ~1.4s total) */
    .hero.is-rest-revealing .hero__statement {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 0.72s;
    }

    .hero.is-rest-revealing .hero__ctas .btn:nth-child(1) {
      opacity: 1;
      transform: translateY(0) scale(1);
      transition-delay: 0.82s;
    }

    .hero.is-rest-revealing .hero__ctas .btn:nth-child(2) {
      opacity: 1;
      transform: translateY(0) scale(1);
      transition-delay: 0.92s;
    }

    .hero.is-rest-revealing .hero__ctas .btn:nth-child(3) {
      opacity: 1;
      transform: translateY(0) scale(1);
      transition-delay: 1.00s;
    }

    .hero.is-rest-revealing .hero__pill:nth-child(1) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 1.02s;
    }

    .hero.is-rest-revealing .hero__pill:nth-child(2) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 1.14s;
    }

    .hero.is-rest-revealing .hero__pill:nth-child(3) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 1.26s;
    }

    .hero.is-rest-revealing .hero__pill:nth-child(4) {
      opacity: 1;
      transform: translateY(0);
      transition-delay: 1.38s;
    }

    .hero.is-rest-revealing .hero__links a:nth-child(1) {
      opacity: 1;
      transition-delay: 1.52s;
    }

    .hero.is-rest-revealing .hero__links a:nth-child(2) {
      opacity: 1;
      transition-delay: 1.62s;
    }

    /* CTA buttons: add initial hidden state (preserve hover transitions) */
    .hero__ctas .btn {
      opacity: 0;
      transform: translateY(14px) scale(0.97);
      transition: opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1),
                  transform 0.58s cubic-bezier(0.22, 1, 0.36, 1),
                  background 0.25s ease,
                  color 0.25s ease,
                  border-color 0.25s ease,
                  box-shadow 0.25s ease;
    }

    /* Skip all entrance animations for reduced motion */
    @media (prefers-reduced-motion: reduce) {
      .hero__kicker,
      .hero__headline span,
      .hero__divider,
      .hero__value,
      .hero__statement,
      .hero__ctas .btn,
      .hero__pill,
      .hero__links a {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
      }
    }

    .btn {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 10px;
      min-height: 48px;
      padding: 0 22px;
      border-radius: 999px;
      font-family: var(--display);
      font-size: 14px;
      letter-spacing: 0;
      text-transform: none;
      font-weight: 700;
      border: 1px solid rgba(255, 138, 61, .2);
      color: var(--ink);
      transition: all .25s ease;
      cursor: pointer;
      background: rgba(0, 0, 0, .18);
      overflow: hidden;
      white-space: nowrap;
    }

    .btn:hover {
      background: var(--ink);
      color: #000;
      border-color: var(--ink);
      transform: translateY(-1px)
    }

    .btn:disabled {
      cursor: not-allowed;
      opacity: .48;
      transform: none;
    }

    .btn--primary {
      background: linear-gradient(135deg, #ffb854 0%, #ff913f 48%, #f06f29 100%);
      color: #120900;
      border-color: rgba(255, 193, 122, .72);
      box-shadow: 0 20px 44px rgba(255, 138, 61, .18), inset 0 1px 0 rgba(255, 246, 228, .48);
    }

    .btn--primary:hover {
      background: var(--ink);
      color: #000;
      border-color: var(--ink);
      box-shadow: 0 16px 38px rgba(243, 241, 236, .16)
    }

    .btn .arrow {
      font-family: var(--display);
      font-size: 14px
    }

    .btn--text {
      min-height: 40px;
      padding: 0 4px;
      border-color: transparent;
      background: transparent;
      color: rgba(243, 241, 236, .76);
    }

    .btn--text:hover {
      background: transparent;
      color: var(--ink);
      border-color: transparent;
      transform: none;
    }

    @media(max-width:900px) {
      .hero {
        padding: 124px 20px 48px
      }

      .hero__shell {
        gap: 18px
      }

      .hero__headline {
        max-width: min(100%, 720px);
        font-size: clamp(34px, 9.5vw, 58px)
      }

      .hero__headline span {
        white-space: normal;
      }

      .hero__bottom {
        gap: 16px
      }

      .hero__ctas {
        justify-content: center
      }

      .hero__trust {
        grid-template-columns: 1fr 1fr
      }
    }

    @media(max-width:640px) {
      .hero__trust {
        grid-template-columns: 1fr
      }

      .hero__links {
        gap: 12px 16px
      }
    }
