/* ===== Variables ===== */

:root {
    --font: 'Quicksand', sans-serif;
    --speed: 0.3s;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    --bg: #f4f4f9;
    --text: #333;
    --text-secondary: #555;
    --card-bg: #fff;
    --accent: #D9534F;
    --accent-hover: #C9302C;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

html.dark-mode,
body.dark-mode {
    --bg: #121212;
    --text: #e0e0e0;
    --text-secondary: #aaa;
    --card-bg: #1e1e1e;
    --accent: #E57373;
    --accent-hover: #EF9A9A;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

html.dark-mode {
    background: var(--bg);
}

/* ===== Reset & Base ===== */

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease), opacity 0.15s ease;
    -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.card {
    position: relative;
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: min-height 0.3s var(--ease);
}

.card.expanded {
    min-height: calc(100vh - 4rem);
}

/* ===== Sticky Header ===== */

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    padding: 2rem 0 1rem;
    transition: background var(--speed) var(--ease), padding var(--speed) var(--ease);
}

.header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.header-text {
    flex: 1;
    min-width: 0;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    margin: 0;
}

.sticky-header .theme-switch {
    flex-shrink: 0;
    margin-top: 0.25rem;
}

/* ===== Back Area (inside sticky header) ===== */

#back-area {
    margin-top: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s var(--ease), margin-top 0.25s var(--ease);
}

#back-area.has-content {
    max-height: 3rem;
    margin-top: 0.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0.3rem 0.85rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), transform 0.15s var(--ease);
    cursor: pointer;
}

.back-link:hover {
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(-2px);
}

/* ===== Section Headings ===== */

h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.25rem;
}

h2::before {
    content: '';
    width: 28px;
    height: 2px;
    background: var(--accent);
    flex-shrink: 0;
}

/* ===== Shared Item Row (Work + Projects) ===== */

.item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: color var(--speed) var(--ease);
}

.item-row:hover {
    color: var(--accent);
}

.item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
}

.item-icon img {
    display: block;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-info strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
}

.item-info span {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
}

.item-info time {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.item-row > span:first-child {
    flex: 1;
    min-width: 0;
}

.item-arrow {
    font-size: 1.1rem;
    opacity: 0.4;
    transition: transform var(--speed) var(--ease), opacity var(--speed) var(--ease);
    flex-shrink: 0;
}

.item-row:hover .item-arrow {
    transform: translateX(4px);
    opacity: 1;
}

/* ===== Sections ===== */

.work { margin-bottom: 1.5rem; }

.projects {
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== Content ===== */

#content {
    flex: 1;
}

#content.swap-in {
    animation: content-enter 0.3s var(--ease) both;
}

@keyframes content-enter {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Bottom Bar ===== */

.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
    z-index: 10;
    margin-top: 2rem;
}

.card.expanded footer.bottom-bar-wrap {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 0.75rem 0 1.5rem;
    margin-top: auto;
    transition: background var(--speed) var(--ease), padding var(--speed) var(--ease);
}

.card.expanded footer.bottom-bar-wrap .bottom-bar {
    margin-top: 0;
}

.bottom-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color var(--speed) var(--ease);
}

.bottom-link:hover {
    color: var(--accent);
}

.bottom-icon {
    display: none;
    border-radius: 4px;
    vertical-align: middle;
}

.bottom-button {
    display: inline-block;
    background: var(--text);
    color: var(--card-bg);
    padding: 0.65rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease), transform 0.15s var(--ease);
}

.bottom-button:hover {
    transform: scale(1.03);
}

.privacy-notice-wrap {
    text-align: center;
    margin: 0.5rem 0 0;
}

.footer-subtle-link,
.privacy-notice-link {
    background: none;
    border: none;
    color: #888;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: currentColor;
    padding: 0;
    transition: color var(--speed) var(--ease);
}

body.dark-mode .footer-subtle-link,
body.dark-mode .privacy-notice-link {
    color: #999;
}

.footer-subtle-link:hover,
.privacy-notice-link:hover {
    color: var(--accent);
}

.footer-dot {
    color: #bbb;
    font-size: 12px;
    margin: 0 0.25rem;
}

body.dark-mode .footer-dot {
    color: #666;
}

/* ===== Privacy modal ===== */

.privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.privacy-modal[hidden] {
    display: none;
}

.privacy-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    opacity: 0;
}

.privacy-modal.is-open .privacy-modal-backdrop {
    animation: privacy-backdrop-in 0.25s var(--ease) forwards;
}

@keyframes privacy-backdrop-in {
    to { opacity: 1; }
}

.privacy-modal-box {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow: auto;
    opacity: 0;
    transform: translateY(12px);
}

.privacy-modal.is-open .privacy-modal-box {
    animation: privacy-box-in 0.35s var(--ease) forwards;
}

@keyframes privacy-box-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.privacy-modal-body {
    opacity: 0;
}

.privacy-modal.is-open .privacy-modal-body {
    animation: privacy-body-in 0.35s var(--ease) 0.08s forwards;
}

@keyframes privacy-body-in {
    to { opacity: 1; }
}

.privacy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0.5rem;
}

.privacy-modal-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.privacy-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem;
    margin: -0.15rem 0 0;
    transition: color var(--speed) var(--ease);
}

.privacy-modal-close:hover {
    color: var(--text);
}

.privacy-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.privacy-modal-body p {
    margin: 0 0 0.75rem;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.privacy-modal-body p:last-child {
    margin-bottom: 0;
}

.privacy-modal-body a {
    color: var(--accent);
    text-decoration: underline;
}

.privacy-modal-body a:hover {
    color: var(--accent-hover);
}

/* ===== Detail Page (Work + Project) ===== */

.detail-page {
    padding-bottom: 2rem;
}

.detail-page .back-link {
    display: none;
}

.detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.detail-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 1.5rem;
}

.project-hero {
    width: 100%;
    border-radius: 10px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    margin-bottom: 1.5rem;
    display: block;
}

.detail-body p {
    margin: 0 0 1rem;
    color: var(--text);
    line-height: 1.75;
    font-size: 14px;
}

.detail-body h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
}

.detail-body ul {
    padding-left: 1.25rem;
    margin: 0 0 1rem;
    color: var(--text);
}

.detail-body li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* ===== Project Actions ===== */

.project-actions {
    margin-top: 2rem;
    text-align: center;
}

.action-button {
    display: inline-block;
    background: var(--text);
    color: var(--card-bg);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background var(--speed) var(--ease), color var(--speed) var(--ease), transform 0.15s var(--ease);
}

.action-button:hover {
    transform: scale(1.03);
}

.alpha-key-block {
    margin-top: 1rem;
    font-size: 13px;
    color: var(--text-secondary);
}

.alpha-key-label {
    margin-right: 0.5rem;
}

.alpha-key-value {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.alpha-key-value code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 13px;
    color: var(--text);
}

.copy-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    transition: color var(--speed) var(--ease);
}

.copy-btn:hover {
    color: var(--accent);
}

/* ===== Scroll Fade-in Animation ===== */

.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Mobile ===== */

@media (max-width: 480px) {
    .container { padding: 1rem; }

    h1 { font-size: 1.75rem; }

    .sticky-header {
        padding: 1rem 0 0.75rem;
    }

    .bottom-bar {
        justify-content: space-around;
        padding: 0.6rem;
    }

    .bottom-text { display: none; }
    .bottom-icon { display: inline; }

    .bottom-link { padding: 0.4rem; }

    .bottom-button {
        flex: 1;
        text-align: center;
        margin-left: 0.25rem;
        padding: 0.6rem 1rem;
        font-size: 13px;
    }
}
