/* ========================================
   SCHEGGE DI ME - Vintage Typewriter Theme
   ======================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Special+Elite&display=swap');

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

/* Root Variables */
:root {
    --bg-color: #f4f1e8;
    --text-color: #2c2c2c;
    --accent-color: #8b7355;
    --border-color: #2c2c2c;
    --paper-line: rgba(44, 44, 44, 0.08);
    --shadow-color: rgba(44, 44, 44, 0.15);
    --font-main: 'Special Elite', 'Courier New', monospace;
}

/* Body with Lined Paper Effect */
body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    background-image:
        repeating-linear-gradient(
            transparent,
            transparent 31px,
            var(--paper-line) 31px,
            var(--paper-line) 32px
        );
    color: var(--text-color);
    line-height: 1.8;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   HEADER
   ======================================== */
header {
    text-align: center;
    padding: 40px 20px;
    border-bottom: double 4px var(--border-color);
    margin-bottom: 40px;
}

.site-title {
    font-size: 2.5rem;
    letter-spacing: 4px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.site-subtitle {
    font-size: 1rem;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* ========================================
   NAVIGATION
   ======================================== */
nav {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 30px;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 30px;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 15px;
    border: dashed 1px var(--border-color);
    transition: all 0.3s ease;
    display: inline-block;
}

nav a:hover,
nav a.active {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* ========================================
   SECTION TITLES - Bracketed Style
   ======================================== */
.section-title {
    font-size: 1.5rem;
    text-align: center;
    margin: 40px 0 30px;
    letter-spacing: 3px;
}

.section-title::before {
    content: '[ ';
}

.section-title::after {
    content: ' ]';
}

/* ========================================
   CARDS - Paper with Punch Holes
   ======================================== */
.card {
    background-color: var(--bg-color);
    border: double 4px var(--border-color);
    padding: 40px 30px 30px;
    margin-bottom: 30px;
    position: relative;
    box-shadow: 4px 4px 0 var(--shadow-color);
}

/* Paper Punch Holes Effect */
.card::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    height: 12px;
    background-image:
        radial-gradient(circle, var(--border-color) 4px, transparent 4px),
        radial-gradient(circle, var(--border-color) 4px, transparent 4px),
        radial-gradient(circle, var(--border-color) 4px, transparent 4px);
    background-size: 33.33% 100%;
    background-position: 0% 50%, 50% 50%, 100% 50%;
    background-repeat: no-repeat;
}

.card-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    border-bottom: dashed 1px var(--border-color);
    padding-bottom: 10px;
}

.card-content {
    line-height: 2;
}

/* ========================================
   POEM CARDS
   ======================================== */
.poem-card {
    background-color: var(--bg-color);
    border: double 4px var(--border-color);
    padding: 50px 30px 30px;
    margin-bottom: 30px;
    position: relative;
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.poem-card::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    height: 12px;
    background-image:
        radial-gradient(circle, var(--border-color) 4px, transparent 4px),
        radial-gradient(circle, var(--border-color) 4px, transparent 4px),
        radial-gradient(circle, var(--border-color) 4px, transparent 4px);
    background-size: 33.33% 100%;
    background-position: 0% 50%, 50% 50%, 100% 50%;
    background-repeat: no-repeat;
}

.poem-title {
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 25px;
    letter-spacing: 2px;
}

.poem-text {
    white-space: pre-line;
    line-height: 2.2;
    text-align: left;
}

.poem-signature {
    text-align: right;
    margin-top: 30px;
    font-style: italic;
    border-top: dashed 1px var(--border-color);
    padding-top: 15px;
}

/* ========================================
   POEM LIST (Index Page)
   ======================================== */
.poem-list {
    list-style: none;
}

.poem-list li {
    margin-bottom: 15px;
}

.poem-list a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 15px 20px;
    border: dashed 1px var(--border-color);
    transition: all 0.3s ease;
}

.poem-list a:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    padding-left: 30px;
}

.poem-list a::before {
    content: '> ';
}

/* ========================================
   LINKS
   ======================================== */
a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-style: dashed;
}

a:hover {
    text-decoration-style: solid;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border: double 4px var(--border-color);
    background-color: transparent;
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px 5px;
}

.btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* ========================================
   FORMS (Contact Page)
   ======================================== */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 12px 15px;
    border: dashed 1px var(--border-color);
    background-color: transparent;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-color);
    transition: border 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-style: solid;
    border-width: 2px;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
    border-top: double 4px var(--border-color);
}

.footer-text {
    font-size: 0.9rem;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* ========================================
   DECORATIVE ELEMENTS
   ======================================== */
.divider {
    text-align: center;
    margin: 40px 0;
    letter-spacing: 10px;
    opacity: 0.5;
}

.divider::before {
    content: '~ ~ ~';
}

/* Typewriter cursor effect */
.typewriter-cursor::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ========================================
   IMAGE STYLES
   ======================================== */
.poem-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto 30px;
    border: double 4px var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

.poem-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    border: dashed 1px var(--border-color);
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.poem-list a:hover .poem-card-image {
    opacity: 0.8;
}

.about-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    margin: 0 auto 30px;
    border: double 4px var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color);
}

/* Responsive image styles */
@media screen and (max-width: 768px) {
    .poem-image {
        margin: 16px auto 24px;
    }

    .poem-card-image {
        height: 150px;
    }

    .about-image {
        max-width: 250px;
        margin-bottom: 24px;
    }
}

@media screen and (max-width: 480px) {
    .poem-image {
        margin: 12px auto 20px;
        box-shadow: 3px 3px 0 var(--shadow-color);
    }

    .poem-card-image {
        height: 120px;
    }

    .about-image {
        max-width: 200px;
        margin-bottom: 20px;
        box-shadow: 3px 3px 0 var(--shadow-color);
    }
}

/* ========================================
   ABOUT PAGE
   ======================================== */
.about-content {
    line-height: 2.2;
}

.about-content p {
    margin-bottom: 20px;
    text-indent: 30px;
}

/* ========================================
   BACK LINK
   ======================================== */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    padding: 8px 15px;
    border: dashed 1px var(--border-color);
    text-decoration: none;
}

.back-link:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media screen and (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 30px 15px;
    }

    .site-title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .site-subtitle {
        font-size: 0.9rem;
    }

    nav ul {
        gap: 8px 15px;
    }

    nav a {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }

    .card,
    .poem-card {
        padding: 45px 20px 25px;
        margin-bottom: 25px;
    }

    .card::before,
    .poem-card::before {
        left: 15px;
        right: 15px;
    }

    .card-title,
    .poem-title {
        font-size: 1.1rem;
    }

    .poem-text {
        line-height: 2;
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    footer {
        padding: 30px 15px;
        margin-top: 40px;
    }

    .footer-text {
        font-size: 0.85rem;
    }
}

@media screen and (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
    }

    nav a {
        width: 80%;
        text-align: center;
    }

    .card,
    .poem-card {
        padding: 40px 15px 20px;
    }

    .poem-text {
        font-size: 0.9rem;
        line-height: 1.9;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
        background-image: none;
    }

    .card,
    .poem-card {
        box-shadow: none;
        page-break-inside: avoid;
    }

    nav, .btn {
        display: none;
    }
}

/* ========================================
   ENHANCED MOBILE STYLES
   Comprehensive responsive improvements
   ======================================== */

/* Prevent horizontal scroll on all devices */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Safe area insets for notched phones (iPhone X+, etc.) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    footer {
        padding-bottom: max(40px, calc(env(safe-area-inset-bottom) + 20px));
    }
}

/* Enhanced Mobile Styles - Medium devices */
@media screen and (max-width: 768px) {
    /* Prevent horizontal overflow */
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Form inputs - 16px prevents iOS zoom */
    input[type="text"],
    input[type="email"],
    textarea {
        font-size: 16px;
        padding: 14px 16px;
        min-height: 44px;
    }

    /* Minimum touch targets (44px) for accessibility */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    nav a {
        min-height: 44px;
        padding: 10px 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .poem-list a {
        min-height: 44px;
        padding: 14px 20px;
        display: flex;
        align-items: center;
    }

    .back-link {
        min-height: 44px;
        padding: 10px 16px;
        display: inline-flex;
        align-items: center;
    }

    /* Better mobile spacing */
    .container {
        padding: 16px;
    }

    header {
        padding: 32px 16px;
        margin-bottom: 32px;
    }

    .section-title {
        margin: 32px 0 24px;
    }

    .card,
    .poem-card {
        margin-bottom: 24px;
    }

    /* Scale typography for mobile */
    .site-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .site-subtitle {
        font-size: clamp(0.85rem, 2.5vw, 1rem);
    }

    .section-title {
        font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    }

    .poem-title {
        font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    }

    .poem-text {
        font-size: clamp(0.9rem, 2.8vw, 1rem);
        line-height: 1.9;
    }

    .card-content {
        font-size: clamp(0.9rem, 2.8vw, 1rem);
    }
}

/* Enhanced Mobile Styles - Small devices */
@media screen and (max-width: 480px) {
    /* Further scaled typography */
    .site-title {
        font-size: clamp(1.3rem, 6vw, 1.6rem);
        letter-spacing: 1px;
    }

    .site-subtitle {
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    .section-title {
        font-size: 1rem;
        letter-spacing: 1px;
    }

    /* Vertical stacked navigation */
    nav {
        padding: 16px 0;
    }

    nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0 16px;
    }

    nav a {
        width: 100%;
        text-align: center;
        min-height: 48px;
        font-size: 0.95rem;
    }

    /* Better card spacing on small screens */
    .card,
    .poem-card {
        padding: 40px 16px 20px;
        margin-bottom: 20px;
        box-shadow: 3px 3px 0 var(--shadow-color);
    }

    .card::before,
    .poem-card::before {
        left: 12px;
        right: 12px;
        top: 12px;
    }

    .card-title,
    .poem-title {
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .poem-text {
        font-size: 0.88rem;
        line-height: 1.85;
    }

    .poem-signature {
        font-size: 0.85rem;
        margin-top: 24px;
        padding-top: 12px;
    }

    /* Poem list touch-friendly */
    .poem-list a {
        padding: 16px;
        min-height: 52px;
        font-size: 0.95rem;
    }

    .poem-list a:hover {
        padding-left: 20px;
    }

    /* Form improvements */
    .form-group {
        margin-bottom: 20px;
    }

    label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    input[type="text"],
    input[type="email"],
    textarea {
        font-size: 16px;
        padding: 14px;
        min-height: 48px;
    }

    textarea {
        min-height: 120px;
    }

    /* Buttons on mobile */
    .btn {
        width: 100%;
        min-height: 48px;
        padding: 14px 20px;
        font-size: 0.95rem;
        margin: 8px 0;
    }

    /* Footer mobile */
    footer {
        padding: 32px 16px;
        margin-top: 32px;
    }

    .footer-text {
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    /* Back link mobile */
    .back-link {
        min-height: 48px;
        width: auto;
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    /* About content mobile */
    .about-content p {
        text-indent: 20px;
        margin-bottom: 16px;
        font-size: 0.9rem;
    }

    /* Divider mobile */
    .divider {
        margin: 32px 0;
        letter-spacing: 6px;
    }
}

/* Extra small devices */
@media screen and (max-width: 360px) {
    .site-title {
        font-size: 1.2rem;
        letter-spacing: 0.5px;
    }

    .container {
        padding: 12px;
    }

    .card,
    .poem-card {
        padding: 36px 12px 16px;
    }

    .poem-text {
        font-size: 0.85rem;
        line-height: 1.8;
    }

    nav ul {
        padding: 0 12px;
    }

    nav a {
        font-size: 0.9rem;
        min-height: 48px;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    header {
        padding: 24px 16px;
        margin-bottom: 24px;
    }

    .site-title {
        font-size: 1.5rem;
    }

    nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 12px;
    }

    nav a {
        width: auto;
        min-width: 44px;
        padding: 8px 14px;
    }

    footer {
        padding: 24px 16px;
        margin-top: 24px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .typewriter-cursor::after {
        animation: none;
        opacity: 1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow-color: rgba(0, 0, 0, 0.3);
    }

    .card,
    .poem-card {
        border-width: 3px;
    }

    nav a,
    .poem-list a,
    .back-link {
        border-width: 2px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for touch-only devices */
    nav a,
    .btn,
    .back-link,
    .poem-list a {
        min-height: 48px;
    }

    /* Remove hover-dependent styles that don't work on touch */
    nav a:hover,
    .poem-list a:hover,
    .back-link:hover {
        padding-left: inherit;
    }

    /* Add active states for touch feedback */
    nav a:active,
    .btn:active,
    .back-link:active,
    .poem-list a:active {
        background-color: var(--text-color);
        color: var(--bg-color);
        transform: scale(0.98);
    }
}
