/* Story selection portal */
.story-portal {
    --portal-ink: #17212a;
    --portal-paper: #f5eddd;
    --portal-gold: #e5c895;
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    padding: clamp(20px, 3.2vh, 34px) clamp(22px, 6.2vw, 96px) 18px;
    color: var(--portal-paper);
    background:
        linear-gradient(90deg, rgba(14, 24, 31, .95) 0%, rgba(15, 26, 34, .81) 43%, rgba(15, 25, 34, .76) 100%),
        linear-gradient(0deg, rgba(9, 17, 24, .92), transparent 52%),
        url("assets/backgrounds/school_courtyard.jpg") center 46% / cover no-repeat,
        #111c24;
    opacity: 1;
    transition: opacity .72s ease, transform .72s cubic-bezier(.2,.7,.2,1);
    isolation: isolate;
}
.story-portal[hidden] { display: none !important; }
.story-portal::before,
.story-portal::after { content: ""; position: absolute; pointer-events: none; }
.story-portal::before {
    z-index: -1;
    width: min(66vw, 860px);
    aspect-ratio: 1;
    top: -48%;
    right: -12%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 205, 137, .16), rgba(234, 190, 119, .055) 34%, transparent 69%);
}
.story-portal::after {
    z-index: -1;
    inset: 0;
    opacity: .22;
    background-image: radial-gradient(rgba(255,255,255,.32) .55px, transparent .8px);
    background-size: 5px 5px;
    mix-blend-mode: soft-light;
}
.portal-grain { position: absolute; inset: 0; z-index: -1; pointer-events: none; border: 1px solid rgba(245, 237, 221, .12); margin: 10px; }
.portal-header, .portal-brand, .portal-brand-copy, .portal-edition,
.portal-eyebrow, .portal-section-heading, .portal-footer { display: flex; align-items: center; }
.portal-header { justify-content: space-between; min-height: 44px; animation: portal-rise .75s both; }
.portal-brand { gap: 12px; color: var(--portal-paper); text-decoration: none; }
.portal-brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(229,200,149,.68); color: var(--portal-gold); font: 400 21px/1 'Noto Serif JP', serif; }
.portal-brand-copy { align-items: flex-start; flex-direction: column; gap: 2px; }
.portal-brand-copy strong { font: 600 15px/1.2 'Noto Serif JP', 'Noto Serif KR', serif; letter-spacing: .12em; }
.portal-brand-copy small { color: rgba(245,237,221,.53); font: 9px/1.3 'M PLUS Rounded 1c', sans-serif; letter-spacing: .18em; }
.portal-edition { gap: 10px; color: rgba(245,237,221,.66); font: 9px/1 'M PLUS Rounded 1c', sans-serif; letter-spacing: .2em; }
.portal-live-dot, .story-card-status i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #dfc18d; box-shadow: 0 0 11px rgba(229,200,149,.75); }
.portal-edition-line { width: 30px; height: 1px; background: rgba(245,237,221,.24); }
.portal-intro { width: min(100%, 1200px); margin: clamp(28px, 5.2vh, 58px) auto clamp(25px, 4.5vh, 48px); animation: portal-rise .8s .08s both; }
.portal-eyebrow { gap: 11px; margin: 0 0 14px; color: var(--portal-gold); font: 10px/1 'M PLUS Rounded 1c', sans-serif; letter-spacing: .2em; }
.portal-eyebrow i { width: 24px; height: 1px; background: rgba(229,200,149,.58); }
.portal-eyebrow span:last-child { color: rgba(245,237,221,.56); letter-spacing: .08em; }
.portal-intro h1 { margin: 0; color: #fff8eb; font: 300 clamp(34px, 4.3vw, 59px)/1.23 'Noto Serif JP', 'Noto Serif KR', serif; letter-spacing: .1em; text-shadow: 0 8px 34px rgba(0,0,0,.33); }
.portal-intro h1 em { color: var(--portal-gold); font-style: normal; }
.portal-description { margin: 13px 0 0; color: rgba(245,237,221,.7); font: 13px/1.8 'M PLUS Rounded 1c', sans-serif; letter-spacing: .045em; }
.portal-library { width: min(100%, 1200px); margin: 0 auto; animation: portal-rise .8s .18s both; }
.portal-section-heading { gap: 14px; margin: 0 0 13px; color: rgba(245,237,221,.68); font: 9px/1 'M PLUS Rounded 1c', sans-serif; letter-spacing: .17em; white-space: nowrap; }
.portal-section-heading > span:first-child { color: var(--portal-gold); }
.portal-section-heading > span:last-child { color: rgba(245,237,221,.4); }
.portal-section-heading b { color: var(--portal-gold); font-weight: 500; }
.portal-section-rule { width: 100%; height: 1px; background: linear-gradient(90deg, rgba(229,200,149,.4), rgba(229,200,149,.06)); }
.portal-cards { display: grid; grid-template-columns: 1.38fr .86fr .86fr; gap: 13px; }
.story-card { position: relative; display: block; min-width: 0; height: clamp(250px, 35vh, 345px); overflow: hidden; isolation: isolate; border: 1px solid rgba(246,231,202,.24); background: #17222a; color: var(--portal-paper); text-align: left; }
.story-card-link { width: 100%; color: inherit; font: inherit; text-decoration: none; cursor: pointer; }
.story-card-image, .story-card-vignette { position: absolute; inset: 0; z-index: -2; }
.story-card-image { background-position: center; background-size: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .6s; }
.story-card-featured .story-card-image { background-image: url("assets/cg/cg_meeting.png"); background-position: 60% center; }
.story-card-library .story-card-image { background-image: url("assets/cg/cg_library.png"); background-position: 64% center; filter: saturate(.66) brightness(.72); }
.story-card-ending .story-card-image { background-image: url("assets/cg/cg_ending.png"); background-position: center; filter: saturate(.58) brightness(.68); }
.story-card-vignette { z-index: -1; background: linear-gradient(0deg, rgba(8,13,17,.94) 0%, rgba(9,15,20,.76) 35%, rgba(9,15,20,.05) 100%), linear-gradient(90deg, rgba(9,15,20,.28), transparent 70%); }
.story-card-featured::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(245,237,221,.18); pointer-events: none; transition: inset .35s, border-color .35s; }
.story-card-index { position: absolute; top: 19px; left: 20px; color: rgba(255,249,236,.86); font: 9px/1 'M PLUS Rounded 1c', sans-serif; letter-spacing: .16em; text-shadow: 0 2px 12px #000; }
.story-card-index i { padding: 0 5px; color: var(--portal-gold); font-style: normal; }
.story-card-content { position: absolute; left: 23px; right: 22px; bottom: 20px; display: flex; align-items: flex-start; flex-direction: column; }
.story-card-featured .story-card-content { left: 29px; bottom: 23px; }
.story-card-kicker { color: var(--portal-gold); font: 9px/1.4 'M PLUS Rounded 1c', sans-serif; letter-spacing: .2em; }
.story-card-title { margin-top: 8px; color: #fff8ec; font: 500 clamp(20px, 2.1vw, 29px)/1.35 'Noto Serif JP', 'Noto Serif KR', serif; letter-spacing: .08em; text-shadow: 0 2px 18px rgba(0,0,0,.55); }
.story-card-featured .story-card-title { font-size: clamp(25px, 2.8vw, 37px); }
.story-card-subtitle { margin-top: 2px; color: rgba(245,237,221,.65); font: 11px/1.6 'Noto Serif JP', serif; letter-spacing: .14em; }
.story-card-summary { max-width: 88%; margin-top: 10px; color: rgba(255,249,239,.78); font: 11px/1.7 'M PLUS Rounded 1c', sans-serif; letter-spacing: .03em; }
.story-card-action { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 238px; margin-top: 15px; padding: 10px 0 0; border-top: 1px solid rgba(245,237,221,.33); color: #f2dbb0; font: 10px/1 'M PLUS Rounded 1c', sans-serif; letter-spacing: .12em; transition: max-width .35s, color .25s; }
.story-card-action b { font-size: 17px; font-weight: 400; }
.story-card-stamp { position: absolute; top: 19px; right: 20px; display: grid; place-content: center; width: 42px; height: 42px; border: 1px solid rgba(229,200,149,.65); border-radius: 50%; color: var(--portal-gold); font: 14px/1.1 'Noto Serif JP', serif; text-align: center; transform: rotate(8deg); }
.story-card-stamp small { margin-top: 2px; font: 7px/1 'M PLUS Rounded 1c', sans-serif; letter-spacing: .12em; }
.story-card-status { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: rgba(245,237,221,.66); font: 10px/1.5 'M PLUS Rounded 1c', sans-serif; letter-spacing: .04em; }
.story-card-status i { width: 5px; height: 5px; opacity: .62; }
.story-card-lock { position: absolute; top: 18px; right: 18px; color: rgba(245,237,221,.65); font-size: 18px; }
.story-card-upcoming { border-color: rgba(246,231,202,.14); }
.story-card-upcoming::after { content: ""; position: absolute; inset: 0; background: rgba(12,19,25,.12); pointer-events: none; }
.story-card-link:hover .story-card-image { transform: scale(1.045); }
.story-card-link:hover::after { inset: 5px; border-color: rgba(229,200,149,.62); }
.story-card-link:hover .story-card-action { max-width: 270px; color: #fff3d9; }
.story-card-link:focus-visible { outline: 2px solid #f3d69d; outline-offset: 4px; }
.portal-footer { width: min(100%, 1200px); justify-content: space-between; gap: 16px; margin: auto auto 0; padding-top: 20px; color: rgba(245,237,221,.42); font: 8px/1.5 'M PLUS Rounded 1c', sans-serif; letter-spacing: .12em; animation: portal-rise .8s .26s both; }
.portal-footer-mark { color: rgba(229,200,149,.75); font: 10px/1.4 'Noto Serif JP', serif; letter-spacing: .09em; }
.portal-footer-mark i { margin-left: 6px; font-style: normal; }
@keyframes portal-rise { from { opacity: 0; transform: translateY(13px); } to { opacity: 1; transform: translateY(0); } }

@media (max-height: 700px) and (min-width: 769px) {
    .portal-intro { margin-top: 22px; margin-bottom: 20px; }
    .portal-intro h1 { font-size: clamp(32px, 4vw, 48px); }
    .story-card { height: 250px; }
    .portal-footer { padding-top: 12px; }
}
@media (max-width: 900px) {
    .portal-cards { grid-template-columns: 1.2fr 1fr; }
    .story-card-featured { grid-row: span 2; height: 100%; min-height: 360px; }
    .story-card-upcoming { height: 173px; }
    .story-card-upcoming .story-card-content { left: 17px; bottom: 14px; }
    .story-card-upcoming .story-card-title { font-size: 20px; }
    .story-card-upcoming .story-card-status { margin-top: 9px; }
}
@media (max-width: 600px) {
    .story-portal { padding: 17px 20px 16px; }
    .portal-grain { margin: 6px; }
    .portal-brand-mark { width: 32px; height: 32px; font-size: 18px; }
    .portal-brand-copy strong { font-size: 13px; }
    .portal-brand-copy small { font-size: 7px; }
    .portal-edition { gap: 7px; font-size: 7px; letter-spacing: .12em; }
    .portal-edition-line { width: 14px; }
    .portal-intro { margin: 34px 0 27px; }
    .portal-eyebrow { font-size: 8px; gap: 8px; }
    .portal-intro h1 { font-size: clamp(35px, 10vw, 48px); }
    .portal-description { font-size: 11px; }
    .portal-section-heading { gap: 8px; font-size: 7px; letter-spacing: .1em; }
    .portal-cards { grid-template-columns: 1fr 1fr; gap: 9px; }
    .story-card-featured { grid-column: 1 / -1; grid-row: auto; height: 290px; min-height: 0; }
    .story-card-upcoming { height: 172px; }
    .story-card-index { top: 13px; left: 14px; font-size: 7px; }
    .story-card-content { left: 13px; right: 12px; bottom: 14px; }
    .story-card-featured .story-card-content { left: 19px; bottom: 17px; }
    .story-card-featured .story-card-title { font-size: 27px; }
    .story-card-title { font-size: 17px; }
    .story-card-kicker { font-size: 7px; letter-spacing: .15em; }
    .story-card-summary { font-size: 9px; margin-top: 7px; }
    .story-card-action { margin-top: 11px; padding-top: 8px; font-size: 9px; }
    .story-card-stamp { top: 13px; right: 14px; width: 36px; height: 36px; font-size: 12px; }
    .story-card-lock { top: 11px; right: 12px; font-size: 15px; }
    .story-card-status { font-size: 8px; gap: 5px; }
    .portal-footer { align-items: flex-start; flex-wrap: wrap; gap: 5px 14px; padding-top: 18px; font-size: 7px; }
    .portal-footer > span:nth-child(2) { display: none; }
    .portal-footer-mark { margin-left: auto; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    .story-portal, .story-portal *, .story-portal *::before, .story-portal *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
