/* ============================================
   Template: portfolio-dev  (DEMO skin — "Jonas Berg")
   A dark, terminal/code-flavoured developer portfolio.
   One of the Codecraft Web demo templates. Persona is fictional.
   ============================================ */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #111722;
    --bg-card: #161b26;
    --bg-card-hover: #1b212e;
    --border: #232a37;
    --border-light: #303a4b;
    --text-primary: #e6edf3;
    --text-secondary: #aeb9c7;
    --text-muted: #768390;
    --accent: #22d3ee;
    --accent-secondary: #34d399;
    --accent-glow: rgba(34, 211, 238, 0.10);
    --gradient-accent: linear-gradient(135deg, #22d3ee, #34d399);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.5);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 18px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1200px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Navigation ---- */
#navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(13, 17, 23, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

#navbar.scrolled {
    border-bottom-color: var(--border);
    background: rgba(13, 17, 23, 0.9);
    box-shadow: 0 1px 16px rgba(0, 0, 0, 0.4);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.nav-logo {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.05rem;
    z-index: 1001;
}

.logo-prompt {
    color: var(--accent);
    font-weight: 700;
}

.logo-text { color: var(--text-primary); }
.logo-dot { color: var(--accent-secondary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition);
    position: relative;
}

.nav-links a:hover { color: var(--accent); }

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px; left: 0;
    width: 0; height: 2px;
    background: var(--gradient-accent);
    transition: width var(--transition);
    border-radius: 1px;
}

.nav-links a:hover::after { width: 100%; }

.lang-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--mono);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-toggle:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.lang-toggle .lang-flag.active { color: var(--accent); }
.lang-divider { color: var(--border-light); font-weight: 300; }

.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1001;
}

.nav-hamburger span {
    display: block;
    width: 24px; height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
    border-radius: 2px;
}

.nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; }
.nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ---- Hero ---- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 130px 24px 90px;
}

.hero-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.045) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(ellipse 75% 65% at 60% 35%, black 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 75% 65% at 60% 35%, black 20%, transparent 75%);
}

#hero::before {
    content: '';
    position: absolute;
    top: -25%; right: -5%;
    width: 720px; height: 720px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 62%);
    pointer-events: none;
}

.hero-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-copy { max-width: 560px; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    border: 1px solid var(--border-light);
    border-radius: 50px;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    margin-bottom: 26px;
    background: rgba(52, 211, 153, 0.06);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-secondary);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
    animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero-name {
    font-size: clamp(2.6rem, 5.5vw, 4rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}

.hero-role {
    font-family: var(--mono);
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 24px;
}

.hero-highlight {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.75;
}

.hero-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 48px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 28px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--gradient-accent);
    color: #06121a;
    box-shadow: 0 4px 22px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(34, 211, 238, 0.38);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    font-family: var(--mono);
}

.btn-outline:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--accent);
}

.btn-full { width: 100%; }

.hero-metrics {
    display: flex;
    gap: 44px;
}

.metric { display: flex; flex-direction: column; }

.metric-num {
    font-family: var(--mono);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-unit { font-size: 1.1rem; }

.metric-label {
    margin-top: 8px;
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---- Mock terminal ---- */
.terminal {
    background: #0a0e14;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(34, 211, 238, 0.04);
    overflow: hidden;
    font-family: var(--mono);
    font-size: 0.85rem;
    width: 100%;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    background: #11161f;
    border-bottom: 1px solid var(--border);
}

.tdot { width: 12px; height: 12px; border-radius: 50%; }
.tdot-red { background: #ff5f57; }
.tdot-yellow { background: #febc2e; }
.tdot-green { background: #28c840; }

.terminal-title {
    margin-left: 10px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.terminal-body {
    padding: 20px 20px 24px;
    line-height: 1.85;
}

.tline { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-prompt { color: var(--accent); font-weight: 700; margin-right: 8px; }
.t-typed { color: var(--text-primary); }
.t-ok { color: var(--accent-secondary); }

.caret {
    display: inline-block;
    width: 8px; height: 1.05em;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1.1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.t-code {
    margin: 6px 0 14px;
    padding: 12px 14px;
    background: rgba(34, 211, 238, 0.04);
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.7;
    white-space: pre;
    overflow-x: auto;
}

.t-brace { color: var(--text-muted); }
.t-key { color: var(--accent); }
.t-str { color: var(--accent-secondary); }

/* ---- Sections common ---- */
section { padding: 110px 0; }

.section-label {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 14px;
}

.section-title {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    max-width: 640px;
}

.section-lead {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    max-width: 720px;
    margin-bottom: 48px;
}

/* ---- Projects ---- */
#projects { background: var(--bg-secondary); position: relative; }

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    border-color: var(--border-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* ---- Tinted image placeholders ---- */
.img-ph {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(circle at 30% 25%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(circle at 75% 80%, rgba(52, 211, 153, 0.12), transparent 55%),
        #0e131c;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.img-ph::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
}

.img-ph svg {
    width: 46px; height: 46px;
    color: var(--accent);
    opacity: 0.5;
    position: relative;
    z-index: 1;
}

.img-ph-cap {
    position: relative;
    z-index: 1;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--text-muted);
    padding: 0 16px;
    text-align: center;
}

.project-body {
    padding: 22px 24px 26px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.project-head h3 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.project-year {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.project-problem {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 18px;
    flex: 1;
}

/* ---- Tag chips (shared) ---- */
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-family: var(--mono);
    padding: 4px 11px;
    background: rgba(34, 211, 238, 0.07);
    border: 1px solid rgba(34, 211, 238, 0.18);
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--accent);
    transition: var(--transition);
}

.tag:hover {
    background: rgba(34, 211, 238, 0.13);
    border-color: var(--accent);
}

/* ---- Tech stack ---- */
#stack { background: var(--bg-primary); }

.stack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.stack-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 26px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stack-group:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
}

.stack-group h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.stack-arrow { color: var(--accent-secondary); }

/* ---- About ---- */
#about { background: var(--bg-secondary); }

.about-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 56px;
    align-items: start;
    margin-top: 8px;
}

.about-aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.about-avatar {
    width: 150px; height: 150px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #06121a;
    background: var(--gradient-accent);
    box-shadow: 0 14px 40px rgba(34, 211, 238, 0.22);
    user-select: none;
}

.about-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.about-loc {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.about-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.about-links a {
    font-family: var(--mono);
    padding: 7px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.about-links a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.about-text h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.96rem;
}

.about-bridge {
    font-family: var(--mono);
    color: var(--accent-secondary) !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}

/* ---- Contact ---- */
#contact { background: var(--bg-primary); }

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: start;
}

.contact-info h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.contact-info > p {
    color: var(--text-secondary);
    margin-bottom: 36px;
    font-size: 0.96rem;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.contact-item svg {
    width: 22px; height: 22px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.contact-item div { display: flex; flex-direction: column; }

.contact-label {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

.contact-item a {
    color: var(--text-primary);
    font-weight: 500;
    transition: color var(--transition);
}

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

.contact-form-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 38px;
    box-shadow: var(--shadow-sm);
}

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-family: var(--mono);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 13px 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea { resize: vertical; min-height: 120px; }

/* ---- Footer ---- */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 40px 0;
}

.footer-single { text-align: center; }

.footer-bottom p {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Animations ---- */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

@media (prefers-reduced-motion: reduce) {
    .fade-in { opacity: 1; transform: none; transition: none; }
    .status-dot, .caret { animation: none; }
    html { scroll-behavior: auto; }
}

/* ---- Demo ribbon ---- */
.demo-ribbon {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 16px;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: #06121a;
    background: var(--gradient-accent);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.4);
}

.demo-ribbon a {
    color: #06121a;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.85;
}

.demo-ribbon a:hover { opacity: 1; }

body { padding-bottom: 40px; } /* room for the fixed demo bar */

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .hero-inner { grid-template-columns: 1fr; gap: 48px; }
    .hero-copy { max-width: 640px; }
    .terminal { max-width: 560px; }
    .stack-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    section { padding: 80px 0; }

    .nav-hamburger { display: flex; }

    .nav-links {
        position: fixed;
        top: 0; right: -100%;
        width: 280px; height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: center;
        padding: 40px;
        gap: 26px;
        border-left: 1px solid var(--border);
        transition: right var(--transition);
    }

    .nav-links.open { right: 0; }
    .nav-links a { font-size: 1.05rem; }

    .projects-grid { grid-template-columns: 1fr; }

    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .hero-actions { flex-direction: column; align-items: flex-start; }
    .hero-actions .btn { width: 100%; }
    .hero-metrics { gap: 28px; }
}

@media (max-width: 480px) {
    .hero-metrics { flex-wrap: wrap; gap: 20px 32px; }
    .contact-form-wrap { padding: 24px; }
    .metric-num { font-size: 1.6rem; }
    .terminal-body { font-size: 0.78rem; }
}
