/*
Theme Name: Storyguana
Theme URI: https://storyguana.com
Description: Hello Elementor child theme for Storyguana — a public text-forward branching story site.
Author: Storyguana
Template: hello-elementor
Version: 1.0.0
License: GNU General Public License v2 or later
*/

/* ============================================================
   RESET & BASE
   ============================================================ */

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

:root {
    --color-bg:           #0e1117;
    --color-bg-2:         #131926;
    --color-surface:      #1a2235;
    --color-surface-2:    #1f2a40;
    --color-border:       #2a3a55;
    --color-text:         #e8edf5;
    --color-muted:        #7a8faa;
    --color-accent:       #39d353;
    --color-accent-dim:   #2aaa42;
    --color-accent-light: rgba(57,211,83,0.12);
    --color-link:         #39d353;
    --color-link-hover:   #5fe872;
    --color-success:      #39d353;
    --color-error:        #ff5c5c;
    --color-blue-mid:     #1e3a6e;
    --gradient-bg:        linear-gradient(160deg, #0e1117 0%, #111d35 50%, #0e1a2e 100%);
    --gradient-surface:   linear-gradient(135deg, #1a2235 0%, #1c2d48 100%);
    --gradient-accent:    linear-gradient(90deg, #39d353, #2ebfff);

    --font-serif:   'Georgia', 'Times New Roman', serif;
    --font-sans:    'Helvetica Neue', Arial, sans-serif;

    --max-width:    680px;
    --radius:       6px;
    --spacing-xs:   0.5rem;
    --spacing-sm:   1rem;
    --spacing-md:   2rem;
    --spacing-lg:   3rem;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    background: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--color-text);
    font-family: var(--font-serif);
    line-height: 1.75;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.sg-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.sg-header {
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-lg);
    background: rgba(14,17,23,0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
}

.sg-header-inner {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.sg-site-title {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    font-weight: bold;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.sg-site-title:hover {
    opacity: 0.85;
}

.sg-tagline {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--color-muted);
    font-style: italic;
    margin: 0.1rem 0 0;
}

.sg-nav {
    display: flex;
    gap: var(--spacing-md);
    font-family: var(--font-sans);
    font-size: 0.8rem;
}

.sg-nav a {
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.15s;
}

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

.sg-footer {
    border-top: 1px solid var(--color-border);
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md) 0;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--color-muted);
    text-align: center;
    background: rgba(10,13,20,0.5);
}

.sg-footer a {
    color: var(--color-muted);
    text-decoration: underline;
    transition: color 0.15s;
}
.sg-footer a:hover { color: var(--color-accent); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3 {
    font-family: var(--font-serif);
    color: var(--color-text) !important;
    -webkit-text-fill-color: var(--color-text) !important;
    line-height: 1.3;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

::selection {
    background: rgba(57,211,83,0.25);
    color: #fff;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 var(--spacing-sm); color: var(--color-text); }

a {
    color: var(--color-link);
    text-decoration: underline;
}
a:hover { color: var(--color-link-hover); }

/* Force light text globally — overrides Hello Elementor base styles */
.sg-container,
.sg-container p,
.sg-container li,
.sg-container span,
.sg-container div,
.sg-container article {
    color: var(--color-text);
}

hr.sg-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--spacing-md) 0;
}

/* ============================================================
   PROMPT LIST (Home + Index)
   ============================================================ */

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

.sg-prompt-item {
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-sm) 0;
    transition: padding-left 0.2s;
}

.sg-prompt-item:last-child {
    border-bottom: none;
}

.sg-prompt-item:hover {
    padding-left: 0.5rem;
}

.sg-prompt-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--color-accent);
    text-decoration: none;
}

.sg-prompt-title:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.sg-prompt-excerpt {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin: var(--spacing-xs) 0 0;
    font-family: var(--font-sans);
}

.sg-prompt-meta {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--color-muted);
    margin-top: var(--spacing-xs);
}

/* ============================================================
   STORY PAGE — NODE TEXT
   ============================================================ */

.sg-breadcrumb {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-bottom: var(--spacing-md);
}

.sg-breadcrumb a {
    color: var(--color-muted);
    text-decoration: none;
}
.sg-breadcrumb a:hover { text-decoration: underline; }
.sg-breadcrumb span { margin: 0 0.35em; }

.sg-node-body {
    font-size: 1.05rem;
    line-height: 1.85;
    margin-bottom: var(--spacing-md);
    color: var(--color-text) !important;
}

/* ============================================================
   BRANCHES
   ============================================================ */

.sg-branches-heading {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin-bottom: var(--spacing-sm);
}

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

.sg-branch-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--gradient-surface);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sg-branch-item:hover {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(57,211,83,0.2), 0 4px 20px rgba(0,0,0,0.3);
}

.sg-branch-text {
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0 0 var(--spacing-xs);
}

.sg-branch-text a {
    color: var(--color-text);
    text-decoration: none;
    display: block;
}
.sg-branch-text a:hover { color: var(--color-accent); }

.sg-branch-meta {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    color: var(--color-muted);
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.sg-report-link {
    color: var(--color-muted);
    font-size: 0.68rem;
    font-family: var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.sg-report-link:hover { color: var(--color-error); }

/* ============================================================
   ADD-A-BRANCH FORM
   ============================================================ */

.sg-submit-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.sg-submit-section h3 {
    margin-top: 0;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: normal;
}

.sg-form-group {
    margin-bottom: var(--spacing-sm);
}

.sg-form-group label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-bottom: 0.3rem;
}

.sg-form-group textarea,
.sg-form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.6;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #111925;
    color: var(--color-text);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sg-form-group textarea:focus,
.sg-form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(57,211,83,0.15);
}

.sg-form-group textarea::placeholder,
.sg-form-group input::placeholder {
    color: #3d5066;
}

.sg-form-group textarea {
    min-height: 160px;
}

.sg-char-count {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--color-muted);
    text-align: right;
    margin-top: 0.25rem;
}

.sg-char-count.over { color: var(--color-error); }

/* honeypot — hidden from humans */
.sg-hp-field {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

.sg-btn {
    display: inline-block;
    background: var(--color-accent);
    color: #0e1117;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1.6rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.sg-btn:hover {
    background: var(--color-link-hover);
    color: #0e1117;
    box-shadow: 0 0 16px rgba(57,211,83,0.4);
    transform: translateY(-1px);
}

.sg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================================
   NOTICES
   ============================================================ */

.sg-notice {
    padding: var(--spacing-sm);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    margin-bottom: var(--spacing-sm);
}

.sg-notice-success {
    background: rgba(57,211,83,0.1);
    color: var(--color-success);
    border: 1px solid rgba(57,211,83,0.3);
}

.sg-notice-error {
    background: rgba(255,92,92,0.1);
    color: var(--color-error);
    border: 1px solid rgba(255,92,92,0.3);
}

/* ============================================================
   REPORT MODAL
   ============================================================ */

.sg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.sg-modal-overlay.open {
    display: flex;
}

.sg-modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.sg-modal h3 {
    margin-top: 0;
    font-size: 1.05rem;
}

.sg-modal-close {
    float: right;
    font-size: 1.3rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--color-muted);
    line-height: 1;
    margin-top: -0.2rem;
}

/* ============================================================
   HOME — HERO
   ============================================================ */

.sg-hero {
    margin-bottom: var(--spacing-lg);
}

.sg-hero-title {
    font-size: 2.4rem;
    margin-top: 0;
    margin-bottom: var(--spacing-xs);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sg-hero-sub {
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--color-muted);
    margin-bottom: var(--spacing-md);
}

.sg-section-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.4rem;
    margin-bottom: var(--spacing-sm);
}

/* ============================================================
   PROMPT INDEX — SEARCH
   ============================================================ */

.sg-search-bar {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.sg-search-bar input[type="search"] {
    flex: 1;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #111925;
    color: var(--color-text);
}

.sg-search-bar input[type="search"]:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(57,211,83,0.15);
}

/* ============================================================
   RULES PAGE
   ============================================================ */

.sg-rules-content h2 {
    font-size: 1.15rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.35rem;
    color: var(--color-accent);
}

.sg-rules-content ul {
    padding-left: 1.4rem;
}

.sg-rules-content li {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
    html { font-size: 16px; }
    .sg-hero-title { font-size: 1.8rem; }
    .sg-header-inner { flex-direction: column; gap: 0.25rem; }
    .sg-nav { gap: var(--spacing-sm); }
}
