/* ===================================
   오날입 — style.css
   Aesthetic: Soft Atmospheric Minimal
=================================== */

/* ── Google Fonts fallback ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;600;700&family=Noto+Sans+KR:wght@300;400;500&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:          #f0f4fa;
  --bg2:         #e4ecf7;
  --surface:     #ffffff;
  --surface2:    #f7f9fd;
  --border:      rgba(120, 160, 220, 0.18);
  --text-main:   #1a2340;
  --text-sub:    #5a6a8a;
  --text-hint:   #9aaac8;
  --accent:      #4b80d4;
  --accent-soft: #dce8f8;
  --accent2:     #6fc4e8;
  --warm:        #f9a84d;
  --orb1:        rgba(100, 170, 255, 0.18);
  --orb2:        rgba(160, 210, 255, 0.10);
  --shadow-sm:   0 2px 12px rgba(60, 100, 180, 0.08);
  --shadow-md:   0 8px 32px rgba(60, 100, 180, 0.12);
  --shadow-lg:   0 16px 48px rgba(60, 100, 180, 0.14);
  --radius-sm:   12px;
  --radius-md:   20px;
  --radius-lg:   28px;
  --font-serif:  'Noto Serif KR', 'Georgia', serif;
  --font-sans:   'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  --transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg:          #0f1624;
  --bg2:         #151e30;
  --surface:     #1c2840;
  --surface2:    #162035;
  --border:      rgba(80, 130, 200, 0.18);
  --text-main:   #e8edf8;
  --text-sub:    #8aa0c8;
  --text-hint:   #4a607a;
  --accent:      #6aa0e8;
  --accent-soft: rgba(106, 160, 232, 0.15);
  --accent2:     #5ab8d8;
  --warm:        #f9a84d;
  --orb1:        rgba(60, 120, 220, 0.15);
  --orb2:        rgba(40, 100, 180, 0.08);
  --shadow-sm:   0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 16px 48px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
  position: relative;
  overflow-x: hidden;
}

/* ── Background ambient orbs ── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  transition: var(--transition);
}
body::before {
  width: 600px; height: 600px;
  top: -200px; right: -150px;
  background: radial-gradient(circle, var(--orb1), transparent 70%);
}
body::after {
  width: 500px; height: 500px;
  bottom: -150px; left: -100px;
  background: radial-gradient(circle, var(--orb2), transparent 70%);
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(240, 244, 250, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
[data-theme="dark"] .header {
  background: rgba(15, 22, 36, 0.85);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon { font-size: 1.5rem; line-height: 1; }
.logo-text {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.logo-sub {
  font-size: 0.65rem;
  color: var(--text-hint);
  font-weight: 300;
  letter-spacing: 0.04em;
  margin-top: 2px;
  display: none;
}
@media (min-width: 480px) { .logo-sub { display: inline; } }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.ctrl-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 48px;
  position: relative;
  z-index: 1;
}

/* ── State Cards (loading / error) ── */
.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 50vh;
  text-align: center;
  animation: fadeIn 0.5s ease both;
}
.state-icon { font-size: 3rem; }
.state-text {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-sub);
  line-height: 1.7;
}
.state-hint {
  font-size: 0.82rem;
  color: var(--text-hint);
  line-height: 1.7;
}
.retry-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 24px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(75, 128, 212, 0.3);
}
.retry-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

/* ── Spinner ── */
.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Content Area ── */
.content {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: background var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Weather Card ── */
.weather-card {
  background: linear-gradient(135deg, #daeeff 0%, #e8f4ff 50%, #f0f8ff 100%);
  border-color: rgba(100, 170, 240, 0.25);
}
[data-theme="dark"] .weather-card {
  background: linear-gradient(135deg, #162840 0%, #1a2e50 50%, #1e3258 100%);
  border-color: rgba(80, 140, 220, 0.25);
}

.weather-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.location-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.location-pin { font-size: 0.95rem; }
.location-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.date-wrap {
  font-size: 0.75rem;
  color: var(--text-sub);
  text-align: right;
  line-height: 1.6;
}

.weather-body {
  display: flex;
  align-items: center;
  gap: 24px;
}

.weather-icon-wrap {
  position: relative;
  flex-shrink: 0;
}
.weather-emoji {
  font-size: 4.5rem;
  line-height: 1;
  position: relative;
  z-index: 1;
  animation: floatEmoji 4s ease-in-out infinite;
  display: block;
}
.weather-orb {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,220,100,0.2), transparent 70%);
  animation: pulseOrb 3s ease-in-out infinite;
}

.weather-info { flex: 1; }

.temp-main {
  font-family: var(--font-serif);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -0.03em;
}
.temp-feel {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin: 4px 0 6px;
}
.weather-desc {
  font-size: 1rem;
  color: var(--text-sub);
  font-weight: 500;
  margin-bottom: 10px;
}
.weather-extras {
  display: flex;
  gap: 14px;
}
.extra-item {
  font-size: 0.78rem;
  color: var(--text-hint);
  background: rgba(255,255,255,0.5);
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(100, 160, 220, 0.15);
}
[data-theme="dark"] .extra-item {
  background: rgba(255,255,255,0.06);
}

/* ── Outfit Card ── */
.card-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.outfit-message {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-sub);
  line-height: 1.75;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

.outfit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.outfit-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  transition: all var(--transition);
  cursor: default;
}
.outfit-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.outfit-item-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  animation: floatEmoji 5s ease-in-out infinite;
}
.outfit-item:nth-child(2) .outfit-item-icon { animation-delay: 0.5s; }
.outfit-item:nth-child(3) .outfit-item-icon { animation-delay: 1s; }
.outfit-item:nth-child(4) .outfit-item-icon { animation-delay: 1.5s; }

.outfit-item-label {
  font-size: 0.68rem;
  color: var(--text-hint);
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.outfit-item-value {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

/* When 4 items (extra item visible) */
.outfit-grid:has(> :nth-child(4):not([style*="none"])) {
  grid-template-columns: repeat(2, 1fr);
}

/* ── Footer ── */
.footer {
  background: var(--surface2);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  position: relative;
  z-index: 1;
  transition: background var(--transition);
}

.footer-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.footer-icon { font-size: 1.2rem; margin-top: 1px; flex-shrink: 0; }
.footer-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.footer-reason {
  font-size: 0.88rem;
  color: var(--text-sub);
  line-height: 1.7;
}
.footer-credit {
  font-size: 0.7rem;
  color: var(--text-hint);
  text-align: center;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatEmoji {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes pulseOrb {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.15); }
}

/* ── Music Button ── */
.music-btn {
  position: relative;
  min-width: 36px;
  transition: all var(--transition);
}
.music-btn.music-off {
  opacity: 0.5;
}

/* ── Music Hint Toast ── */
.music-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg);
  font-size: 0.82rem;
  padding: 10px 20px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  animation: toastIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.music-hint.hidden {
  display: none !important;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .header-inner { padding: 12px 18px; }
  .main { padding: 20px 14px 40px; }
  .card { padding: 22px 18px; }
  .weather-body { gap: 16px; }
  .weather-emoji { font-size: 3.5rem; }
  .temp-main { font-size: 2.6rem; }
  .outfit-grid { gap: 10px; }
  .outfit-item { padding: 14px 8px; }
  .outfit-item-value { font-size: 0.8rem; }
}

@media (max-width: 360px) {
  .outfit-grid { grid-template-columns: repeat(2, 1fr); }
}
