/* ============================================
   ALPHA Portfolio — Editorial
   Paper, ink, and one brick-red accent.
   ============================================ */

:root {
    --paper: #f3efe6;
    --paper-2: #ebe6da;
    --ink: #1b1a17;
    --ink-2: #4a4740;
    --ink-3: #8a857a;
    --rule: #d6d0c2;
    --accent: #b5441f;
    --accent-ink: #f3efe6;

    --serif: "Instrument Serif", "Times New Roman", serif;
    --sans: "Geist", system-ui, -apple-system, sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

    --gutter: clamp(16px, 4vw, 48px);
    --max: 1240px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme="dark"] {
    --paper: #151412;
    --paper-2: #1d1c19;
    --ink: #ece7dc;
    --ink-2: #b8b2a5;
    --ink-3: #7c776c;
    --rule: #2f2d28;
    --accent: #e0703f;
    --accent-ink: #151412;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

ul {
    list-style: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

/* Logo is a dark-on-light mark in some contexts; keep it neutral */
[data-theme="dark"] .nav-logo-img,
[data-theme="dark"] .footer-logo-img,
[data-theme="dark"] .splash-logo,
[data-theme="dark"] .about-logo {
    filter: invert(1) hue-rotate(180deg);
}

/* ============================================
   Splash
   ============================================ */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: var(--paper);
    transition: opacity 0.6s var(--ease), visibility 0.6s;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: rise 0.8s var(--ease) both;
}

.splash-logo {
    width: 44px;
    height: 44px;
}

.splash-text {
    font-family: var(--serif);
    font-size: 56px;
    line-height: 1;
    letter-spacing: 0.02em;
}

.splash-subtitle {
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
}

.loading-bar {
    width: 140px;
    height: 1px;
    margin-top: 12px;
    background: var(--rule);
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: var(--ink);
    animation: load 1.1s var(--ease) forwards;
    transform-origin: left;
}

@keyframes load {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ============================================
   Navigation
   ============================================ */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--paper);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

nav.scrolled {
    border-bottom-color: var(--rule);
}

.nav-container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 18px var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo-img {
    width: 26px;
    height: 26px;
}

.nav-logo-text {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.14em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a {
    position: relative;
    font-size: 14px;
    color: var(--ink-2);
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--ink);
}

.nav-links a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 1px;
    background: var(--accent);
}

.nav-controls {
    display: flex;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid var(--rule);
}

/* Two-option text switch (EN/ID, Light/Dark) */
.switch {
    position: relative;
    display: inline-flex;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid var(--rule);
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-opt {
    padding: 4px 8px;
    color: var(--ink-3);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.switch input:not(:checked) ~ .opt-a,
.switch input:checked ~ .opt-b {
    background: var(--ink);
    color: var(--paper);
}

.switch input:focus-visible ~ .switch-opt {
    outline: 1px solid var(--accent);
}

.menu-toggle {
    display: none;
    width: 28px;
    height: 20px;
    position: relative;
    cursor: pointer;
}

.menu-toggle span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: var(--ink);
    transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}

.menu-toggle span:nth-child(1) { top: 6px; }
.menu-toggle span:nth-child(2) { top: 13px; }

.menu-toggle.active span:nth-child(1) { top: 10px; transform: rotate(45deg); }
.menu-toggle.active span:nth-child(2) { top: 10px; transform: rotate(-45deg); }

/* ============================================
   Layout
   ============================================ */
section {
    max-width: var(--max);
    margin: 0 auto;
    padding: 120px var(--gutter) 0;
}

.section-head {
    display: grid;
    grid-template-columns: 200px 1fr;
    align-items: baseline;
    gap: 24px;
    padding-bottom: 28px;
    margin-bottom: 56px;
    border-bottom: 1px solid var(--ink);
}

.section-num {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--accent);
}

.section-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(44px, 6vw, 80px);
    line-height: 1;
    letter-spacing: -0.01em;
}

/* ============================================
   Hero
   ============================================ */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 120px;
    padding-bottom: 80px;
    position: relative;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-role {
    color: var(--ink);
}

.caret {
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 3px;
    vertical-align: -2px;
    background: var(--accent);
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.hero h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(64px, 14vw, 200px);
    line-height: 0.9;
    letter-spacing: -0.025em;
    margin: 28px 0 56px;
}

.hero h1 em {
    font-style: italic;
    color: var(--accent);
}

.hero-bottom {
    display: grid;
    grid-template-columns: 1.4fr 1fr auto;
    gap: 48px;
    align-items: end;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
}

.hero-description {
    max-width: 44ch;
    font-size: 19px;
    color: var(--ink-2);
}

.hero-focus {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-2);
}

.hero-focus li {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--rule);
}

.hero-focus .idx {
    width: 28px;
    color: var(--ink-3);
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--ink);
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background: var(--ink);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.btn-secondary:hover {
    background: var(--ink);
    color: var(--paper);
}

.scroll-indicator {
    position: absolute;
    left: var(--gutter);
    bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-3);
}

.scroll-line {
    width: 48px;
    height: 1px;
    background: var(--ink-3);
}

/* ============================================
   About
   ============================================ */
.about-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
}

.about-image {
    align-self: start;
}

.about-frame {
    width: 140px;
    aspect-ratio: 1;
    padding: 28px;
    border: 1px solid var(--rule);
    background: var(--paper-2);
}

.about-logo {
    width: 100%;
    height: 100%;
}

.about-image figcaption {
    margin-top: 10px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-3);
}

.about-text {
    max-width: 760px;
}

.about-text h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(30px, 3.4vw, 42px);
    line-height: 1.15;
    margin-bottom: 24px;
}

.about-text p {
    color: var(--ink-2);
    margin-bottom: 16px;
    max-width: 62ch;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 48px;
    border-top: 1px solid var(--rule);
}

.stat-item {
    padding: 20px 20px 0 0;
}

.stat-item + .stat-item {
    padding-left: 20px;
    border-left: 1px solid var(--rule);
}

.stat-number {
    font-family: var(--serif);
    font-size: clamp(48px, 6vw, 72px);
    line-height: 1;
}

.stat-label {
    margin-top: 8px;
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
}

/* ============================================
   Skills
   ============================================ */
.skill-card {
    display: grid;
    grid-template-columns: 200px 1.1fr 1.4fr 1fr;
    gap: 24px;
    align-items: baseline;
    padding: 28px 0;
    border-bottom: 1px solid var(--rule);
    transition: background-color 0.2s ease;
}

.skill-num {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-3);
}

.skill-card h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 30px;
    line-height: 1.1;
}

.skill-card p {
    color: var(--ink-2);
    font-size: 15px;
}

.skill-tags,
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-2);
}

.skill-card:hover h3 {
    color: var(--accent);
}

/* ============================================
   Projects
   ============================================ */
.projects-tabs {
    display: flex;
    gap: 24px;
    margin: -24px 0 40px;
    padding-left: 224px;
}

.tab-btn {
    font-family: var(--mono);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover {
    color: var(--ink);
}

.tab-btn.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.featured-projects {
    display: grid;
    gap: 0;
    margin-bottom: 96px;
    border-top: 1px solid var(--rule);
}

.project-card.featured {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    padding: 40px 0;
    border-bottom: 1px solid var(--rule);
}

.project-image {
    aspect-ratio: 4 / 3;
    max-width: 160px;
    display: grid;
    place-items: center;
    background: var(--paper-2);
    border: 1px solid var(--rule);
}

.project-icon {
    font-family: var(--serif);
    font-style: italic;
    font-size: 64px;
    line-height: 1;
    color: var(--accent);
}

.project-badge {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.project-info h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(36px, 4.5vw, 56px);
    line-height: 1.05;
    margin: 8px 0 14px;
}

.project-info p {
    max-width: 58ch;
    color: var(--ink-2);
    margin-bottom: 18px;
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 20px;
}

.project-link {
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--ink);
    padding-bottom: 1px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.project-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.subsection-title {
    font-family: var(--mono);
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    padding-bottom: 16px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--ink);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 48px;
}

.projects-grid .project-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px 0;
    border-bottom: 1px solid var(--rule);
}

.projects-grid .project-card h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.1;
    margin-bottom: 6px;
}

.projects-grid .project-card p {
    font-size: 15px;
    color: var(--ink-2);
}

.projects-grid .project-card p.no-description {
    color: var(--ink-3);
    font-style: italic;
}

.projects-grid .project-links {
    margin-top: auto;
}

.loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 32px 0;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-3);
}

.spinner {
    width: 14px;
    height: 14px;
    border: 1px solid var(--rule);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Contact
   ============================================ */
.contact-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 80px;
    padding-left: 224px;
}

.contact-info h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(36px, 4vw, 52px);
    line-height: 1.05;
    margin-bottom: 14px;
}

.contact-info > p {
    color: var(--ink-2);
    margin-bottom: 36px;
}

.contact-items {
    border-top: 1px solid var(--ink);
}

.contact-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 16px;
    align-items: baseline;
    padding: 18px 0;
    border-bottom: 1px solid var(--rule);
    transition: color 0.2s ease, padding 0.3s var(--ease);
}

.contact-label {
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
}

.contact-value {
    overflow-wrap: anywhere;
}

.contact-arrow {
    color: var(--ink-3);
    transition: transform 0.3s var(--ease), color 0.2s ease;
}

.contact-item:hover {
    color: var(--accent);
    padding-left: 8px;
}

.contact-item:hover .contact-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
}

.quote-card {
    align-self: end;
    padding-left: 32px;
    border-left: 2px solid var(--accent);
}

.quote-text {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(30px, 3.2vw, 42px);
    line-height: 1.15;
}

.quote-author {
    display: block;
    margin-top: 20px;
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
}

/* ============================================
   Footer
   ============================================ */
footer {
    max-width: var(--max);
    margin: 160px auto 0;
    padding: 0 var(--gutter);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 0 36px;
    border-top: 1px solid var(--ink);
    font-size: 14px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.14em;
}

.footer-logo-img {
    width: 22px;
    height: 22px;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.social-link {
    color: var(--ink-2);
    transition: color 0.2s ease;
}

.social-link:hover {
    color: var(--accent);
}

.copyright {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-3);
}

/* ============================================
   Back to Top
   ============================================ */
.back-to-top {
    position: fixed;
    right: var(--gutter);
    bottom: 24px;
    z-index: 90;
    width: 40px;
    height: 40px;
    font-size: 16px;
    background: var(--paper);
    border: 1px solid var(--ink);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s var(--ease), visibility 0.3s, background-color 0.2s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.back-to-top:hover {
    background: var(--ink);
    color: var(--paper);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .hero-bottom {
        grid-template-columns: 1fr 1fr;
    }

    .cta-buttons {
        grid-column: 1 / -1;
        flex-direction: row;
    }

    .skill-card {
        grid-template-columns: 120px 1fr 1.4fr;
    }

    .skill-card .skill-tags {
        grid-column: 2 / -1;
    }

    .section-head,
    .about-content,
    .project-card.featured {
        grid-template-columns: 120px 1fr;
    }

    .projects-tabs,
    .contact-container {
        padding-left: 144px;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 56px;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        height: calc(100vh - 64px);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px var(--gutter) 24px;
        background: var(--paper);
        border-top: 1px solid var(--rule);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s var(--ease), visibility 0.25s;
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav-links li {
        border-bottom: 1px solid var(--rule);
    }

    .nav-links a {
        display: block;
        padding: 16px 0;
        font-family: var(--serif);
        font-size: 34px;
        color: var(--ink);
    }

    .nav-links a.active::after {
        display: none;
    }

    .nav-links a.active {
        color: var(--accent);
    }

    .nav-controls {
        border: 0;
        padding: 24px 0 0;
    }

    section {
        padding-top: 88px;
    }

    .section-head,
    .about-content,
    .project-card.featured,
    .skill-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .section-head {
        margin-bottom: 36px;
    }

    .skill-card .skill-tags {
        grid-column: auto;
    }

    .hero-bottom {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .hero h1 {
        margin: 20px 0 40px;
    }

    .about-image {
        display: none;
    }

    .projects-tabs,
    .contact-container {
        padding-left: 0;
    }

    .projects-tabs {
        margin-top: -12px;
    }

    .project-image {
        display: none;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-item {
        grid-template-columns: 1fr auto;
    }

    .contact-label {
        grid-column: 1 / -1;
    }

    .stat-item {
        padding-right: 8px;
    }

    .stat-item + .stat-item {
        padding-left: 12px;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }

    footer {
        margin-top: 112px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
