@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Poppins:wght@400;500;600&display=swap');

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

html {
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
}

:root {
    --transition: 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

/* ─── Light Mode (sakura) ─── */
html[data-theme="light"] {
    --bg: #f5f3eb;
    --text: #292d27;
    --text-secondary: #181717;
    --text-tertiary: #696d61;
    --text-quaternary: #9b9b96;
    --accent: black;
    --accent-light: rgba(17, 17, 16, 0.06);
    --link: #111110;
    --link-hover: #000000;
    --border: rgba(17, 17, 16, 0.13);
}

/* ─── Dark Mode ─── */
html[data-theme="dark"] {
    --bg: #171d19;
    --text: #e3e6d9;
    --text-secondary: #b8b8b4;
    --text-tertiary: #a0aa99;
    --text-quaternary: #5f5f5b;
    --accent: #a3c29a;
    --accent-light: rgba(235, 235, 233, 0.08);
    --link: #ebebe9;
    --link-hover: #ffffff;
    --border: rgba(235, 235, 233, 0.13);
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    position: relative;
}

/* Fallback for browsers without View Transitions: animate body bg/color */
body {
    transition: background-color 0.8s cubic-bezier(0.65, 0, 0.35, 1),
                color 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

/* View Transitions API: dancing-girl mask reveal (a la elysiajs.com).
   The new theme layer is masked through a transparent GIF of a dancing
   character — she scales in, dances for most of the animation, then
   explodes outward to fill the screen. */
::view-transition-group(root) {
    animation-timing-function: cubic-bezier(0.7, 0, 0.84, 0);
    z-index: 100;
}
::view-transition-old(root),
::view-transition-new(root) {
    animation: theme-scale 1.75s cubic-bezier(0.7, 0, 0.84, 0) both;
    mix-blend-mode: normal;
}
::view-transition-new(root) {
    -webkit-mask: url(/assets/images/shigure-ui-smol.gif) 50% / 0 no-repeat;
    mask: url(/assets/images/shigure-ui-smol.gif) 50% / 0 no-repeat;
}

@keyframes theme-scale {
    0%   { -webkit-mask-size: 0;        mask-size: 0; }
    10%  { -webkit-mask-size: 25vmax;   mask-size: 25vmax; }
    90%  { -webkit-mask-size: 25vmax;   mask-size: 25vmax; }
    100% { -webkit-mask-size: 750vmax;  mask-size: 750vmax; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) { animation: none; }
    ::view-transition-new(root) { -webkit-mask: none; mask: none; }
}

::selection {
    background: var(--accent-light);
    color: var(--text);
}

/* ═══════════════════════════════════════
   THEME TOGGLE (floating)
   ═══════════════════════════════════════ */

.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 200;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--text-quaternary);
    background: var(--bg);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    backdrop-filter: blur(20px) saturate(140%);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), color var(--transition), border-color var(--transition);
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.theme-toggle:active { transform: translateY(0) scale(0.96); }

html[data-theme="light"] .moon-icon { display: none; }
html[data-theme="dark"] .sun-icon { display: none; }

/* ═══════════════════════════════════════
   HOMEPAGE HERO (single screen)
   ═══════════════════════════════════════ */

body.home-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.hero {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 36px 24px 0;
}

.hero-content {
    max-width: 560px;
    width: 100%;
    text-align: left;
}

.hero-id {
    display: flex;
    align-items: center;
    gap: 17px;
    margin-bottom: 30px;
}

.hero-name {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.0;
    margin-bottom: 4px;
    color: var(--text);
}

@media (max-width: 640px) {
    .hero-name { font-size: 2.5rem; }
    .hero-id { gap: 13px; }
}

.hero-aka {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-bottom: 0;
    font-weight: 400;
}

.hero-bio {
    color: var(--text);
    font-size: 15.5px;
    line-height: 1.7;
    margin-bottom: 15px;
    text-align: left;
}

.hero-bio:last-of-type {
    margin-bottom: 26px;
}

.hero-bio a {
    color: var(--accent);
    font-weight: 800;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
    font-size: 15.5px;
    text-decoration-thickness: 1px;
    transition: text-decoration-color var(--transition);

}

.hero-bio a:hover {
    text-decoration-color: var(--text);
}

/* ─── Hero links ─── */
.hero-links {
    display: flex;
    align-items: center;
    gap: 26px;
    flex-wrap: wrap;
    margin-bottom: 9px;
}

.hero-links a {
    font-size: 15.5px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color var(--transition);
}

.hero-links a:hover {
    color: var(--accent);
    opacity: 1;
}

/* ═══════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════ */

h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.0;
    margin-bottom: 8px;
    color: var(--text);
}

@media (max-width: 640px) {
    h1 { font-size: 2rem; }
}

p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
    font-size: 15.5px;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--link-hover);
    opacity: 1;
}

/* Links are ink-coloured, so prose links carry an underline to read as links */
main p a {
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: text-decoration-color var(--transition);
}
main p a:hover { text-decoration-color: var(--text); }

/* ═══════════════════════════════════════
   HOME FOOTER (location + live clock)
   ═══════════════════════════════════════ */

.home-footer {
    width: 100%;
    max-width: 608px;
    margin: 0 auto;
    margin-bottom: auto;
    padding: 26px 24px 30px;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--text);
    letter-spacing: 0.01em;
    animation: fadeIn 1s ease 0.8s both;
    pointer-events: none;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 9px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    /* solid, not a fade — a gradient smears over anything scrolling under it */
    background: var(--bg);
}

.site-header > * {
    pointer-events: auto;
}

.header-logo {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    margin-top: 0.6rem;
    font-style: italic;
    color: var(--text);
    text-decoration: none;
    transition: opacity var(--transition);
}

.header-logo:hover { opacity: 0.5; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Homepage hero stagger */
.hero-id { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both; }
.hero-bio:nth-child(1 of .hero-bio) { animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both; }
.hero-bio:nth-child(2 of .hero-bio) { animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both; }
.hero-bio:nth-child(3 of .hero-bio) { animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.49s both; }
.hero-bio:nth-child(4 of .hero-bio) { animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.56s both; }
.hero-links { animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both; }
.theme-toggle { animation: fadeIn 1s ease 0.5s both; }

/* Mobile: trim blur for GPU, tighten spacing */
@media (max-width: 768px) {
    /* clear the fixed theme toggle when the hero pins to the top */
    .hero { padding-top: 40px; }

    .hero-links {
        margin-bottom: 4px;
        /* tight enough to keep the links on one row at 390px; row-gap only
           matters on the narrowest phones, where the row does wrap */
        column-gap: 13px;
        row-gap: 9px;
    }

    .hero-links a {
        font-size: 15px;
    }

    .home-footer {
        padding: 24px 24px 32px;
        gap: 6px;
        font-size: 12px;
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
