/* ============================================
   Utilities
   ============================================ */
.hidden {
    display: none !important;
}

.body--centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ============================================
   Variables & Base
   ============================================ */
:root {
    --color-bg: #F8F7F4;
    --color-bg-card: #FFFFFF;
    --color-text: #1C1C1C;
    --color-text-secondary: #4A5568;
    --color-text-tertiary: #718096;
    --color-accent: #2B5B84;
    --color-accent-muted: rgba(43, 91, 132, 0.08);
    --color-border: #E2E8F0;
    --color-border-hover: #CBD5E0;
    --color-error: #c53030;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Source Serif 4', Georgia, serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --grain-opacity: 0.03;
}

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

html {
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* ============================================
   Texture & Background Elements
   ============================================ */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.4;
}

.bg-pattern::before,
.bg-pattern::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
    opacity: 0.03;
}

.bg-pattern::before {
    width: 800px;
    height: 800px;
    top: -200px;
    right: -200px;
}

.bg-pattern::after {
    width: 600px;
    height: 600px;
    bottom: -100px;
    left: -150px;
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 2rem;
}

.container--wide {
    max-width: 680px;
}

/* ============================================
   Header
   ============================================ */
.site-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
    max-width: 680px;
    margin: 0 auto;
}

.site-header__link {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-header__link:hover {
    color: var(--color-accent);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--color-border);
}

.site-footer__inner {
    max-width: 680px;
    margin: 0 auto;
}

.site-footer__link {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer__link:hover {
    color: var(--color-accent);
}

/* ============================================
   Decorative Elements
   ============================================ */
.decorative-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.decorative-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--color-accent);
}

.decorative-dots span:nth-child(1) { opacity: 0.25; }
.decorative-dots span:nth-child(2) { opacity: 0.4; }
.decorative-dots span:nth-child(3) { opacity: 0.6; }
.decorative-dots span:nth-child(4) { opacity: 0.4; }
.decorative-dots span:nth-child(5) { opacity: 0.25; }

.decorative-dots--spaced {
    margin-bottom: 2rem;
}

.corner-accent {
    position: absolute;
    width: 60px;
    height: 60px;
    opacity: 0.15;
}

.corner-accent--tl {
    top: 0;
    left: 0;
    border-top: 1px solid var(--color-accent);
    border-left: 1px solid var(--color-accent);
}

.corner-accent--br {
    bottom: 0;
    right: 0;
    border-bottom: 1px solid var(--color-accent);
    border-right: 1px solid var(--color-accent);
}

/* ============================================
   Hero
   ============================================ */
.hero {
    padding: 12vh 0 8vh;
    text-align: center;
    position: relative;
}

.hero__dots {
    margin-bottom: 2.5rem;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 7vw, 3.5rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.hero__subtitle {
    font-family: var(--font-body);
    font-size: 1rem;
    font-style: italic;
    color: var(--color-text-secondary);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ============================================
   Intro Section
   ============================================ */
.intro {
    padding: 4rem 0;
    border-top: 1px solid var(--color-border);
    position: relative;
}

.intro__wrapper {
    position: relative;
    padding: 2.5rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
}

.intro__text {
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.intro__text p {
    margin-bottom: 1.25rem;
}

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

/* ============================================
   Section Transitions
   ============================================ */
.section-continue {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0 0;
}

.section-continue__dots {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.section-continue__dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-accent);
}

.section-continue__dots span:nth-child(1) { opacity: 0.2; }
.section-continue__dots span:nth-child(2) { opacity: 0.35; }
.section-continue__dots span:nth-child(3) { opacity: 0.5; }

/* ============================================
   Sections
   ============================================ */
.section {
    padding: 4rem 0;
    border-top: 1px solid var(--color-border);
}

.section__label {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--color-text-tertiary);
    text-align: center;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.section__label::before,
.section__label::after {
    content: '';
    width: 40px;
    height: 1px;
    background: var(--color-border);
}

.section__text {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.section__text p {
    margin-bottom: 1.25rem;
}

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

/* ============================================
   Projects Grid
   ============================================ */
.projects-grid {
    display: grid;
    gap: 1rem;
}

.project-card {
    display: block;
    position: relative;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: 1.5rem 1.75rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--color-accent);
    transform: scaleY(0);
    transition: transform 0.25s ease;
}

.project-card:hover,
.project-card:focus-visible {
    border-color: var(--color-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.04);
    outline: none;
}

.project-card:hover::before,
.project-card:focus-visible::before {
    transform: scaleY(1);
}

.project-card__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.project-card__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
}

.project-card__type {
    font-family: var(--font-ui);
    font-size: 0.55rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    white-space: nowrap;
    padding: 0.2rem 0.5rem;
    background: var(--color-accent-muted);
    border-radius: 2px;
}

.project-card__description {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.65;
}

/* ============================================
   Subsections (Objectivity)
   ============================================ */
.subsection {
    margin-bottom: 2rem;
    padding-left: 1.25rem;
    border-left: 2px solid var(--color-border);
    position: relative;
}

.subsection::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0.5;
}

.subsection:last-of-type {
    margin-bottom: 1.5rem;
}

.subsection p.subsection__title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    font-style: italic;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.subsection p {
    font-size: 0.92rem;
}

/* ============================================
   Closing
   ============================================ */
.closing {
    padding: 5rem 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
    position: relative;
}

.closing__dots {
    margin-bottom: 2rem;
}

.closing__text {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text);
    max-width: 320px;
    margin: 0 auto;
}

.closing__text em {
    font-style: italic;
    display: block;
    margin-top: 1.5rem;
    font-size: 1.15rem;
    color: var(--color-text-secondary);
}

.closing__contact {
    margin-top: 2.5rem;
}

.closing__contact-link {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-tertiary);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--color-border);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.closing__contact-link:hover,
.closing__contact-link:focus-visible {
    border-color: var(--color-accent);
    color: var(--color-accent);
    outline: none;
}

/* ============================================
   Contact Page
   ============================================ */
.contact-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.contact__inner {
    max-width: 440px;
    width: 100%;
}

.contact__title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.contact__subtitle {
    font-size: 0.92rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
}

.form-input,
.form-textarea {
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg);
    color: var(--color-text);
    border-radius: 2px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(43, 91, 132, 0.1);
}

.form-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.form-input[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
    border-color: var(--color-error);
}

.form-input[aria-invalid="true"]:focus,
.form-textarea[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.1);
}

/* General focus for links */
a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.form-error {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--color-error);
    margin-top: 0.25rem;
}

.form-submit {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.9rem 1.75rem;
    background-color: var(--color-text);
    color: var(--color-bg);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
    align-self: flex-start;
    margin-top: 0.5rem;
}

.form-submit:hover,
.form-submit:focus-visible {
    background-color: var(--color-accent);
    outline: none;
}

.form-submit:active {
    transform: scale(0.98);
}

.form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-note {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    margin-top: 0.75rem;
}

/* Success state */
.success-message {
    display: none;
    text-align: center;
    padding: 2rem 0;
}

.success-message.visible {
    display: block;
}

.success-message__title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.success-message__text {
    font-size: 0.92rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.success-message__link {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--color-accent);
    text-decoration: none;
}

.success-message__link:hover {
    text-decoration: underline;
}

/* ============================================
   404 Page
   ============================================ */
.error-page {
    text-align: center;
    max-width: 380px;
}

.error-page__code {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 400;
    color: var(--color-text-tertiary);
    margin-bottom: 1rem;
}

.error-page__message {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-page__link {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-accent);
    text-decoration: none;
}

.error-page__link:hover {
    text-decoration: underline;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    html { font-size: 16px; }
    .container { padding: 0 1.25rem; }
    .hero { padding: 8vh 0 6vh; }
    .section { padding: 3rem 0; }
    .intro__wrapper { padding: 1.75rem; }
    .project-card { padding: 1.25rem 1.5rem; }
    .project-card__header { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
    .subsection { padding-left: 1rem; }
    .closing { padding: 4rem 0; }
    .closing__text { font-size: 1.2rem; }
    .corner-accent { width: 40px; height: 40px; }
    .site-header,
    .site-footer { padding: 1.25rem 1.25rem; }
    .contact-section { padding: 3rem 1.25rem; }
}

/* ============================================
   Animations
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
    .hero, .intro, .section, .closing {
        opacity: 0;
        transform: translateY(14px);
        animation: fadeUp 0.5s ease forwards;
    }
    
    .hero { animation-delay: 0.05s; }
    .intro { animation-delay: 0.15s; }
    .section:nth-of-type(1) { animation-delay: 0.25s; }
    .section:nth-of-type(2) { animation-delay: 0.30s; }
    .section:nth-of-type(3) { animation-delay: 0.35s; }
    .section:nth-of-type(4) { animation-delay: 0.40s; }
    .section:nth-of-type(5) { animation-delay: 0.45s; }
    .section:nth-of-type(6) { animation-delay: 0.50s; }
    .section:nth-of-type(7) { animation-delay: 0.55s; }
    .section:nth-of-type(8) { animation-delay: 0.60s; }
    .section:nth-of-type(9) { animation-delay: 0.65s; }
    .section:nth-of-type(10) { animation-delay: 0.70s; }
    .closing { animation-delay: 0.75s; }
    
    @keyframes fadeUp {
        to { opacity: 1; transform: translateY(0); }
    }
}
