/* ============================================
   Reset & Base
   ============================================ */

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a1a;
    background: #f5f5f4;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

main.container {
    flex: 1;
    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

/* ============================================
   Header
   ============================================ */

.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e3;
    padding: 1rem 0;
}

.site-logo {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.site-logo:hover {
    color: #555;
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
    border-top: 1px solid #e5e5e3;
    padding: 1.25rem 0;
    text-align: center;
}

.site-footer p {
    font-size: 0.8rem;
    color: #999;
}

/* ============================================
   Typography
   ============================================ */

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.page-subtitle {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    font-size: 0.85rem;
    color: #666;
    text-decoration: none;
    margin-bottom: 1.25rem;
}

.back-link:hover {
    color: #1a1a1a;
}

/* ============================================
   Media Grid (index)
   ============================================ */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.media-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e5e3;
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.media-card:hover {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.media-card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.media-card p {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.5;
}

.media-card-arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.1rem;
    color: #ccc;
    transition: color 0.15s, transform 0.15s;
}

.media-card:hover .media-card-arrow {
    color: #1a1a1a;
    transform: translateX(2px);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 0.35rem;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #888;
}

.form-group input[type="text"]::placeholder {
    color: #bbb;
}

/* Textarea */

.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s;
    resize: vertical;
    line-height: 1.5;
}

.form-group textarea:focus {
    outline: none;
    border-color: #888;
}

.form-group textarea::placeholder {
    color: #bbb;
}

/* Form section titles */

.form-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e5e5e3;
}

/* Two-column row */

.form-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Style selector (radio cards) */

.style-selector {
    border: none;
    padding: 0;
}

.style-selector legend {
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 0.5rem;
}

.style-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.style-option {
    display: block;
    cursor: pointer;
}

.style-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.style-option-content {
    display: block;
    background: #fff;
    border: 2px solid #e5e5e3;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    transition: border-color 0.15s;
}

.style-option-content strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.2rem;
}

.style-option-content small {
    display: block;
    font-size: 0.78rem;
    color: #888;
    line-height: 1.4;
}

.style-option input[type="radio"]:checked + .style-option-content {
    border-color: #1a1a1a;
}

.style-option:hover .style-option-content {
    border-color: #bbb;
}

.style-option input[type="radio"]:checked + .style-option-content {
    border-color: #1a1a1a;
}

/* Color fields */

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-input-wrap input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: #fff;
    flex-shrink: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.color-input-wrap input[type="text"] {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 0.85rem;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
}

.btn-primary:hover {
    background: #333;
}

.btn-primary.copied {
    background: #16a34a;
}

.btn-secondary {
    background: #e5e5e3;
    color: #444;
}

.btn-secondary:hover {
    background: #d5d5d3;
}

/* ============================================
   Prompt Output
   ============================================ */

.prompt-output {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e5e3;
}

.prompt-output pre {
    background: #fff;
    border: 1px solid #e5e5e3;
    border-radius: 8px;
    padding: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin-bottom: 1rem;
}

.prompt-actions {
    display: flex;
    gap: 0.75rem;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
    .form-row,
    .form-row-2,
    .style-options {
        grid-template-columns: 1fr;
    }

    .prompt-actions {
        flex-direction: column;
    }

    .prompt-actions .btn {
        text-align: center;
    }
}
