/* personal site — "evolve the current look": pixel-window + teal/beige, but
   layered up, cluttered, cozy. */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: #626262;
    background-image:
        linear-gradient(45deg, #6d6d6d 25%, transparent 25%),
        linear-gradient(-45deg, #6d6d6d 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #6d6d6d 75%),
        linear-gradient(-45deg, transparent 75%, #6d6d6d 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #222;
    min-height: 100vh;
    padding: 24px 14px 60px;
}
a { color: #7a3b3f; }
a:visited { color: #5c4f45; }
img { max-width: 100%; }

.shell {
    max-width: 1000px;
    margin: 0 auto;
    background: #cde4bc;
    border: 4px double #626262;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.35);
}

.titlebar {
    background: repeating-linear-gradient(90deg, #e26a73, #e26a73 10px, #b3a190 10px, #b3a190 20px);
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.titlebar .t {
    background: #fff8ee; padding: 3px 14px; font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem; color: #7a3b3f; border: 2px solid #626262;
}
.titlebar .btns span {
    display: inline-block; width: 16px; height: 14px; background: #fff8ee;
    border: 2px solid #626262; text-align: center; line-height: 12px; font-size: 0.7rem;
}

/* narrow blinkies scrolling sideways where the text marquee used to be */
.blinkie-marquee {
    background: #2b2b2b; border-top: 2px solid #b3a190; border-bottom: 2px solid #b3a190;
    overflow: hidden;
}
.bm-track {
    display: flex; align-items: center; gap: 6px; width: max-content; padding: 4px 0;
    animation: scroll-x 40s linear infinite;
}
.blinkie-marquee:hover .bm-track { animation-play-state: paused; }
.bm-track img { height: 20px; image-rendering: pixelated; flex: 0 0 auto; }
@keyframes scroll-x { to { transform: translateX(-33.333%); } }

/* wider stamps scrolling along the bottom of the page */
.stamp-marquee {
    background: #2b2b2b; border-top: 3px solid #b3a190; border-bottom: 3px solid #b3a190;
    overflow: hidden;
}
.sm-track {
    display: flex; align-items: center; gap: 10px; width: max-content; padding: 8px 0;
    animation: scroll-x2 55s linear infinite;
}
.stamp-marquee:hover .sm-track { animation-play-state: paused; }
.sm-track img { height: 46px; image-rendering: pixelated; flex: 0 0 auto; border: 1px solid #626262; }
@keyframes scroll-x2 { to { transform: translateX(-16.666%); } }

.nav {
    background: #b3a190; padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px 6px;
    border-bottom: 3px solid #626262;
}
.nav a {
    background: #fff8ee; border: 2px solid #626262; color: #7a3b3f; text-decoration: none;
    font-family: 'Press Start 2P', monospace; font-size: 0.6rem; padding: 6px 8px;
}
.nav a:hover { background: #e26a73; color: #fff8ee; }
.lang-switch { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.lang-switch a { padding: 6px 6px; font-size: 0.55rem; background: #cde4bc; }
.lang-switch a.on { background: #7a3b3f; color: #fff8ee; }
@media (max-width: 560px) { .lang-switch { margin-left: 0; } }

.layout { display: flex; gap: 20px; padding: 22px; align-items: flex-start; }
.main { flex: 1 1 auto; min-width: 0; }
.sidebar { flex: 0 0 250px; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 780px) {
    .layout { flex-direction: column; padding: 16px; }
    .sidebar { flex-basis: auto; width: 100%; }
}

/* framed boxes, hand-placed */
.box {
    background: #fff8ee; border: 3px solid #b3a190; padding: 14px 16px;
    box-shadow: 4px 4px 0 #626262; position: relative;
}
.box + .box { margin-top: 0; }
.box::before {
    content: ""; position: absolute; top: -10px; left: 50%;
    width: 60px; height: 18px; transform: translateX(-50%) rotate(-3deg);
    background: rgba(226,106,115,0.55); border: 1px dashed #7a3b3f;
}
.box-title {
    font-family: 'Press Start 2P', monospace; font-size: 0.62rem; color: #7a3b3f;
    text-align: center; margin-bottom: 10px;
}
.sidebar .box:nth-child(odd) { transform: rotate(-1deg); }
.sidebar .box:nth-child(even) { transform: rotate(1deg); }

h1 {
    font-family: 'Press Start 2P', monospace; font-size: 1rem; color: #7a3b3f;
    margin-bottom: 10px; line-height: 1.5;
}
h2 { font-family: 'Press Start 2P', monospace; font-size: 0.8rem; color: #7a3b3f; margin: 22px 0 10px; }
.blink { animation: blinker 1.1s step-start infinite; }
@keyframes blinker { 50% { opacity: 0; } }
hr.dots { border: none; border-top: 3px dotted #b3a190; margin: 16px 0; }

.avatar-frame {
    width: 108px; height: 108px; float: right; margin: 0 0 10px 14px;
    border: 4px solid #b3a190; background: #fff8ee; overflow: hidden; box-shadow: 3px 3px 0 #626262;
}
.avatar-frame img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

.tagline { font-size: 1.3rem; color: #4a4a4a; margin-bottom: 6px; }
.lang-tag {
    display: inline-block; background: #e26a73; color: #fff8ee; font-size: 0.65rem;
    font-family: 'Press Start 2P', monospace; padding: 2px 6px; margin-right: 6px; vertical-align: middle;
}
.note p { margin-bottom: 8px; line-height: 1.5; }
.jp { font-family: 'Noto Sans JP', 'VT323', sans-serif; }

.links { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.link {
    display: flex; align-items: center; gap: 12px; background: #fff8ee; border: 3px solid #b3a190;
    padding: 9px 12px; text-decoration: none; color: #222; box-shadow: 3px 3px 0 #626262;
}
.link:active { box-shadow: 1px 1px 0 #626262; transform: translate(2px,2px); }
.link .emoji {
    font-size: 1.3rem; width: 38px; height: 38px; flex-shrink: 0; display: flex;
    align-items: center; justify-content: center; background: #cde4bc; border: 2px solid #626262;
}
.link strong { display: block; font-family: 'Press Start 2P', monospace; font-size: 0.6rem; margin-bottom: 3px; color: #7a3b3f; }
.link small { color: #555; font-size: 1rem; }


/* now playing */
.np { display: flex; gap: 10px; align-items: center; }
.np img { width: 52px; height: 52px; border: 2px solid #626262; object-fit: cover; flex-shrink: 0; }
.np .track { font-size: 1.05rem; line-height: 1.25; }
.np .track b { display: block; }
.np-status { font-size: 0.9rem; color: #7a3b3f; }
.np-live { color: #3b7a3f; }
.np-live::before { content: "● "; animation: blinker 1.4s step-start infinite; }

/* mini lists in sidebar */
.mini { list-style: none; font-size: 1.05rem; }
.mini li { padding: 4px 0; border-bottom: 1px dotted #b3a190; }
.mini li:last-child { border-bottom: none; }
.mini .sec { font-size: 0.8rem; color: #888; }
.gb-peek p { font-size: 1rem; margin-bottom: 8px; line-height: 1.35; }
.gb-peek .who { color: #7a3b3f; }

/* blog */
.post-list { list-style: none; }
.post-list li { padding: 10px 0; border-bottom: 2px dotted #b3a190; }
.post-list a { font-size: 1.35rem; text-decoration: none; }
.post-list .meta { display: block; font-size: 0.95rem; color: #777; }

.post-body { line-height: 1.6; font-size: 1.2rem; }
.post-body p { margin: 12px 0; }
.post-body h1, .post-body h2, .post-body h3 { font-family: 'Press Start 2P', monospace; color: #7a3b3f; margin: 22px 0 10px; line-height: 1.5; }
.post-body h1 { font-size: 1rem; } .post-body h2 { font-size: 0.85rem; } .post-body h3 { font-size: 0.72rem; }
.post-body img, .post-body video, .post-body audio { display: block; margin: 14px auto; border: 3px solid #b3a190; box-shadow: 4px 4px 0 #626262; max-width: 100%; }
.post-body blockquote { border-left: 4px solid #e26a73; padding-left: 12px; color: #555; margin: 12px 0; }
.post-body pre { background: #2b2b2b; color: #8fe36b; padding: 12px; overflow-x: auto; border: 2px solid #b3a190; }
.post-body code { background: #e7dcc6; padding: 1px 4px; }
.post-body pre code { background: none; padding: 0; }
.post-meta { font-size: 1rem; color: #777; margin-bottom: 14px; }

/* certificate hall — corkboard */
.corkboard {
    background: #c9a66b;
    background-image:
        radial-gradient(rgba(0,0,0,0.14) 1px, transparent 1.5px),
        radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1.5px);
    background-size: 7px 7px, 11px 11px;
    background-position: 0 0, 3px 4px;
    border: 6px ridge #7a5a33;
    padding: 26px 18px;
    display: flex; flex-wrap: wrap; gap: 26px 20px; justify-content: center;
}
.polaroid {
    background: #fff8ee; padding: 10px 10px 12px; width: 200px; cursor: zoom-in;
    box-shadow: 4px 6px 12px rgba(0,0,0,0.4); position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.polaroid:nth-child(4n+1) { transform: rotate(-3deg); }
.polaroid:nth-child(4n+2) { transform: rotate(2deg); }
.polaroid:nth-child(4n+3) { transform: rotate(-1.5deg); }
.polaroid:nth-child(4n+4) { transform: rotate(3deg); }
.polaroid:hover, .polaroid:focus {
    transform: rotate(0) scale(1.05); z-index: 3; outline: none;
    box-shadow: 6px 10px 20px rgba(0,0,0,0.5);
}
.polaroid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; border: 1px solid #b3a190; }
.polaroid figcaption { font-size: 1rem; text-align: center; margin-top: 8px; color: #4a4a4a; }
.polaroid .pin {
    position: absolute; top: -11px; left: 50%; width: 18px; height: 18px; border-radius: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle at 35% 30%, #ff9aa2, #e26a73 55%, #a83b45);
    box-shadow: 0 3px 4px rgba(0,0,0,0.45);
}
.polaroid:nth-child(3n+2) .pin { background: radial-gradient(circle at 35% 30%, #a9d3ff, #4c9ad6 55%, #2c6790); }
.polaroid:nth-child(3n+3) .pin { background: radial-gradient(circle at 35% 30%, #c9f28c, #7bbf3f 55%, #4c7a26); }

.cert-lightbox {
    position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center; padding: 28px; cursor: zoom-out;
}
.cert-lightbox[hidden] { display: none; }
.cert-lightbox-inner {
    max-width: 860px; width: 100%; background: #cde4bc;
    border: 4px double #626262; box-shadow: 8px 8px 0 rgba(0,0,0,0.4); cursor: default;
}
.cert-lightbox-bar {
    background: repeating-linear-gradient(90deg, #e26a73, #e26a73 10px, #b3a190 10px, #b3a190 20px);
    padding: 8px; display: flex; justify-content: space-between; align-items: center;
}
.cert-lightbox-bar span { background: #fff8ee; padding: 3px 12px; font-family: 'Press Start 2P', monospace; font-size: 0.6rem; color: #7a3b3f; border: 2px solid #626262; }
.cert-lightbox-bar button { font-family: 'Press Start 2P', monospace; font-size: 0.6rem; background: #fff8ee; border: 2px solid #626262; padding: 4px 8px; cursor: pointer; }
.cert-lightbox img { width: 100%; display: block; padding: 12px; }

/* ctf writeups */
.writeup { margin: 26px 0; padding-top: 8px; border-top: 3px dotted #b3a190; }
.writeup > h2 {
    background: #2b2b2b; color: #8fe36b; font-size: 0.8rem; padding: 8px 12px;
    margin: 0 0 12px; transform: none; scroll-margin-top: 12px;
}
.box.toc { transform: rotate(-0.5deg); }
.box.toc .mini a { color: #7a3b3f; }

/* guestbook */
.gb-form { display: flex; flex-direction: column; gap: 10px; }
.gb-form input, .gb-form textarea {
    font-family: 'VT323', monospace; font-size: 1.15rem; padding: 8px 10px;
    border: 3px solid #b3a190; background: #fff8ee;
}
.gb-form textarea { min-height: 90px; resize: vertical; }
.gb-form .hp { position: absolute; left: -9999px; }
.gb-form button {
    align-self: flex-start; font-family: 'Press Start 2P', monospace; font-size: 0.7rem;
    padding: 10px 16px; background: #e26a73; color: #fff8ee; border: 3px solid #626262; cursor: pointer;
    box-shadow: 3px 3px 0 #626262;
}
.gb-entry { background: #fff8ee; border: 3px solid #b3a190; padding: 12px 14px; margin-bottom: 12px; box-shadow: 3px 3px 0 #626262; }
.gb-entry:nth-child(odd) { transform: rotate(-0.4deg); }
.gb-entry .head { font-size: 1rem; color: #7a3b3f; margin-bottom: 6px; }
.gb-entry .msg { line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.flash { background: #cde4bc; border: 2px dashed #4c9a2a; padding: 8px 12px; margin-bottom: 12px; }

footer { text-align: center; padding: 18px; font-size: 1rem; color: #eee; }
.footer-in { border-top: 3px dotted #b3a190; padding-top: 12px; color: #555; }

/* cursor sparkle */
.sparkle { position: fixed; width: 8px; height: 8px; pointer-events: none; background: #fff8ee;
    border: 1px solid #e26a73; transform: rotate(45deg); z-index: 999; animation: fade 700ms linear forwards; }
@keyframes fade { to { opacity: 0; transform: rotate(45deg) scale(0.2) translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .sparkle, .bm-track, .sm-track, .blink, .np-live::before, .sticker { animation: none !important; } }

/* ---------- extra clutter / texture ---------- */

/* the checkerboard body wallpaper stays put while the page scrolls
   (nekoweb-style background-attachment: fixed) */
body {
    position: relative;
    background-attachment: fixed;
}

.shell {
    position: relative; z-index: 1;
    border-color: #4a4a4a #2f2f2f #2f2f2f #4a4a4a;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.4), 0 0 0 3px #b3a190 inset;
    background-image:
        repeating-linear-gradient(0deg, rgba(0,0,0,0.02) 0 1px, transparent 1px 4px);
}

/* decoration layer — runs down the side margins and SCROLLS with the page
   (only the body wallpaper is fixed). */
.decor {
    position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.sticker {
    position: absolute; font-size: 2.2rem; line-height: 1;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.35));
    animation: wobble 6s ease-in-out infinite;
}
.sticker.s1 { top: 60px;   left: 3%;  color: #ffd94a; }
.sticker.s2 { top: 20px;   right: 6%; color: #e26a73; animation-delay: -1s; }
.sticker.s3 { top: 900px;  left: 2%;  color: #e26a73; animation-delay: -2s; }
.sticker.s4 { top: 1500px; right: 3%; color: #8fe36b; animation-delay: -3s; }
.sticker.s5 { top: 2200px; right: 8%; animation-delay: -1.5s; }
.sticker.s6 { top: 2600px; left: 7%;  animation-delay: -2.5s; }
.sticker.s7 { top: 500px;  right: 2%; color: #a9d3ff; animation-delay: -0.5s; }
.sticker.s8 { top: 1800px; left: 4%;  color: #ffd94a; animation-delay: -3.5s; }
@keyframes wobble { 0%,100% { rotate: -6deg; } 50% { rotate: 6deg; } }

/* only show the margin stickers when there's room for them */
@media (max-width: 1240px) { .decor { display: none; } }

/* status strip under the nav */
.statusbar {
    display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center;
    background: #2b2b2b; color: #cbe8b8; font-size: 1rem;
    padding: 4px 12px; border-bottom: 3px solid #626262;
}
.statusbar b { color: #ffd94a; letter-spacing: 1px; }

/* boxes: messier tape, alternating tilt already set; add a second strip */
.box:nth-child(2n)::after {
    content: ""; position: absolute; bottom: -8px; right: 14px;
    width: 46px; height: 16px; transform: rotate(6deg);
    background: rgba(143,227,107,0.5); border: 1px dashed #4c7a26;
}
.box:nth-child(5n)::after { left: 18px; right: auto; rotate: -8deg; background: rgba(160,190,255,0.5); border-color: #3a5aa0; }
.box:nth-child(3n)::before { background: rgba(255,217,74,0.5); border-color: #a8791a; rotate: 4deg; }
.box:nth-child(3n) .box-title { transform: rotate(-1deg); }
.sidebar .box:nth-child(3n+1) { transform: rotate(-2deg); }
.sidebar .box:nth-child(3n+2) { transform: rotate(1.5deg); }
.sidebar .box:nth-child(3n) { transform: rotate(-0.5deg); }

/* headings sit a touch crooked */
.main > h1 { transform: rotate(-1.5deg); display: inline-block; }
.main h2 { transform: rotate(0.6deg); }

/* torn paper divider before the footer */
.torn {
    height: 16px; margin-top: 4px;
    background: #fff8ee;
    -webkit-mask: radial-gradient(10px at 10px 18px, transparent 96%, #000) repeat-x 0 0 / 22px 16px;
            mask: radial-gradient(10px at 10px 18px, transparent 96%, #000) repeat-x 0 0 / 22px 16px;
}

.footer-in .webring { font-size: 1rem; color: #cbb; margin-top: 6px; }
footer { padding: 14px 18px 26px; }

.intro-blurb { font-size: 1.2rem; line-height: 1.5; margin: 10px 0 4px; color: #3a3a3a; }

/* clickable language lines -> translation */
.lang { margin-bottom: 8px; }
.lang > summary {
    cursor: pointer; list-style: none; line-height: 1.5;
}
.lang > summary::-webkit-details-marker { display: none; }
.lang > summary:hover { background: #f3e8d0; }
.lang .tr-hint {
    font-family: 'Press Start 2P', monospace; font-size: 0.5rem; color: #7a3b3f;
    background: #cde4bc; border: 1px solid #7a3b3f; padding: 2px 5px; margin-left: 6px;
    white-space: nowrap; vertical-align: middle;
}
.lang .tr-hint::after { content: " ▾"; }
.lang[open] .tr-hint::after { content: " ▴"; }
.lang .tr {
    margin: 6px 0 0 34px; padding: 6px 10px; font-size: 1.05rem; color: #444;
    border-left: 3px solid #e26a73; background: #f6efe0;
}

/* pixel-heart divider you can drop in content: <hr class="hearts"> */
hr.hearts {
    border: none; height: 14px; margin: 18px 0;
    background-image: radial-gradient(circle at 4px 6px, #e26a73 3px, transparent 4px),
                      radial-gradient(circle at 10px 6px, #e26a73 3px, transparent 4px),
                      radial-gradient(circle at 7px 10px, #e26a73 3px, transparent 4px);
    background-size: 22px 14px; background-repeat: repeat-x;
}
