blob: e64af31bc387f4ff533d45cd4874c5459bd659f1 [file] [log] [blame]
/* Copyright 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
html {
/* Constants. */
--tile-height: 128px;
--tile-margin: 16px;
--tile-width: 154px;
--title-height: 32px;
/* May be overridden by themes (on the body element). */
--tile-title-color: #323232;
}
body {
background: none transparent;
color: var(--tile-title-color);
margin: 0;
overflow: hidden;
padding: 0;
user-select: none;
}
a {
display: block;
}
a,
a:active,
a:hover,
a:visited {
color: inherit;
text-decoration: none;
}
#most-visited {
margin: 0;
text-align: -webkit-center;
user-select: none;
}
#mv-tiles,
.mv-tiles-old {
font-size: 0;
/* Two rows of tiles of 128px each, and 16px of spacing between the rows.
* If you change this, also change the corresponding values in
* local_ntp.css. */
height: calc(2*var(--tile-height) + var(--tile-margin));
line-height: calc(var(--tile-height) + var(--tile-margin));
margin: 4px 0 8px 0;
opacity: 0;
position: absolute;
/* This align correctly for both LTR and RTL */
text-align: -webkit-auto;
transition: opacity 1s;
user-select: none;
}
.mv-tile,
.mv-empty-tile {
border-radius: 2px;
box-sizing: border-box;
display: none;
font-family: arial, sans-serif;
font-size: 12px;
height: var(--tile-height);
line-height: 100%;
margin: 0 calc(var(--tile-margin) / 2);
opacity: 1;
position: relative;
vertical-align: top;
white-space: nowrap;
width: var(--tile-width);
}
/* Minimal layout: 2 columns; only first 4 tiles are visible. */
.mv-tile:nth-child(-n+4),
.mv-empty-tile:nth-child(-n+4) {
display: inline-block;
}
/* width >= (3 cols * (16px + 154px))
* 3 columns; first 6 tiles are visible. */
@media (min-width: 510px) {
.mv-tile:nth-child(-n+6),
.mv-empty-tile:nth-child(-n+6) {
display: inline-block;
}
}
/* width >= (4 cols * (16px + 154px))
* 4 columns; first 8 tiles are visible. */
@media (min-width: 680px) {
.mv-tile:nth-child(-n+8),
.mv-empty-tile:nth-child(-n+8) {
display: inline-block;
}
}
.mv-tile {
background: rgb(250,250,250);
}
.mv-empty-tile {
background: rgb(245,245,245);
}
body.dark-theme .mv-tile,
body.dark-theme .mv-empty-tile {
background: rgb(51,51,51);
}
.mv-tile {
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.08);
cursor: pointer;
transition-duration: 200ms;
transition-property: transform, box-shadow, margin, opacity, width;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
.mv-tile:hover:not(:active),
.mv-tile:focus-within:not(:active) {
box-shadow: 0 3px 8px 0 rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.08);
}
.mv-tile:focus,
.mv-tile:focus-within {
filter: brightness(92%);
}
.mv-tile:active {
box-shadow: 0 3px 8px 0 rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.12);
filter: brightness(88%);
}
.mv-tile.blacklisted {
margin: 0;
transform: scale(0, 0);
width: 0;
}
.mv-title {
height: 15px;
left: 31px;
line-height: 14px;
overflow: hidden;
padding: 0;
position: absolute;
text-overflow: ellipsis;
top: 9px;
width: 120px;
}
.mv-title.multiline {
white-space: pre-wrap;
word-wrap: break-word;
}
html:not([dir=rtl]) .mv-title[style*='direction: rtl'] {
-webkit-mask-image:
linear-gradient(to left, black, black, 100px, transparent);
left: auto;
right: 8px;
text-align: right;
}
html[dir=rtl] .mv-title {
left: 8px;
text-align: left;
}
html[dir=rtl] .mv-title[style*='direction: rtl'] {
-webkit-mask-image:
linear-gradient(to left, black, black, 100px, transparent);
right: 31px;
text-align: right;
}
.mv-thumb {
border-radius: 0 0 2px 2px;
cursor: pointer;
display: block;
height: calc(var(--tile-height) - var(--title-height));
overflow: hidden;
position: absolute;
top: var(--title-height);
width: var(--tile-width);
}
.mv-thumb img {
height: auto;
min-height: 100%;
width: 100%;
}
.mv-thumb.failed-img {
background-color: rgb(245,245,245);
}
body.dark-theme .mv-thumb.failed-img {
background-color: #555;
}
/* We use ::after without content to provide an aditional element on top of the
* thumbnail. */
.mv-thumb.failed-img::after {
border: 8px solid rgb(215,215,215);
border-radius: 50%;
content: '';
display: block;
height: 0;
margin: 39px 66px;
width: 0;
}
body.dark-theme .mv-thumb.failed-img::after {
border-color: #333;
}
.mv-x {
background: linear-gradient(to left, rgb(250,250,250) 60%, transparent);
border: none;
cursor: pointer;
height: var(--title-height);
opacity: 0;
padding: 0;
position: absolute;
right: 0;
transition: opacity 150ms;
width: 40px;
}
body.dark-theme .mv-x {
background: linear-gradient(to left, rgb(51,51,51) 60%, transparent);
}
/* We use ::after without content to provide the masked X element. The "bottom"
* div is actually just the gradient. */
.mv-x::after {
--mask-offset: calc((var(--title-height) - var(--mask-width)) / 2);
--mask-width: 10px;
-webkit-mask-image: -webkit-image-set(
url(chrome-search://local-ntp/images/close_3_mask.png) 1x,
url(chrome-search://local-ntp/images/close_3_mask.png@2x) 2x);
-webkit-mask-position: var(--mask-offset) var(--mask-offset);
-webkit-mask-repeat: no-repeat;
-webkit-mask-size: var(--mask-width);
background-color: rgba(90,90,90,0.7);
content: '';
display: block;
height: var(--title-height);
position: absolute;
right: 0;
top: 0;
width: var(--title-height);
}
body.dark-theme .mv-x.mv-x::after {
background-color: rgba(255,255,255,0.7);
}
html[dir=rtl] .mv-x {
background: linear-gradient(to right, rgb(250,250,250) 60%, transparent);
left: -1px;
right: auto;
}
body.dark-theme body.dark-theme .mv-x {
background: linear-gradient(to right, rgb(51,51,51) 60%, transparent);
}
html[dir=rtl] .mv-x::after {
left: -1px;
right: auto;
}
.mv-x:hover::after {
background-color: rgb(90,90,90);
}
body.dark-theme .mv-x:hover::after {
background-color: #fff;
}
.mv-x:active::after {
background-color: rgb(66,133,244);
}
body.dark-theme .mv-x:active::after {
background-color: rgba(255,255,255,0.5);
}
.mv-tile:hover .mv-x,
.mv-tile:focus .mv-x {
opacity: 1;
transition-delay: 500ms;
}
.mv-x:hover,
.mv-x:focus {
opacity: 1;
transition: none;
}
.mv-favicon {
background-size: 16px;
height: 16px;
left: 7px;
margin: 0;
pointer-events: none;
position: absolute;
top: 8px;
width: 16px;
}
html[dir=rtl] .mv-favicon {
left: auto;
right: 7px;
}
.mv-favicon.failed-favicon {
background-image: -webkit-image-set(
url(chrome-search://local-ntp/images/ntp_default_favicon.png) 1x,
url(chrome-search://local-ntp/images/ntp_default_favicon.png@2x) 2x);
background-repeat: no-repeat;
background-size: 16px 16px;
}
.mv-favicon img {
height: 100%;
width: 100%;
}
.mv-favicon.failed-favicon img {
display: none;
}