/* =========================================================
   frontek reads — RSS/Atom reader (feeds.frontek.dev)
   Palette: teal #2A9D8F · coral #E76F51 · dark #264653
            gold #E9C46A · green #8AB17D · cream #F4F1DE
   Self-contained: system fonts, no external dependencies.
   Shares the brand language of frontek.dev.
   ========================================================= */

:root {
  --teal:  #2A9D8F;
  --coral: #E76F51;
  --dark:  #264653;
  --gold:  #E9C46A;
  --green: #8AB17D;
  --cream: #F8F6EF;
  --ink:   #21333b;
  --grey:  #5a6b73;
  --line:  #e4e0d4;
  --danger:#c0432c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(38,70,83,.08);
  --max: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* the hidden attribute must always win over component display rules
   (e.g. .modal { display: grid }), otherwise hidden panels stay visible */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; gap: 18px; height: 64px; }
.nav__brand { font-weight: 800; font-size: 1.25rem; color: var(--dark); letter-spacing: -.02em; margin-right: auto; }
.nav__brand span { color: var(--teal); }
.nav__links { display: flex; gap: 22px; }
.nav__links a { color: var(--grey); font-weight: 600; font-size: .92rem; }
.nav__links a:hover { color: var(--teal); text-decoration: none; }
.nav__links a.is-active { color: var(--dark); }
.nav__actions { display: flex; align-items: center; gap: 8px; }
.nav__toggle { display: none; background: none; border: 0; font-size: 1.5rem; color: var(--dark); cursor: pointer; }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--cream); border: 1px solid var(--line);
  color: var(--dark); font-size: 1.15rem; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.iconbtn:hover { background: #fff; transform: translateY(-1px); }
.iconbtn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- BUTTONS ---------- */
.btn { display: inline-block; padding: 11px 22px; border-radius: 999px; font-weight: 700; font-size: .92rem; cursor: pointer; border: 0; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: var(--coral); color: #fff; box-shadow: 0 8px 20px rgba(231,111,81,.32); }
.btn--ghost { background: transparent; color: var(--dark); border: 1.5px solid rgba(38,70,83,.25); }
.btn--ghost:hover { border-color: var(--dark); }
.btn--dark { color: var(--dark); border: 1.5px solid var(--dark); background: transparent; }
.btn--dark:hover { background: var(--dark); color: #fff; }
.btn--danger { color: #fff; background: var(--danger); }
.btn--sm { padding: 8px 15px; font-size: .84rem; }

/* ---------- SHARED HEADINGS ---------- */
.section { padding: 64px 0; }
.section--alt { background: var(--cream); border-top: 1px solid var(--line); }
.section__kicker { color: var(--coral); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .76rem; margin-bottom: 10px; }
.section__title { font-size: clamp(1.6rem, 3.4vw, 2.2rem); color: var(--dark); font-weight: 800; letter-spacing: -.02em; }
.lead { font-size: 1.06rem; color: var(--grey); max-width: 640px; }

/* ---------- FEED HEADER ---------- */
.feedhead { background: linear-gradient(135deg, var(--dark) 0%, #1c3640 70%, var(--teal) 150%); color: #fff; padding: 54px 0 40px; position: relative; overflow: hidden; }
.feedhead::after { content:""; position:absolute; right:-120px; top:-120px; width:360px; height:360px; border-radius:50%; background: radial-gradient(circle, rgba(233,196,106,.30), transparent 70%); }
.feedhead .container { position: relative; z-index: 1; }
.feedhead .section__kicker { color: var(--gold); }
.feedhead__title { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.feedhead .lead { color: #dfe9ea; margin-top: 12px; }
.feedhead__bar { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.feedhead__count { color: #cfe0e2; font-size: .9rem; font-weight: 600; }
.feedhead__filters { display: flex; flex-wrap: wrap; gap: 8px; }
.srcchip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: #eaf3f4; font-size: .82rem; font-weight: 600; padding: 5px 13px; border-radius: 999px; cursor: pointer; transition: background .15s; }
.srcchip:hover { background: rgba(255,255,255,.22); }
.srcchip.is-active { background: var(--gold); border-color: var(--gold); color: var(--dark); }

/* ---------- SEARCH ---------- */
.search { margin-top: 22px; display: flex; gap: 10px; max-width: 640px; }
.search__input { flex: 1; padding: 14px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.95); color: var(--ink); font-size: 1rem; }
.search__input:focus { outline: 2px solid var(--gold); }
.search__btn { white-space: nowrap; }
.search__cats { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- FEED BODY / STATUS ---------- */
.feedbody { padding: 34px 24px 72px; }
.feedstatus { color: var(--grey); font-size: .92rem; padding: 10px 0 4px; }
.feedstatus strong { color: var(--dark); }
.feedstatus.err { color: var(--danger); }

/* ---------- EMPTY STATE ---------- */
.empty { text-align: center; max-width: 480px; margin: 40px auto; }
.empty__ico { font-size: 3.4rem; }
.empty h2 { color: var(--dark); margin: 12px 0 8px; font-size: 1.5rem; }
.empty p { color: var(--grey); margin-bottom: 22px; }

/* ---------- ARTICLES ---------- */
.articles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.article { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .16s ease; }
.article:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(38,70,83,.13); }
.article__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: .8rem; }
.article__src { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--teal); }
.article__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.article__date { color: var(--grey); }
.article__title { margin-bottom: 10px; line-height: 1.3; }
.article__title a { color: var(--dark); font-size: 1.18rem; font-weight: 800; }
.article__title a:hover { color: var(--teal); text-decoration: none; }
.article__desc { color: var(--grey); font-size: .95rem; flex: 1; }
.article__foot { margin-top: 16px; display: flex; gap: 18px; align-items: center; }
.article__link { color: var(--teal); font-weight: 800; font-size: .9rem; cursor: pointer; }
.article__link--muted { color: var(--grey); font-weight: 700; }
.article__title a { cursor: pointer; }

/* ---------- CATALOG / DISCOVER CARDS ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 26px; }
.fcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.fcard__cat { align-self: flex-start; background: var(--cream); border: 1px solid var(--line); color: var(--grey); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.fcard__title { color: var(--dark); font-size: 1.12rem; font-weight: 800; margin-bottom: 3px; }
.fcard__url { color: var(--grey); font-size: .82rem; word-break: break-all; flex: 1; margin-bottom: 16px; }
.fcard__btns { display: flex; gap: 8px; }
.hint { color: var(--grey); font-size: .95rem; margin-top: 20px; }

/* ---------- SUBSCRIPTIONS ---------- */
.subs__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.subs__tools { display: flex; gap: 10px; }
.subs { display: grid; gap: 12px; }
.subrow { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.subrow__body { flex: 1; min-width: 0; }
.subrow__title { color: var(--dark); font-weight: 800; }
.subrow__url { color: var(--grey); font-size: .82rem; word-break: break-all; }
.subrow__empty { color: var(--grey); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; }

/* ---------- MODAL ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(28,54,64,.55); backdrop-filter: blur(2px); }
.modal__card { position: relative; width: 100%; max-width: 520px; background: #fff; border-radius: var(--radius); box-shadow: 0 30px 70px rgba(38,70,83,.35); overflow: hidden; }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal__head h2 { color: var(--dark); font-size: 1.25rem; }
.modal__body { padding: 22px 24px; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.field { display: block; margin-bottom: 6px; }
.field__label { display: block; font-weight: 800; color: var(--dark); margin-bottom: 4px; }
.field__hint { display: block; color: var(--grey); font-size: .86rem; margin-bottom: 10px; }
.field__hint code { background: var(--cream); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.field__input { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: .92rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.field__input:focus { outline: 2px solid var(--teal); }
.field__row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------- TOAST ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 13px 22px; border-radius: 999px; font-weight: 600; font-size: .92rem; box-shadow: 0 12px 30px rgba(38,70,83,.35); z-index: 200; }
.toast.err { background: var(--danger); }

/* ---------- READER PANEL ---------- */
.modal--reader { padding: 0; }
.reader { max-width: 760px; width: 100%; max-height: 100vh; height: 100%; display: flex; flex-direction: column; border-radius: 0; }
.reader__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 2; }
.reader__src { font-weight: 800; color: var(--teal); font-size: .95rem; }
.reader__scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.reader__inner { max-width: 680px; margin: 0 auto; padding: 34px 26px 72px; }
.reader__h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.2; color: var(--dark); letter-spacing: -.01em; }
.reader__h1 a { color: var(--dark); }
.reader__h1 a:hover { color: var(--teal); text-decoration: none; }
.reader__meta { color: var(--grey); font-size: .9rem; margin-top: 12px; }
.reader__sep { margin: 0 6px; }
.reader__actions { margin: 20px 0 10px; }
.reader__note { color: var(--grey); }

@media (min-width: 720px) {
  .modal--reader { padding: 20px; }
  .reader { border-radius: var(--radius); height: auto; max-height: calc(100vh - 40px); }
  .reader__head { border-radius: var(--radius) var(--radius) 0 0; }
}

/* ---------- PROSE (article body typography) ---------- */
.prose { color: var(--ink); font-size: 1.06rem; line-height: 1.75; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 1.5rem; color: var(--dark); margin: 1.6em 0 .5em; }
.prose h3 { font-size: 1.25rem; color: var(--dark); margin: 1.4em 0 .4em; }
.prose h4 { font-size: 1.1rem; color: var(--dark); margin: 1.2em 0 .4em; }
.prose a { color: var(--teal); text-decoration: underline; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; margin: 1.2em 0; display: block; }
.prose figure { margin: 1.4em 0; }
.prose figcaption { color: var(--grey); font-size: .88rem; text-align: center; margin-top: 8px; }
.prose ul, .prose ol { margin: 0 0 1.1em 1.3em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { margin: 1.4em 0; padding: 6px 20px; border-left: 4px solid var(--teal); color: var(--grey); font-style: italic; background: var(--cream); border-radius: 0 8px 8px 0; }
.prose pre { background: #1c2b32; color: #e7eef0; padding: 16px 18px; border-radius: 10px; overflow-x: auto; font-size: .9rem; margin: 1.2em 0; }
.prose code { background: var(--cream); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.3em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.8em 0; }

/* ---------- FOOTER ---------- */
.footer { background: var(--dark); color: #cdd9db; padding: 44px 0; }
.footer__inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.footer strong { color: #fff; font-size: 1.1rem; }
.footer p { font-size: .9rem; margin-top: 4px; }
.footer a { color: var(--gold); }
.footer__meta { text-align: right; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .nav__links { position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; gap: 0; padding: 8px 0; display: none; }
  .nav__links.open { display: flex; }
  .nav__links a { padding: 12px 24px; }
  .nav__toggle { display: block; }
  .articles { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .footer__inner { flex-direction: column; }
  .footer__meta { text-align: left; }
}
@media (max-width: 560px) {
  .search { flex-direction: column; }
  .search__input { width: 100%; }
}
