/* ==========================================================================
   Ikasthuri — hand-drawn / sketch design system
   ========================================================================== */

:root {
    --paper: #fbfaf7;
    --ink: #2d2d2d;
    --muted: #e7e2d9;
    --red: #b4553f;
    --blue: #2d5da1;
    --yellow: #f1ecdf;
    --white: #ffffff;

    --font-head: 'Kalam', cursive;
    --font-body: 'Patrick Hand', cursive;

    --wobbly: 255px 15px 225px 15px / 15px 225px 15px 255px;
    --wobbly-md: 225px 15px 205px 15px / 15px 205px 15px 225px;

    --rect: 10px;
    --rect-sm: 6px;

    --shadow: 4px 4px 0 0 var(--ink);
    --shadow-lg: 8px 8px 0 0 var(--ink);
    --shadow-sm: 3px 3px 0 0 rgba(45, 45, 45, 0.12);

    --max-w: 1280px;
    --gutter: 1.25rem;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--paper);
    background-image: radial-gradient(var(--muted) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-font-smoothing: antialiased;
}

/* Floating doodle background (tsParticles) */
.particles {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* Full-screen preloader */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background-color: var(--paper);
    background-image: radial-gradient(var(--muted) 1px, transparent 1px);
    background-size: 24px 24px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.is-done {
    opacity: 0;
    visibility: hidden;
}

.preloader-mark {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 2.2rem;
    color: var(--ink);
    border: 3px solid var(--ink);
    border-radius: var(--wobbly);
    padding: 0.6rem 1.1rem;
    box-shadow: var(--shadow);
    background: var(--white);
}

.preloader-bar {
    width: 180px;
    height: 10px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--white);
    overflow: hidden;
}

.preloader-bar span {
    display: block;
    height: 100%;
    width: 40%;
    background: var(--red);
    animation: preloader-slide 1.1s ease-in-out infinite;
}

@keyframes preloader-slide {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(140%); }
    100% { transform: translateX(260%); }
}

.preloader-text {
    margin: 0;
    color: #4a463f;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--blue);
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 0.6em;
    letter-spacing: 0.01em;
}

p {
    margin: 0 0 1em;
}

/* Layout */
.site-main {
    min-height: 70vh;
}

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

.section {
    padding: 4rem 0;
}

.section-alt {
    background-color: rgba(255, 255, 255, 0.4);
    border-top: 2px dashed var(--muted);
    border-bottom: 2px dashed var(--muted);
}

.section-head {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 2.5rem;
}

.h-display {
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    margin-bottom: 0.35rem;
}

.h-section {
    font-size: clamp(1.9rem, 4.5vw, 2.7rem);
    position: relative;
    display: inline-block;
}

.lead {
    font-size: 1.25rem;
    color: #4a463f;
}

/* Continuous title underline (subtle, low opacity) */
.h-display,
.h-section {
    text-decoration: underline;
    text-decoration-color: rgba(180, 85, 63, 0.35);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.12em;
    text-decoration-skip-ink: none;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: rgba(253, 251, 247, 0.92);
    backdrop-filter: blur(6px);
    border-bottom: 3px solid var(--ink);
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0.7rem var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.brand img {
    width: 30px;
    height: 30px;
}

.site-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.site-nav a {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--ink);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border: 2px solid transparent;
    border-radius: var(--wobbly);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.site-nav a:hover {
    background-color: var(--yellow);
}

.site-nav a.is-active {
    background-color: var(--ink);
    color: var(--paper);
}

.site-nav .nav-cta {
    background-color: var(--blue);
    color: var(--white);
    border: 3px solid var(--blue);
    box-shadow: var(--shadow-sm);
}

.site-nav .nav-cta:hover {
    background-color: var(--red);
    border-color: var(--red);
    color: var(--white);
    box-shadow: 2px 2px 0 0 var(--ink);
    transform: translate(2px, 2px);
}

.nav-toggle {
    display: none;
    background: none;
    border: 2px solid var(--ink);
    border-radius: var(--wobbly);
    padding: 0.45rem 0.6rem;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 3px;
    background: var(--ink);
    margin: 4px 0;
    border-radius: 2px;
}

/* Buttons */
.btn {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--ink);
    background: var(--white);
    text-decoration: none;
    padding: 0.7rem 1.4rem;
    border: 3px solid var(--ink);
    border-radius: var(--wobbly);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease, color 0.1s ease;
    min-height: 48px;
}

.btn:hover {
    background-color: var(--ink);
    color: var(--white);
    box-shadow: 2px 2px 0 0 var(--ink);
    transform: translate(2px, 2px);
}

.btn:active {
    box-shadow: none;
    transform: translate(4px, 4px);
}

.btn-secondary {
    background: var(--muted);
}

.btn-secondary:hover {
    background: var(--red);
    color: var(--white);
}

.btn-accent {
    background-color: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.btn-accent:hover {
    background-color: var(--red);
    border-color: var(--red);
    color: var(--white);
}

.btn-lg {
    font-size: 1.25rem;
    padding: 0.85rem 1.7rem;
}

.btn-sm {
    font-size: 0.95rem;
    padding: 0.45rem 0.9rem;
    min-height: 40px;
}

/* Hero */
.hero {
    padding: 4rem 0;
    overflow: hidden;
}

.hero-inner {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-content .subtitle {
    display: inline-block;
    font-size: 1.2rem;
    background: var(--white);
    padding: 0.2rem 0.9rem;
    border: 2px solid var(--ink);
    border-radius: var(--wobbly);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.hero-content h1 {
    font-size: clamp(2.6rem, 8vw, 4.6rem);
    margin-bottom: 0.2rem;
}

.hero-content h1 .name-line {
    display: block;
}

.hero-content .hero-role {
    font-family: var(--font-head);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 400;
    color: var(--blue);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.hero-content .hero-copy {
    font-size: 1.2rem;
    max-width: 32rem;
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

.hero-media {
    position: relative;
    display: flex;
    justify-content: center;
}

.hero-photo {
    max-width: 340px;
    border: 3px solid var(--ink);
    border-radius: var(--wobbly);
    box-shadow: var(--shadow-lg);
    background: var(--white);
    padding: 0.5rem;
}

.hero-photo img {
    border-radius: 16px 8px 16px 8px / 8px 16px 8px 16px;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}

.stat {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--wobbly);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem;
    text-align: center;
}

.stat b {
    font-family: var(--font-head);
    font-size: 1.9rem;
    display: block;
    line-height: 1;
}

.stat span {
    font-size: 0.95rem;
    color: #4a463f;
}

/* Grids & cards */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }

.card {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--rect);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    position: relative;
}

.card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 0 rgba(45, 45, 45, 0.18);
}

.card-media img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-bottom: 2px solid var(--ink);
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

.card-title {
    font-size: 1.35rem;
    margin: 0;
}

.card-text {
    margin: 0;
    color: #4a463f;
    flex: 1;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    font-size: 0.8rem;
    background: var(--muted);
    border: 1.5px solid var(--ink);
    border-radius: var(--rect-sm);
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
}

/* Sticky note */
.note {
    background: var(--muted);
    border: 2px solid var(--ink);
    border-left: 4px solid var(--blue);
    border-radius: var(--rect);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.bio-box {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--rect);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
}

.bio-box p {
    margin: 0 0 1rem;
}

.bio-box p:last-child {
    margin-bottom: 0;
}

/* Skills */
.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.skill-pill {
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--wobbly);
    padding: 0.3rem 0.8rem;
    box-shadow: 2px 2px 0 0 var(--ink);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.skill-pill:hover {
    background: var(--blue);
    color: var(--white);
}

/* APA reference list (publications) */
.references {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 780px;
}

.references li {
    margin-bottom: 1.1rem;
    padding-left: 1.75em;
    text-indent: -1.75em;
    line-height: 1.55;
}

.references em {
    font-style: italic;
}

.references a {
    color: var(--blue);
    word-break: break-word;
}

/* Timeline (education / experience) */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.timeline-item {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--rect);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.75rem;
    position: relative;
}

.timeline-item .period {
    font-family: var(--font-head);
    font-size: 0.9rem;
    display: inline-block;
    background: var(--yellow);
    border: 1.5px solid var(--ink);
    border-radius: var(--rect-sm);
    padding: 0.05rem 0.6rem;
    margin-bottom: 0.4rem;
}

.timeline-item h3 {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}

.timeline-item .place {
    font-size: 1rem;
    color: var(--blue);
    text-decoration: none;
    font-family: var(--font-head);
}

.timeline-item .honour {
    font-style: italic;
    color: #4a463f;
    margin-bottom: 0.5rem;
}

.timeline-item ul {
    margin: 0.4rem 0 0;
    padding-left: 1.3rem;
}

.timeline-item ul li {
    margin-bottom: 0.2rem;
}

.timeline-item .subhead {
    font-weight: 700;
    margin: 0.6rem 0 0.15rem;
}

/* Certificates — all courses in a single card */
.certificate-box {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--rect);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.75rem;
}

.certificate-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.certificate-list li {
    border-bottom: 1px solid #ece7df;
}

.certificate-list li:last-child {
    border-bottom: none;
}

.certificate-list a {
    display: block;
    padding: 0.65rem 0;
    font-family: var(--font-head);
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--ink);
}

.certificate-list a:hover {
    color: var(--blue);
}

/* Prose (blog / long-form) */
.prose {
    max-width: 720px;
    margin: 0 auto;
    font-size: 1.15rem;
}

.prose h2 {
    font-size: 1.8rem;
    margin-top: 1.6em;
}

.prose h3 {
    font-size: 1.4rem;
    margin-top: 1.4em;
}

.prose ul, .prose ol {
    padding-left: 1.4rem;
}

.prose blockquote {
    border-left: 4px solid var(--red);
    background: var(--white);
    margin: 1.2em 0;
    padding: 0.8em 1.2em;
    border-radius: var(--wobbly-md);
    box-shadow: var(--shadow-sm);
}

.prose code {
    background: var(--muted);
    padding: 0.1em 0.4em;
    border-radius: 6px;
    font-size: 0.9em;
}

.prose pre {
    background: #f4f1ea;
    border: 2px dashed var(--ink);
    border-radius: var(--wobbly-md);
    padding: 1rem;
    overflow-x: auto;
}

/* CTA band */
.cta-band {
    background: var(--yellow);
    border: 3px solid var(--ink);
    border-radius: var(--rect);
    box-shadow: var(--shadow-lg);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
}

.cta-band h2 {
    font-size: 2rem;
}

/* Contact */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.contact-card {
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: var(--rect);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    text-align: center;
}

.contact-card .icon {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

/* Footer */
.site-footer {
    border-top: 3px solid var(--ink);
    background: var(--white);
    margin-top: 5rem;
    padding: 3rem 0;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--gutter);
    text-align: center;
}

.footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 1.2rem;
}

.social-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-body);
    color: var(--ink);
    text-decoration: none;
    border: 2px solid var(--ink);
    border-radius: var(--wobbly);
    padding: 0.4rem 0.9rem;
    background: var(--white);
    box-shadow: 2px 2px 0 0 var(--ink);
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.social-pill:hover {
    background: var(--blue);
    color: var(--white);
}

.footer-note {
    margin: 0;
    color: #4a463f;
}

.footer-made {
    margin: 0.3rem 0 0;
    font-size: 0.95rem;
    color: #6b665e;
}

/* Not found */
.notfound {
    text-align: center;
    padding: 4rem 0;
}

.notfound .big {
    font-family: var(--font-head);
    font-size: clamp(5rem, 20vw, 10rem);
    line-height: 1;
    margin-bottom: 0.2rem;
}

/* Decorative */
.bounce {
    animation: bounce 3s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Page header (sub-page hero) */
.page-hero {
    padding: 3.5rem 0 2rem;
}

.page-hero + .section {
    padding-top: 1rem;
}

/* Layout helpers */
.grid-start {
    align-items: start;
}

.section-cta {
    text-align: center;
    margin-top: 2rem;
}

.section-head--tight {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 1rem;
}

/* Link-shaped cards */
a.card {
    text-decoration: none;
    color: var(--ink);
}

.card-body > .tag {
    align-self: flex-start;
}

/* Sticky note & CTA text */
.note p {
    margin: 0;
}

.cta-band p {
    max-width: 34rem;
    margin: 0 auto 1.5rem;
}

/* Contact cards */
.contact-card .h-section {
    font-size: 1.5rem;
}

.contact-card .hero-actions {
    justify-content: center;
}

/* About page photo */
.about-photo {
    max-width: 320px;
    margin: 0 auto 1rem;
}

/* Article / long-form pages */
.section--article {
    padding-top: 3rem;
}

/* 404 */
.notfound p {
    max-width: 30rem;
    margin: 0 auto 1.5rem;
}

/* Responsive */
@media (min-width: 768px) {
    :root { --gutter: 2.5rem; }
    .section { padding: 6rem 0; }
}

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 899px) {
    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content .hero-copy {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-photo {
        max-width: 280px;
    }
}

@media (max-width: 720px) {
    .brand-long {
        display: none;
    }

    .nav-toggle {
        display: block;
    }

    .site-nav {
        flex-basis: 100%;
        display: none;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav a {
        display: block;
        text-align: center;
    }
}
