:root{
  --bg:#ffffff;
  --text:#111;
  --muted:#666;
  --card:#ffffff;
  --border:#eaeaea;
  --link:#0b57d0;
  --shadow:0 1px 0 rgba(0,0,0,.04);
}

html[data-theme="dark"]{
  --bg:#0b0f14;
  --text:#e8eef6;
  --muted:#9aa6b2;
  --card:#0f1620;
  --border:#1f2a37;
  --link:#7cb7ff;
  --shadow:none;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

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

.topbar{
  position:sticky;
  top:0;
  z-index:50;
  display:flex;
  gap:16px;
  align-items:center;
  padding:12px 18px;
  border-bottom:1px solid var(--border);
  background:color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter:blur(10px);
}

.brand{font-weight:800;color:var(--text)}
.weather{color:var(--muted);font-size:14px}

.topbar__left{min-width:160px}
.topbar__center{flex:1;display:flex;justify-content:center}
.topbar__right{min-width:260px;display:flex;justify-content:flex-end;align-items:center}

.segmented{
  display:inline-flex;
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  background:var(--card);
}
.segmented__btn{
  padding:7px 10px;
  border:0;
  background:transparent;
  color:var(--text);
  cursor:pointer;
  font-size:13px;
}
.segmented__btn[aria-pressed="true"]{
  background:color-mix(in srgb, var(--link) 18%, transparent);
}

.layout{
  max-width:1200px;
  margin:0 auto;
  padding:18px;
}

.grid3{
  display:grid;
  grid-template-columns:260px minmax(0, 1fr) 320px;
  gap:18px;
  align-items:start;
}

.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  box-shadow:var(--shadow);
}

.h2{margin:0 0 12px;font-size:16px}
.small{font-size:13px;color:var(--muted)}

.news-item{
  display:grid;
  grid-template-columns:140px minmax(0, 1fr);
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid var(--border);
}
.news-item:last-child{border-bottom:0}

.thumb{
  width:140px;
  height:92px;
  border-radius:10px;
  border:1px solid var(--border);
  background:color-mix(in srgb, var(--muted) 10%, transparent);
  object-fit:cover;
}

.title{margin:0 0 6px;font-size:16px;font-weight:750;line-height:1.25}
.meta{font-size:12px;color:var(--muted);margin-bottom:6px}
.summary{margin:0;color:var(--text);opacity:.92}

.right-list .item{
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.right-list .item:last-child{border-bottom:0}
.right-list .item .meta{margin:0 0 4px}

@media (max-width: 980px){
  .grid3{grid-template-columns:1fr}
  .topbar__left,.topbar__right{min-width:auto}
  .topbar__center{display:none}
}

/* --- FEED: vertical card (image on top, text below) --- */
.news-item{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
}

.news-item .thumb{
  width:100%;
  height:auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
}

/* tighten title/source spacing a bit */
.news-item .title{ margin: 0; }
.news-item .meta{ margin: 0 0 6px; }

/* --- FORCE: feed items vertical (override earlier rules) --- */
.panel .news-item{
  display:flex !important;
  flex-direction:column !important;
  align-items:flex-start !important;
  gap:10px !important;
}

.panel .news-item .thumb{
  width:100% !important;
  height:auto !important;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
}

.panel .news-item .title{ margin:0 !important; }
.panel .news-item .meta{ margin:0 0 6px !important; }

/* --- HOME: left sidebar pinned to left edge + centered main column --- */
.home-shell{
  display:grid;
  grid-template-columns: 240px minmax(640px, 920px) 320px;
  gap:16px;
  align-items:start;

  /* left edge */
  width:100%;
  padding: 0 24px;
  box-sizing:border-box;
}

.home-shell > .panel{ min-width:0; }

/* keep sidebar visually "left" */
.home-shell .home-left{
  position: sticky;
  top: 72px;
  height: fit-content;
}

/* responsive */
@media (max-width: 1100px){
  .home-shell{
    grid-template-columns: 220px 1fr;
  }
  .home-shell .home-right{ display:none; }
}

@media (max-width: 820px){
  .home-shell{
    grid-template-columns: 1fr;
    padding: 0 14px;
  }
  .home-shell .home-left{
    position: static;
  }
}

/* --- Search bar (centered wide) --- */
.searchbar{
  width:100%;
  padding: 10px 24px 0;
  box-sizing:border-box;
}

.searchbar-form{
  max-width: 920px;
  margin: 0 auto;
  display:flex;
  gap:10px;
  align-items:center;
}

.searchbar-input{
  flex:1;
  height:44px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0 14px;
  outline:none;
}

.searchbar-input:focus{
  border-color: rgba(40,120,255,.45);
  box-shadow: 0 0 0 4px rgba(40,120,255,.12);
}

.searchbar-btn{
  height:44px;
  padding: 0 16px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: var(--accent, #2b6fff);
  color: #fff;
  cursor:pointer;
}

/* --- HOME: make main layout full width (override .layout max-width centering) --- */
body.home .layout{
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* --- HOME: center column matches searchbar width and aligns with it --- */
body.home{
  --center-w: 1040px;   /* должно совпадать с .searchbar-form max-width */
  --col-gap: 16px;     /* оставить как сейчас между колонками */
  --top-gap: 16px;     /* зазор между поиском и контентом */
}

/* searchbar already centered; add a bit more space below it */
body.home .searchbar{ padding-bottom: var(--top-gap); }

/* 3-column grid where the center column is exactly --center-w */
body.home .home-shell{
  display:grid;
  grid-template-columns: 240px var(--center-w) 320px;
  gap: var(--col-gap);
  justify-content: center;   /* центрируем всю тройку колонок */
  width: 100%;
  padding: 0 24px;
  box-sizing: border-box;
}

/* left sidebar still sticky */
body.home .home-shell .home-left{
  position: sticky;
  top: 72px;
  height: fit-content;
}

/* responsive */
@media (max-width: 1100px){
  body.home .home-shell{
    grid-template-columns: 220px 1fr;
    justify-content: stretch;
  }
  body.home .home-shell .home-right{ display:none; }
}

@media (max-width: 820px){
  body.home .home-shell{
    grid-template-columns: 1fr;
    padding: 0 14px;
  }
  body.home .home-shell .home-left{ position: static; }
}

/* ==============================
   HOME "dashboard" layout: side | center | side
   Search input aligned to center column
   ============================== */

body.home{
  --side-w: 300px;     /* ширина левой и правой колонок (одинаковая) */
  --center-w: 1040px;   /* ширина центральной колонки (оставь/подгони под себя) */
  --gap: 16px;
  --page-pad: 16px;
}

/* make main full width on home (already added earlier, keep) */
body.home .layout{
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 3-column grid */
body.home .home-shell{
  display:grid;
  grid-template-columns: var(--side-w) var(--center-w) var(--side-w);
  gap: var(--gap);
  justify-content: center;         /* симметрия относительно центра */
  width: 100%;
  padding: 0 var(--page-pad);
  box-sizing: border-box;
  align-items:start;
}

/* optional: sidebar sticky */
body.home .home-left,
body.home .home-right{
  position: sticky;
  top: 72px;
  height: fit-content;
}

/* SEARCH: grid aligned with home-shell columns */
body.home .searchbar{
  padding: 12px var(--page-pad) 16px;
  box-sizing:border-box;
}

body.home .searchbar-form{
  max-width: calc(var(--side-w) + var(--center-w) + var(--side-w) + (2 * var(--gap)));
  margin: 0 auto;
  display:grid;
  grid-template-columns: var(--side-w) var(--center-w) var(--side-w);
  gap: var(--gap);
  align-items:center;
}

/* input exactly in center column width */
body.home .searchbar-input{
  grid-column: 2;
  width: 100%;
}

/* button on the right side column (so it "уходит вправо") */
body.home .searchbar-btn{
  grid-column: 3;
  justify-self: start;
}

/* responsive */
@media (max-width: 1500px){
  body.home{ --center-w: 1040px; }
}
@media (max-width: 1300px){
  body.home{
    --side-w: 260px;
    --center-w: 1040px;
  }
}
@media (max-width: 1100px){
  body.home .home-shell{
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  body.home .home-left,
  body.home .home-right{
    position: static;
  }
  body.home .searchbar-form{
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  body.home .searchbar-input,
  body.home .searchbar-btn{
    grid-column: auto;
  }
  body.home .searchbar-btn{
    justify-self: end;
  }
}

/* --- home: center news cards --- */
.home-center .news-grid{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-card{
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  background: var(--panel-bg, #fff);
}

.news-card__img img{
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.news-card__meta{
  font-size: 12px;
  opacity: .85;
  margin-bottom: 6px;
}

.news-card__title{
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
}

.news-card__desc{
  font-size: 13px;
  line-height: 1.45;
  opacity: .95;
  margin-bottom: 10px;
}

.news-card__tags{
  font-size: 12px;
  opacity: .75;
}

@media (max-width: 960px){
  .news-card{ grid-template-columns: 1fr; }
  .news-card__img img{ height: 180px; }
}

/* --- brand: Proxyon рядом с логотипом --- */
.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-name{
  font-family: "Orbitron", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 16px;
  text-transform: none;
}

/* --- NEWS CARD (home.html uses .news-card) --- */
.news-grid{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.news-card{
  display:grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap:14px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card);
  box-shadow:var(--shadow);
}

.news-card__img img{
  width:100%;
  height:140px;
  object-fit:cover;
  border-radius:12px;
  border:1px solid var(--border);
  display:block;
}

.news-card__meta{
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

.news-card__title{
  font-size:16px;
  font-weight:750;
  line-height:1.25;
  margin:0 0 6px;
}

.news-card__desc{
  color:var(--text);
  opacity:.92;
  font-size:14px;
}

.news-card__tags{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

/* responsive */
@media (max-width: 820px){
  .news-card{
    grid-template-columns: 1fr;
  }
  .news-card__img img{ height:auto; aspect-ratio: 16/9; }
}

/* --- HOME feed cards (home.html uses .news-card) --- */
.news-grid{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.news-card{
  display:grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap:14px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card);
  box-shadow:var(--shadow);
}

.news-card__img img{
  width:100%;
  height:140px;
  object-fit:cover;
  border-radius:12px;
  border:1px solid var(--border);
  display:block;
}

.news-card__meta{
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

.news-card__title{
  font-size:16px;
  font-weight:750;
  line-height:1.25;
  margin:0 0 6px;
}

.news-card__desc{
  color:var(--text);
  opacity:.92;
  font-size:14px;
}

.news-card__tags{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

@media (max-width: 820px){
  .news-card{ grid-template-columns: 1fr; }
  .news-card__img img{ height:auto; aspect-ratio:16/9; }
}


/* FORCE: dark mode card background/text */
html[data-theme="dark"] body.home .news-card{
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] body.home .news-card *{
  color: inherit;
}
html[data-theme="dark"] body.home .news-card a{
  color: var(--link) !important;
}
html[data-theme="dark"] body.home .news-card__meta,
html[data-theme="dark"] body.home .news-card__tags{
  color: var(--muted) !important;
}
