/* ===========================================================
   PhotoHours — thème "cycle du jour"
   Palette ancrée dans le ciel réel : nuit profonde → golden hour
   =========================================================== */

:root {
    --night: #0B1026;
    --twilight: #2D2A5E;
    --nautical: #45527A;
    --civil: #6B8CAE;
    --golden: #F2A65A;
    --golden-deep: #C2542C;
    --paper: #F5EFE3;
    --paper-dim: #C9C2B4;
    --ink: #1A1610;

    --bg: var(--night);
    --surface: #131A33;
    --surface-raised: #1B2342;
    --border: rgba(245, 239, 227, 0.10);

    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Space Grotesk", -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(242, 166, 90, 0.10), transparent),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(107, 140, 174, 0.08), transparent);
    color: var(--paper);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--paper);
}

.brand-mark {
    font-size: 1.4rem;
    color: var(--golden);
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.main-nav {
    display: flex;
    gap: 4px;
}

.main-nav a {
    color: var(--paper-dim);
    text-decoration: none;
    font-size: 0.92rem;
    padding: 8px 16px;
    border-radius: 100px;
    transition: all 0.2s ease;
}

.main-nav a:hover {
    color: var(--paper);
    background: var(--surface-raised);
}

.main-nav a.active {
    color: var(--night);
    background: var(--golden);
    font-weight: 500;
}

/* ---------- Content ---------- */
.content {
    flex: 1;
    padding: 32px 0 60px;
}

/* ---------- Day header ---------- */
.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-arrow {
    color: var(--paper-dim);
    text-decoration: none;
    font-size: 1.3rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.nav-arrow:hover {
    border-color: var(--golden);
    color: var(--golden);
}

.date-display h1 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 500;
    margin: 0;
}

.today-link {
    color: var(--golden);
    font-size: 0.82rem;
    text-decoration: none;
}

.today-link:hover { text-decoration: underline; }

.location-picker select {
    background: var(--surface-raised);
    color: var(--paper);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    cursor: pointer;
}

.location-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.location-label {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--civil);
    font-family: var(--font-mono);
}

.btn-geoloc {
    background: var(--surface-raised);
    color: var(--paper);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-geoloc:hover {
    border-color: var(--golden);
    color: var(--golden);
}

.btn-geoloc:disabled {
    opacity: 0.6;
    cursor: wait;
}

.geoloc-status {
    margin: -8px 0 20px;
    font-size: 0.82rem;
    color: var(--civil);
}

.geoloc-status.geoloc-error {
    color: var(--golden-deep);
}

.geoloc-save-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: -8px 0 24px;
}

.geoloc-save-box p {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--paper-dim);
}

.geoloc-save-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.geoloc-save-form input[type="text"] {
    flex: 1;
    min-width: 200px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 0.88rem;
}

.geoloc-save-form input[type="text"]:focus {
    outline: none;
    border-color: var(--golden);
}

/* ---------- Timeline (élément signature) ---------- */
.timeline-wrap {
    margin-bottom: 36px;
}

.timeline {
    position: relative;
    height: 56px;
    border-radius: 100px;
    overflow: hidden;
    background: linear-gradient(
        to right,
        var(--night) 0%,
        var(--night) 8%,
        var(--twilight) 17%,
        var(--nautical) 22%,
        var(--civil) 27%,
        var(--golden) 31%,
        var(--paper) 38%,
        var(--paper) 62%,
        var(--golden) 69%,
        var(--civil) 73%,
        var(--nautical) 78%,
        var(--twilight) 83%,
        var(--night) 92%,
        var(--night) 100%
    );
    box-shadow: inset 0 2px 12px rgba(0,0,0,0.3), 0 8px 30px rgba(242, 166, 90, 0.08);
}

.timeline-now {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--golden-deep);
    box-shadow: 0 0 12px var(--golden);
}

.timeline-now::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--golden-deep);
    box-shadow: 0 0 8px var(--golden);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--paper-dim);
}

/* ---------- Cards ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.card-sun::before { background: linear-gradient(to right, var(--nautical), var(--golden)); }
.card-golden::before { background: linear-gradient(to right, var(--golden), var(--golden-deep)); }
.card-moon::before { background: linear-gradient(to right, var(--twilight), var(--civil)); }

.card h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0 0 16px;
    color: var(--paper);
}

.time-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.time-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.time-list > div:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.time-list dt {
    font-size: 0.82rem;
    color: var(--paper-dim);
    margin: 0;
}

.time-list dd {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    margin: 0;
    color: var(--paper);
}

.time-list .highlight dt,
.time-list .highlight dd {
    color: var(--golden);
    font-weight: 500;
}

.note {
    margin: 16px 0 0;
    font-size: 0.82rem;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(242, 166, 90, 0.08);
    color: var(--golden);
}

.note.muted {
    background: rgba(245, 239, 227, 0.05);
    color: var(--paper-dim);
}

.moon-phase {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.moon-icon {
    font-size: 2.2rem;
    line-height: 1;
    width: 52px;
    height: 52px;
    min-width: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(245, 239, 227, 0.04);
}

.moon-name {
    margin: 0 0 2px;
    font-weight: 500;
}

.moon-illum {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--paper-dim);
}

.muted { color: var(--paper-dim); }

/* ---------- Week view ---------- */
.week-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.week-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.week-table th {
    text-align: left;
    padding: 14px 16px;
    background: var(--surface-raised);
    color: var(--paper-dim);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.week-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.86rem;
}

.week-table td a {
    color: var(--paper);
    text-decoration: none;
    font-family: var(--font-body);
}

.today-row {
    background: rgba(242, 166, 90, 0.06);
}

.today-row td:first-child {
    border-left: 2px solid var(--golden);
}

/* ---------- Locations page ---------- */
.locations-page h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 24px;
}

.locations-list {
    list-style: none;
    margin: 0 0 32px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.location-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
}

.location-item.is-default {
    border-color: rgba(242, 166, 90, 0.4);
}

.location-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.location-info .muted {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.badge {
    background: var(--golden);
    color: var(--night);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
}

.location-actions {
    display: flex;
    gap: 14px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--civil);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
}

.btn-text:hover { text-decoration: underline; }
.btn-danger { color: var(--golden-deep); }

.add-location-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 420px;
}

.add-location-card h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 16px;
}

.location-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.location-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--paper-dim);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row label { flex: 1; }

.location-form input {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.location-form input:focus {
    outline: none;
    border-color: var(--golden);
}

.btn-primary {
    background: var(--golden);
    color: var(--night);
    border: none;
    border-radius: 100px;
    padding: 11px 20px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    margin-top: 4px;
    transition: filter 0.2s ease;
}

.btn-primary:hover { filter: brightness(1.1); }

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--paper-dim);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .topbar { flex-direction: column; gap: 14px; align-items: flex-start; }
    .day-header { flex-direction: column; align-items: stretch; }
    .date-nav { justify-content: space-between; }
    .week-table { font-size: 0.78rem; }
    .week-table th, .week-table td { padding: 10px 10px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Focus visibility ---------- */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
    outline: 2px solid var(--golden);
    outline-offset: 2px;
}
