/* LangitKita — Kelompok 6 Praktikum Cloud Computing UMI */

:root {
  --paper: #f4f1ea;
  --ink: #111a26;
  --ink-soft: #46526a;
  --line: rgba(17, 26, 38, .12);
  --card: #ffffff;
  --navy: #17375e;
  --sun: #ffb547;
  --sky-blue: #2f6fae;
  --danger: #b4232c;
  --warn: #8a5200;
  --radius: 22px;
  --font-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* warna langit berubah sesuai kondisi cuaca (lihat [data-sky]) */
  --sky-1: #24548a;
  --sky-2: #5f93c7;
  --sky-3: #8fb6dc;
}

body[data-sky="clear-day"]    { --sky-1: #1659a8; --sky-2: #3f8fd8; --sky-3: #f0b45e; }
body[data-sky="clear-night"]  { --sky-1: #0a1430; --sky-2: #1d2f63; --sky-3: #3d4f8a; }
body[data-sky="clouds-day"]   { --sky-1: #34577d; --sky-2: #5f84aa; --sky-3: #8faac4; }
body[data-sky="clouds-night"] { --sky-1: #121b2c; --sky-2: #2a3850; --sky-3: #4a5a74; }
body[data-sky="rain"]         { --sky-1: #1d3446; --sky-2: #3c5a70; --sky-3: #6b879a; }
body[data-sky="storm"]        { --sky-1: #121426; --sky-2: #2c2848; --sky-3: #574d7a; }
body[data-sky="snow"]         { --sky-1: #4a6a8c; --sky-2: #7e9cba; --sky-3: #b7c9db; }
body[data-sky="mist"]         { --sky-1: #4d5a66; --sky-2: #75838e; --sky-3: #a3adb3; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, .now-temp, .brand-text strong, .metric dd, .hourly-list .t, .range, .daily-list .day {
  font-family: var(--font-display);
}

/* ============ LANGIT + EFEK ANIMASI ============ */
.sky {
  position: absolute;
  inset: 0 0 auto 0;
  height: 600px;
  overflow: hidden;
  z-index: -1;
  background: linear-gradient(165deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  background-size: 160% 160%;
  animation: skyShift 10s ease-in-out infinite alternate;
  transition: background .8s ease;
}
.sky::after { /* cakrawala: memudar ke warna kertas */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 110px;
  background: linear-gradient(to bottom, transparent, var(--paper));
  z-index: 3;
}
@keyframes skyShift {
  from { background-position: 0% 0%; }
  to   { background-position: 100% 100%; }
}

/* awan melayang */
.fx-clouds { position: absolute; inset: 0; z-index: 1; }
.cloud {
  position: absolute;
  left: 0;
  width: 220px; height: 64px;
  background: #fff;
  border-radius: 64px;
  opacity: .22;
  filter: blur(2px);
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.cloud::before { width: 96px; height: 96px; left: 34px; top: -48px; }
.cloud::after  { width: 70px; height: 70px; left: 112px; top: -30px; }
.c1 { top: 70px;  animation-duration: 42s;  animation-delay: -10s; transform: scale(1.1); }
.c2 { top: 190px; animation-duration: 60s;  animation-delay: -35s; opacity: .16; }
.c3 { top: 300px; animation-duration: 50s;  animation-delay: -20s; opacity: .18; }
.c4 { top: 130px; animation-duration: 75s;  animation-delay: -55s; opacity: .12; }
@keyframes drift {
  from { translate: -280px 0; }
  to   { translate: calc(100vw + 280px) 0; }
}
body[data-sky^="clouds"] .cloud, body[data-sky="rain"] .cloud, body[data-sky="mist"] .cloud { opacity: .38; }
body[data-sky="clear-day"] .cloud, body[data-sky="clear-night"] .cloud { opacity: .1; }

/* matahari / bulan berdenyut */
.fx-sun {
  position: absolute; z-index: 1;
  right: 8%; top: 70px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, #ffe3a3 0%, #ffbf4d 45%, rgba(255,181,71,0) 70%);
  opacity: 0;
  transition: opacity 1s;
  animation: pulse 6s ease-in-out infinite;
}
body[data-sky="clear-day"] .fx-sun, body[data-sky="clouds-day"] .fx-sun { opacity: .9; }
body[data-sky="clouds-day"] .fx-sun { opacity: .45; }
body[data-sky$="night"] .fx-sun {
  opacity: .85;
  background: radial-gradient(circle, #fdfbea 0%, #e8e6cf 30%, rgba(232,230,207,0) 62%);
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

/* bintang berkelip (malam) */
.fx-stars {
  position: absolute; inset: 0; z-index: 0; opacity: 0; transition: opacity 1s;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 28% 42%, #fff, transparent),
    radial-gradient(1.8px 1.8px at 47% 12%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 63% 30%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 78% 52%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 88% 16%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 36% 66%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 56% 58%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 6% 60%, #fff, transparent);
}
body[data-sky$="night"] .fx-stars { opacity: 1; animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .5; } }

/* hujan */
.fx-rain {
  position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity 1s;
  background-image: repeating-linear-gradient(100deg,
    transparent 0 22px, rgba(255,255,255,.35) 22px 23px, transparent 23px 46px);
  background-size: 240px 240px;
}
body[data-sky="rain"] .fx-rain, body[data-sky="storm"] .fx-rain {
  opacity: .55; animation: rain .45s linear infinite;
}
@keyframes rain { to { background-position: -42px 240px; } }

/* kilat (badai) */
.fx-flash { position: absolute; inset: 0; z-index: 2; background: #fff; opacity: 0; }
body[data-sky="storm"] .fx-flash { animation: flash 7s infinite; }
@keyframes flash {
  0%, 90%, 94%, 100% { opacity: 0; }
  91% { opacity: .45; } 93% { opacity: .15; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============ HEADER ============ */
.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: #fff;
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand img { border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.3); transition: transform .3s; }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; text-shadow: 0 1px 8px rgba(0,0,0,.25); }
.brand-text strong { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.brand-text small { font-size: .8rem; font-weight: 600; opacity: .95; }
.badge {
  font-size: .78rem; font-weight: 700;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(8, 20, 40, .35);
  border: 1px solid rgba(255,255,255,.45);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* ============ PENCARIAN ============ */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 48px; position: relative; }

.search-panel { color: #fff; padding: 44px 0 34px; }
.search-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5.4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.02;
  max-width: 15ch;
  text-shadow: 0 2px 18px rgba(0,0,0,.28);
  animation: rise .7s .1s cubic-bezier(.2,.7,.2,1) both;
}
.search-panel h1 .accent { color: var(--sun); }
.lead {
  margin: 0 0 24px; max-width: 52ch;
  font-size: 1.05rem; font-weight: 500;
  text-shadow: 0 1px 10px rgba(0,0,0,.3);
  animation: rise .7s .2s cubic-bezier(.2,.7,.2,1) both;
}

.search {
  position: relative;
  display: flex; gap: 8px;
  max-width: 580px;
  background: var(--card);
  padding: 6px;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(6, 18, 36, .35);
  animation: rise .7s .3s cubic-bezier(.2,.7,.2,1) both;
  transition: box-shadow .25s, transform .25s;
}
.search:focus-within { outline: 3px solid var(--sun); outline-offset: 2px; transform: translateY(-2px); }
.search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; fill: none; stroke: var(--ink-soft); stroke-width: 2.2; stroke-linecap: round;
}
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0;
  font: inherit; font-size: 1.02rem; font-weight: 500;
  padding: 13px 12px 13px 44px;
  color: var(--ink); background: transparent;
}
.search input::placeholder { color: #7a8597; }
.search button {
  font: inherit; font-weight: 700; font-size: 1rem;
  border: 0; border-radius: 13px;
  padding: 0 24px;
  background: linear-gradient(135deg, var(--navy), #2a5c95);
  color: #fff;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.search button:hover { filter: brightness(1.12); box-shadow: 0 6px 16px rgba(23,55,94,.4); }
.search button:active { transform: scale(.96); }
.search button:disabled { opacity: .75; cursor: progress; }
.search button:disabled::after {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; vertical-align: -1px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
  animation: rise .7s .4s cubic-bezier(.2,.7,.2,1) both;
}
.chips button {
  font: inherit; font-size: .86rem; font-weight: 700;
  color: #fff;
  background: rgba(8, 20, 40, .32);
  border: 1px solid rgba(255,255,255,.5);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: background .2s, transform .2s, color .2s;
}
.chips button:hover { background: #fff; color: var(--navy); transform: translateY(-2px); }

.message {
  margin-top: 16px; max-width: 580px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600; font-size: .95rem;
  background: #fff; color: var(--danger);
  border-left: 5px solid var(--danger);
  box-shadow: 0 8px 22px rgba(10,25,45,.2);
  animation: shake .4s ease, rise .3s ease both;
}
.message.warn { color: var(--warn); border-left-color: var(--sun); }
.message.info { color: var(--navy); border-left-color: var(--navy); }
@keyframes shake {
  20%, 60% { translate: -6px 0; }
  40%, 80% { translate: 6px 0; }
}

/* ============ HASIL ============ */
.result { display: grid; grid-template-columns: 1fr; gap: 18px; transition: opacity .25s; }
.result.loading { opacity: .5; pointer-events: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.result.animate .card { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.result.animate .card:nth-child(2) { animation-delay: .08s; }
.result.animate .card:nth-child(3) { animation-delay: .16s; }
.result.animate .card:nth-child(4) { animation-delay: .24s; }
.result.animate .hourly-list li,
.result.animate .daily-list li {
  animation: rise .5s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(.3s + var(--i, 0) * 60ms);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(17, 26, 38, .08);
  min-width: 0;
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(17, 26, 38, .12); }
.card h3 {
  margin: 0 0 14px;
  font-size: .82rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}
.card h3::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--sun); box-shadow: 0 0 0 4px rgba(255,181,71,.25);
}
.card h3 small { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ink-soft); font-family: var(--font-body); }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }

/* cuaca saat ini */
.now {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #ffffff 55%, #fff6e6 100%);
}
.now::before {
  content: ""; position: absolute; right: -70px; top: -70px;
  width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,181,71,.45), transparent 70%);
  animation: pulse 6s ease-in-out infinite;
}
.now-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; position: relative; }
.eyebrow {
  margin: 0; font-size: .76rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em; color: var(--sky-blue);
}
.now h2 { margin: 2px 0 0; font-size: clamp(1.6rem, 3.6vw, 2.2rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
#local-time { margin: 4px 0 0; font-weight: 500; }
.now-icon {
  width: 108px; height: 108px; flex: none;
  background: radial-gradient(circle at 35% 30%, #7fb0e0 0%, #2f6fae 75%);
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(23,55,94,.35);
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px); } }
.now-temp { display: flex; align-items: flex-start; font-weight: 800; letter-spacing: -.06em; line-height: .95; margin-top: 10px; position: relative; }
.now-temp #temp {
  font-size: clamp(5rem, 14vw, 7.6rem);
  background: linear-gradient(180deg, var(--navy) 30%, var(--sky-blue));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.now-temp .unit { font-size: 1.8rem; margin-top: 14px; color: var(--sky-blue); letter-spacing: 0; }
.desc {
  display: inline-block;
  margin: 12px 0 6px; padding: 5px 14px;
  font-size: 1.05rem; font-weight: 700; text-transform: capitalize;
  color: var(--navy); background: #e6eef8; border-radius: 999px;
}
#minmax { margin: 4px 0 0; font-weight: 600; }

/* metrik */
.metrics { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric {
  padding: 13px 15px; border-radius: 15px;
  background: var(--paper);
  border: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.metric:hover { border-color: rgba(47,111,174,.35); background: #eef3f9; }
.metric dt { font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.metric dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.metric small { display: block; font-size: .8rem; font-weight: 600; }
.meter { height: 7px; margin-top: 9px; background: rgba(17,26,38,.12); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6fb7e8, var(--navy)); border-radius: inherit; transition: width 1s cubic-bezier(.2,.7,.2,1) .3s; }

/* 24 jam */
.hourly-list {
  list-style: none; margin: 0; padding: 0 0 6px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(82px, 1fr);
  gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
}
.hourly-list li {
  scroll-snap-align: start; text-align: center;
  padding: 10px 6px; border-radius: 15px;
  background: var(--paper); font-size: .85rem; font-weight: 600;
  transition: transform .2s, background .2s;
}
.hourly-list li:hover { transform: translateY(-4px); background: #e6eef8; }
.hourly-list li:first-child { background: #e6eef8; outline: 2px solid rgba(47,111,174,.35); }
.hourly-list .t { font-weight: 800; font-size: 1.1rem; }
.hourly-list .pop { color: var(--sky-blue); font-size: .76rem; font-weight: 700; }

/* ikon OpenWeather (awan putih) diberi latar biru supaya terlihat */
.hourly-list img, .daily-list img {
  display: block; margin: 5px auto;
  background: radial-gradient(circle at 35% 30%, #7fb0e0 0%, #2f6fae 75%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(23,55,94,.25);
}
.hourly-list img { width: 50px; height: 50px; }

/* 5 hari */
.daily-list { list-style: none; margin: 0; padding: 0; }
.daily-list li {
  display: grid;
  grid-template-columns: 92px 46px 1fr;
  grid-template-areas: "day icon desc" "day icon range";
  align-items: center; column-gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.daily-list li:first-child { border-top: 0; }
.daily-list .day { grid-area: day; font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.daily-list .day small { display: block; font-family: var(--font-body); font-weight: 600; color: var(--ink-soft); font-size: .78rem; }
.daily-list img { grid-area: icon; width: 46px; height: 46px; margin: 0; }
.daily-list .d-desc { grid-area: desc; font-size: .86rem; font-weight: 600; color: var(--ink-soft); text-transform: capitalize; }
.daily-list .d-desc .pop { color: var(--sky-blue); font-weight: 700; }
.range { grid-area: range; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .95rem; }
.range .lo { color: var(--sky-blue); min-width: 3ch; text-align: right; }
.range .hi { color: #c2541c; min-width: 3ch; }
.bar { position: relative; flex: 1; height: 7px; border-radius: 99px; background: rgba(17,26,38,.12); }
.bar span { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg, #6fb7e8, var(--sun), #f07a3a); }

.note { margin: 10px 0 0; color: var(--warn); font-size: .9rem; font-weight: 600; }
.updated { grid-column: 1 / -1; margin: 0; font-size: .84rem; font-weight: 600; text-align: right; }

/* ============ FOOTER ============ */
.footer { border-top: 1px solid var(--line); background: linear-gradient(180deg, #ebe6dc, #e3ddd0); font-size: .92rem; }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 28px 20px 34px; display: grid; gap: 14px; }
.team { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.team li {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 12px; font-weight: 700; font-size: .86rem;
  transition: transform .2s, box-shadow .2s;
}
.team li:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(17,26,38,.1); }
.team span { color: var(--ink-soft); font-weight: 600; margin-left: 4px; }
.footer a { color: var(--navy); font-weight: 700; }

/* ============ RESPONSIF ============ */
@media (min-width: 720px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .result { grid-template-columns: 5fr 7fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hourly, .daily { grid-column: 1 / -1; }
  .daily-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .daily-list li {
    grid-template-columns: 1fr;
    grid-template-areas: "day" "icon" "desc" "range";
    text-align: center; justify-items: center;
    border: 0; border-radius: 16px; background: var(--paper);
    padding: 16px 10px; row-gap: 6px;
    transition: transform .2s, background .2s;
  }
  .daily-list li:hover { transform: translateY(-4px); background: #e6eef8; }
  .range { width: 100%; }
}
@media (max-width: 600px) {
  .sky { height: 640px; }
  .fx-sun { width: 110px; height: 110px; right: 4%; top: 90px; }
}
@media (max-width: 420px) {
  .badge { display: none; }
  .search button { padding: 0 16px; }
  .card { padding: 18px; }
  .daily-list li { grid-template-columns: 74px 42px 1fr; }
  .now-icon { width: 88px; height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
