/* Bentosoft — the page is the box: black lacquer rim, vermilion lacquer compartments */

@font-face {
    font-family: "Bento Serif";
    src: url("../fonts/noto-serif-jp-700.woff") format("woff");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-400.woff") format("woff");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-600.woff") format("woff");
    font-weight: 600;
    font-display: swap;
}

:root {
    --black: #000;
    --lacquer-hi: #2b2522;
    --shu: #a32e1c;
    --shu-light: #c4462b;
    --shu-deep: #5c150c;
    --kinari: #f1e8d6;
    --ash: #a39a8f;
    --gold: #c9a35a;
    --serif: "Bento Serif", Georgia, "Noto Serif CJK JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
    --sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --gutter: clamp(16px, 5vw, 64px);
    --rim: clamp(10px, 1.2vw, 16px);       /* lacquer between compartments */
    --frame: clamp(6px, 0.8vw, 12px);      /* black space around the box */
    --lacquer:
        linear-gradient(165deg, var(--lacquer-hi) 0%, #0d0b0a 18%, #000 50%, #0f0c0b 82%, #231d1a 100%);
    --shu-fill: radial-gradient(130% 100% at 15% 0%, var(--shu-light) 0%, var(--shu) 42%, var(--shu-deep) 100%);
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--black); color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--black);
    color: var(--kinari);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }

/* ---------- shared pieces ---------- */

.seal { display: block; width: 60px; height: auto; }

.site-nav { display: flex; gap: clamp(1rem, 3vw, 2rem); }
.site-nav a {
    color: var(--ash);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--kinari); }
.site-nav a[aria-current="page"] { color: var(--kinari); border-bottom-color: var(--shu-light); }

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: auto;
    padding: 2rem var(--gutter);
    font-size: 0.85rem;
    color: var(--ash);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--kinari); }

.kanji {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 2rem;
    line-height: 1;
    ruby-position: over;
}
.kanji rt {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    opacity: 0.75;
    padding-bottom: 0.3em;
}

/* ---------- home: the whole page is the box ---------- */

.box {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 2 * var(--frame));
    min-height: calc(100dvh - 2 * var(--frame));
    margin: var(--frame);
    padding: 0 var(--rim) 0;
    border-radius: 28px;
    background: var(--lacquer);
    box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.14), inset 0 -1px 0 rgba(255, 240, 220, 0.05);
}

/* header layer: black fading to transparent, sits on top of the box.
   While scrolling, the text fades first and the backdrop after it, so the two never blur together. */
.hero-layer {
    --fg: 1;
    --bg: 1;
    position: relative;
    z-index: 5;
    margin: 0 calc(-1 * var(--rim));
    padding: clamp(1rem, 2vw, 1.5rem) var(--gutter) clamp(1.75rem, 3vw, 2.5rem);
    isolation: isolate;
}
.hero-layer::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 28px 28px 0 0;
    background: linear-gradient(to bottom, #000 0%, #000 calc(100% - 2.5rem), rgba(0, 0, 0, 0) 100%);
    opacity: var(--bg);
}
.hero-layer > * { opacity: var(--fg); }
html.js .hero-layer { position: sticky; top: 0; }
.hero-layer.is-gone { pointer-events: none; }

.hero-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.wordmark {
    margin: clamp(0.75rem, 2vw, 1.75rem) 0 0;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(3.2rem, 7.5vw, 6.75rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
}
.tagline {
    margin: 1rem 0 0;
    max-width: 60ch;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    color: var(--ash);
}

.bento {
    position: relative;
    flex: 1;
    display: grid;
    gap: var(--rim);
    grid-template-columns: 1fr 1fr minmax(200px, 0.5fr);
    grid-template-rows: minmax(220px, 1fr) minmax(180px, 1fr);
    grid-template-areas:
        "games hardware about"
        "games hardware empty";
}

/* the lid: lifts off the compartments once on load */
.bento::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    border-radius: 16px;
    background: url("../logo.svg") center / 150px auto no-repeat, var(--lacquer);
    box-shadow: inset 0 1px 0 rgba(255, 240, 220, 0.2);
    pointer-events: none;
    animation: lid-off 1.2s cubic-bezier(0.55, 0, 0.25, 1) 0.4s forwards;
}
@keyframes lid-off {
    0%   { transform: translateY(0) scale(1); opacity: 1; }
    30%  { transform: translateY(-8px) scale(1.012); opacity: 1; }
    100% { transform: translateY(-70px) scale(1.04); opacity: 0; visibility: hidden; }
}

.box-footer { margin-top: 0; padding: 1.1rem var(--gutter) 1.2rem; }

/* ---------- compartments ---------- */

.compartment {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
    padding: clamp(1.1rem, 2vw, 1.75rem);
    border-radius: 14px;
    overflow: hidden;
    color: var(--kinari);
    text-decoration: none;
    background: var(--shu-fill);
    box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.5), inset 0 -1px 0 rgba(255, 220, 200, 0.1);
}
.compartment h2 {
    margin: 0.4rem 0 0;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(1.5rem, 2.2vw, 1.9rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
}
.compartment p { margin: 0; max-width: 30ch; line-height: 1.5; }
.compartment .kanji { opacity: 0.9; }

a.compartment { transition: filter 0.25s ease; }
a.compartment:hover { filter: brightness(1.1) saturate(1.05); }
a.compartment:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 14px; }

.c-games { grid-area: games; }
.c-hardware { grid-area: hardware; }
.c-about { grid-area: about; }
.c-empty { grid-area: empty; }   /* "Bento's Story": links to the blog */
.compartment .ext { margin-top: auto; font-size: 0.8rem; opacity: 0.75; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.c-games, .c-hardware { align-items: stretch; }
.c-head { display: flex; align-items: flex-end; gap: 0.9rem; }
.c-head h2 { margin: 0; font-size: clamp(1.8rem, 2.8vw, 2.4rem); }
.c-head h2 a { text-decoration: none; }
.c-head h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.compartment .c-desc { max-width: 40ch; margin-bottom: 0.6rem; }

/* ---------- diagonal project slices ---------- */

.slices {
    --k: 34px;            /* how far each cut leans */
    --cut: 5px;           /* width of the lacquer line between slices */
    flex: 1;
    display: flex;
    min-height: 190px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.slice {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    margin-left: calc(var(--cut) - var(--k));
    clip-path: polygon(var(--k) 0, 100% 0, calc(100% - var(--k)) 100%, 0 100%);
    overflow: hidden;
    color: var(--kinari);
    text-decoration: none;
    background: #000;
    transition: flex-grow 0.5s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.slice:first-child { margin-left: 0; clip-path: polygon(0 0, 100% 0, calc(100% - var(--k)) 100%, 0 100%); }
.slice:last-child { clip-path: polygon(var(--k) 0, 100% 0, 100% 100%, 0 100%); }
.slice:only-child { clip-path: none; }

.slice img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.02);
    transition: transform 0.6s ease;
}
a.slice:hover, a.slice:focus-visible { flex-grow: 2.6; }
a.slice:hover img, a.slice:focus-visible img { transform: scale(1.07); }
a.slice:focus-visible { outline: none; }
a.slice:focus-visible::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 2px solid var(--gold);
    border-radius: 4px;
}

.slice-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.1rem 0.9rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
    white-space: nowrap;
}
.slice:first-child .slice-label { padding-left: 1.1rem; }
.slice:not(:first-child) .slice-label { padding-left: calc(var(--k) * 0.35 + 1rem); }
.slice-title {
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.2;
}
.slice-kind { overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; opacity: 0.8; }

/* placeholder slice: an empty spot waiting for the next project */
.slice-next {
    flex-grow: 0.55;
    background: var(--lacquer);
    color: rgba(241, 232, 214, 0.55);
}
.slice-next::before {
    content: "空";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    font-family: var(--serif);
    font-weight: 700;
    font-size: 3.2rem;
    color: rgba(241, 232, 214, 0.12);
}
.slice-next .slice-label { background: none; }
.slice-next .slice-title { font-size: 0.95rem; font-family: var(--sans); font-weight: 400; }

/* ---------- inner pages ---------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; }

.content {
    width: 100%;
    max-width: 48rem;
    padding: clamp(1rem, 4vw, 3rem) var(--gutter) 4rem;
}
.content-wide { max-width: 80rem; }

.back { display: inline-block; margin-bottom: 1rem; color: var(--ash); font-size: 0.95rem; text-underline-offset: 3px; }
.back:hover { color: var(--kinari); }

.page-title { display: flex; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; }
.page-title .kanji { font-size: clamp(2.4rem, 6vw, 3.6rem); color: var(--shu-light); }
.page-title h1,
.content-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(2.4rem, 7vw, 4.4rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}
.lead {
    margin: 1.5rem 0 0;
    max-width: 40ch;
    font-size: clamp(1.1rem, 2.2vw, 1.35rem);
    line-height: 1.5;
}
.lead a { text-underline-offset: 3px; }

.slices-lg { --k: 60px; --cut: 8px; height: clamp(320px, 50vh, 520px); margin-top: 2.5rem; border-radius: 16px; }
.slices-lg .slice-title { font-size: 1.6rem; }
.slices-lg .slice-label { padding-bottom: 1.3rem; }
.slices-lg .slice-next::before { font-size: 5rem; }

.panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    margin: 2.5rem 0;
    padding: 2rem;
    border-radius: 18px;
    background: var(--shu-fill);
    box-shadow:
        0 0 0 12px #0d0b0a,
        0 0 0 13px rgba(255, 240, 220, 0.08),
        inset 0 3px 12px rgba(0, 0, 0, 0.5);
}
.panel .art { filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.45)); }
.art-blade-lg { width: 100%; height: auto; transform: rotate(-5deg); }
.art-device-lg { width: min(240px, 70%); height: auto; }
.art-seal { width: 260px; max-width: 100%; height: auto; filter: none; }

.prose { max-width: 40rem; color: #d9cfbf; }
.prose h2 {
    margin: 2.75rem 0 0.6rem;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.2;
    color: var(--kinari);
}
.prose h3 { margin: 0 0 0.2rem; font-size: 1.05rem; font-weight: 600; color: var(--kinari); }
.prose p { margin: 0 0 1rem; }
.prose a { color: var(--kinari); text-underline-offset: 3px; }
.prose img { max-width: 100%; height: auto; }

.steps { list-style: none; counter-reset: step; margin: 1.25rem 0 0; padding: 0; }
.steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    column-gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(241, 232, 214, 0.12);
}
.steps li::before {
    content: counter(step);
    grid-row: span 2;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.1;
    color: var(--shu-light);
}
.steps p { margin: 0; }

.compartment-list { margin: 1rem 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.6rem 1.5rem; }
.compartment-list dt { font-weight: 600; color: var(--kinari); }
.compartment-list dd { margin: 0; }

/* the Impressum page from the first version keeps working */
.page-header { padding: 1.5rem var(--gutter); }
.wordmark-small { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; text-decoration: none; }
.content-title { margin-bottom: 2rem; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
    .bento {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: minmax(420px, auto) minmax(180px, auto);
        grid-template-areas:
            "games hardware"
            "about empty";
    }
}

@media (max-width: 700px) {
    .bento {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        grid-template-areas: "games" "hardware" "about" "empty";
    }
    /* slices stack top to bottom, cut diagonally */
    .slices { --k: 18px; flex-direction: column; min-height: 0; }
    .slice {
        flex: 0 0 auto;
        height: 150px;
        margin-left: 0;
        margin-top: calc(var(--cut) - var(--k));
        clip-path: polygon(0 var(--k), 100% 0, 100% calc(100% - var(--k)), 0 100%);
    }
    .slice:first-child { margin-top: 0; clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--k)), 0 100%); }
    .slice:last-child { clip-path: polygon(0 var(--k), 100% 0, 100% 100%, 0 100%); }
    .slice:only-child { clip-path: none; }
    .slice-next { height: 84px; }
    .slice-next::before { font-size: 2rem; }
    .slice:not(:first-child) .slice-label { padding-left: 1.1rem; }
    a.slice:hover, a.slice:focus-visible { flex-grow: 0; }
    .slices-lg { height: auto; --k: 24px; }
    .slices-lg .slice { height: 220px; }
    .slices-lg .slice-next { height: 100px; }
    .box { border-radius: 22px; }
    .hero-layer::before { border-radius: 22px 22px 0 0; }
    .site-header { flex-wrap: wrap; }
    .panel { box-shadow: 0 0 0 8px #0d0b0a, 0 0 0 9px rgba(255, 240, 220, 0.08), inset 0 3px 12px rgba(0, 0, 0, 0.5); margin-left: 8px; margin-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .bento::before { display: none; }
    * { transition: none !important; }
}

.slices-lg .slice-next .slice-title { font-size: 1rem; }
